Author: xcoulon
Date: 2012-04-17 17:20:31 -0400 (Tue, 17 Apr 2012)
New Revision: 40261
Added:
trunk/documentation/movies/scripts/application.js
Modified:
trunk/documentation/movies/index.html
Log:
adding support for href in url. Videos are bookmarkable with nice hrefs all while avoiding
to load anything..
Modified: trunk/documentation/movies/index.html
===================================================================
--- trunk/documentation/movies/index.html 2012-04-17 21:11:14 UTC (rev 40260)
+++ trunk/documentation/movies/index.html 2012-04-17 21:20:31 UTC (rev 40261)
@@ -56,31 +56,31 @@
<div class="thumbnails span4">
<h2>Installation</h2>
<ul class="items">
- <li><a class="videocontrol" href="39743315">Eclipse
+ <li><a class="videocontrol"
href="marketplace">Eclipse
Marketplace</a></li>
- <li><a class="videocontrol" href="39606090">JBDS 5
+ <li><a class="videocontrol" href="installation">JBDS
5
Installation, HTML5, Mobile & OpenShift</a></li>
</ul>
</div>
<div class="thumbnails span4">
<h2>Technology Introductions</h2>
<ul class="items">
- <li><a class="videocontrol" href="39607154">Java EE
6 +
+ <li><a class="videocontrol"
href="jee6arquillian">Java EE 6 +
Arquillian</a></li>
- <li><a class="videocontrol"
href="39607711">Richfaces 4
+ <li><a class="videocontrol"
href="richfaces">Richfaces 4
Desktop & Mobile</a></li>
- <li><a class="videocontrol" href="39608223">Forge in
JBoss
+ <li><a class="videocontrol" href="forge">Forge in
JBoss
Developer Studio 5</a></li>
- <li><a class="videocontrol" href="39743919">Google
Web
+ <li><a class="videocontrol" href="gwt">Google Web
Toolkit</a></li>
</ul>
</div>
<div class="thumbnails span4">
<h2>Reverse Engineering/CRUD Generation</h2>
<ul class="items">
- <li><a class="videocontrol"
href="39608294">Hibernate
+ <li><a class="videocontrol"
href="hibreveng">Hibernate
Tools Reverse Engineering</a></li>
- <li><a class="videocontrol" href="39608326">Forge
Reverse
+ <li><a class="videocontrol" href="forgereveng">Forge
Reverse
Engineering</a></li>
</ul>
</div>
@@ -101,32 +101,6 @@
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript"
src="./scripts/jquery.js"></script>
- <script type="text/javascript">
- !function ($) {
- $(function(){
- var href=location.hash;
- if(href != "") {
- play(href.replace('#',''));
- }
- })
- }(window.jQuery)
-
- $(document).ready(function() {
- $('.videocontrol').click(function(e) {
- e.preventDefault(); //prevent href from actually loading
- var href = $(this).attr('href');
- location.hash = href;
- play(href);
- });
- })
-
- function play(videoId) {
- var videoURL = "http://player.vimeo.com/video/" + videoId +
"?portrait=0";
- $('#player').load(videoURL, function() {
- $('iframe').attr('src', videoURL);
- });
- return;
- }
- </script>
+ <script type="text/javascript"
src="./scripts/application.js"></script>
</body>
</html>
Added: trunk/documentation/movies/scripts/application.js
===================================================================
--- trunk/documentation/movies/scripts/application.js (rev 0)
+++ trunk/documentation/movies/scripts/application.js 2012-04-17 21:20:31 UTC (rev 40261)
@@ -0,0 +1,45 @@
+!function ($) {
+ $(function(){
+ var href=location.hash;
+ if(href != "") {
+ play(href.replace('#',''));
+ }
+ })
+}(window.jQuery)
+
+$(document).ready(function() {
+ $('.videocontrol').click(function(e) {
+ e.preventDefault(); //prevent href from actually loading
+ var href = $(this).attr('href');
+ location.hash = href;
+ play(href);
+ });
+})
+
+var videosJSON = {"videos":[
+ {"id": "39743315", "ref": "marketplace"},
+ {"id": "39606090", "ref": "installation"},
+ {"id": "39607154", "ref": "jee6arquillian"},
+ {"id": "39607711", "ref": "richfaces"},
+ {"id": "39608223", "ref": "forge"},
+ {"id": "39743919", "ref": "gwt"},
+ {"id": "39608294", "ref": "hibreveng"},
+ {"id": "39608326", "ref": "forgereveng"}
+ ]};
+
+function play(videoRef) {
+ var videoId = null;
+ for(var i = 0; i < videosJSON.videos.length; i++) {
+ if(videosJSON.videos[i].ref==videoRef) {
+ videoId = videosJSON.videos[i].id;
+ break;
+ }
+ }
+ if(videoId != null) {
+ var videoURL = "http://player.vimeo.com/video/" + videoId +
"?portrait=0";
+ $('#player').load(videoURL, function() {
+ $('iframe').attr('src', videoURL);
+ });
+ }
+ return;
+}
\ No newline at end of file
Show replies by date