diff --git a/media/ignite/resources/js/global_popcorn_events_webrtc.js b/media/ignite/resources/js/global_popcorn_events_webrtc.js index 9547742..fd61ca7 100644 --- a/media/ignite/resources/js/global_popcorn_events_webrtc.js +++ b/media/ignite/resources/js/global_popcorn_events_webrtc.js @@ -175,7 +175,7 @@ ignite.link_node_manager.content[0] = { end: function (){ if(!this.displayed){ return;} this.displayed = false; - var credits_button = document.getElementById("credits_link"); + var credits_button = document.getElementById("demo_link"); credits_button.style.opacity = "0"; if(this.timeout_id){ clearTimeout(this.timeout_id); diff --git a/media/ignite/resources/js/global_popcorn_events_websockets.js b/media/ignite/resources/js/global_popcorn_events_websockets.js new file mode 100644 index 0000000..79e6684 --- /dev/null +++ b/media/ignite/resources/js/global_popcorn_events_websockets.js @@ -0,0 +1,261 @@ +ignite.link_node_manager.content[0] = { + notes: "This is the global group of non-link_node objects.", + content: [ + {notes: "The Ignite logo", time_in: 1, time_out: 3, + start: function (){ + var logo1 = document.getElementById("logo1"); + logo1.className = "centered_logo"; + logo1.style.display = "block"; + logo1.style.opacity = "0" + logo1.transition = "left 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo1.MozTransition = "left 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo1.WebkitTransition = "left 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo1.OTransition = "left 2s, top 1s, opacity 1s, height 1s, width 1s"; + setTimeout(function (){ + logo1.style.opacity = "1"; + }, 100); + if(!this.setup){ + this.setup = true; + ignite.popcorn.cue(this.time_in+1, function (){ + logo1.className = "positioned_logo"; + }) + } + }, + end: function (){ + var logo1 = document.getElementById("logo1"); + logo1.transition = " "; + logo1.MozTransition = " "; + logo1.WebkitTransition = " "; + logo1.OTransition = " "; + logo1.style.display = "block"; + logo1.style.opacity = "1"; + logo1.className = "positioned_logo"; + }, + check: function (time_code){ + var logo1 = document.getElementById("logo1"); + if(time_code < this.time_in){ + logo1.className = "centered_logo"; + logo1.style.display = "none"; + logo1.style.opacity = "0"; + } else if(time_code > this.time_out){ + this.end(); + } + } + }, + {notes: "The WebSockets logo", time_in: 3, time_out: 4, + start: function (){ + var logo2 = document.getElementById("logo2"); + logo2.className = "centered_logo"; + logo2.style.display = "block"; + logo2.transition = "right 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo2.MozTransition = "right 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo2.WebkitTransition = "right 2s, top 1s, opacity 1s, height 1s, width 1s"; + logo2.OTransition = "right 2s, top 1s, opacity 1s, height 1s, width 1s"; + setTimeout(function (){ + logo2.style.opacity = "1"; + }, 100); + if(!this.setup){ + this.setup = true; + ignite.popcorn.cue(this.time_in+1, function (){ + logo2.className = "positioned_logo"; + }) + } + }, + end: function (){ + var logo2 = document.getElementById("logo2"); + logo2.transition = " "; + logo2.MozTransition = " "; + logo2.WebkitTransition = " "; + logo2.OTransition = " "; + logo2.style.display = "block"; + logo2.style.opacity = "1"; + logo2.className = "positioned_logo"; + }, + check: function (time_code){ + var logo2 = document.getElementById("logo2"); + if(time_code < this.time_in){ + logo2.className = "centered_logo"; + logo2.style.display = "none"; + logo2.style.opacity = "0"; + } else if(time_code > this.time_out){ + this.end(); + } + } + }, + {notes: "Walkthrough", time_in: 5, time_out: 10, + displayed: undefined, // Needed for unexpected behavior in Chrome. + start: function (){ + if(this.displayed){ return;} + this.displayed = true; + var walkthrough_button = document.getElementById("walkthrough_link"); + walkthrough_button.style.display = "block"; + if(!this.setup){ + this.setup = true; + var passed_event = this; + walkthrough_button.addEventListener("click", function (){ + ignite.start_walkthrough(); + passed_event.end(); + }); + } + /* The following setTimeout call is necessary to prevent + * block and opacity from being set simultaneously, which would + * result in a spontaneous appearance instead of a fade-in. + */ + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.opacity = "1"; + } + })(walkthrough_button), 1000); + }, + end: function (){ + if(!this.displayed){ return;} + this.displayed = false; + var walkthrough_button = document.getElementById("walkthrough_link"); + walkthrough_button.style.opacity = "0"; + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.display = "none"; + } + })(walkthrough_button), 1000); + }, + check: function (time_code){ + if(time_code > this.time_in && time_code < this.time_out){ + this.start(); + } else{ + this.end(); + } + } + }, + {notes: "Add Arrows", time_in: 10, time_out: 11, + started: undefined, // Needed for unexpected behavior in Chrome. + start: function (){ + if(this.started){ return;} + this.started = true; + setTimeout(function (){ + ignite.arrow_left.style.opacity = "1"; + ignite.arrow_right.style.opacity = "0"; + }, 100); + }, + end: function (){}, + check: function (time_code){ + if(time_code >= this.time_in){ + this.start(); + } + } + }, + {notes: "Excercise", time_in: 523, time_out: 600, + displayed: undefined, // Needed for unexpected behavior in Chrome. + start: function (){ + if(this.displayed){ return;} + this.displayed = true; + var demo_button = document.getElementById("demo_link"); + demo_button.style.display = "block"; + if(!this.setup){ + this.setup = true; + } + /* The following setTimeout call is necessary to prevent + * block and opacity from being set simultaneously, which would + * result in a spontaneous appearance instead of a fade-in. + */ + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.opacity = "1"; + } + })(demo_button), 1000); + }, + end: function (){ + if(!this.displayed){ return;} + this.displayed = false; + var credits_button = document.getElementById("demo_link"); + credits_button.style.opacity = "0"; + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.display = "none"; + } + })(credits_button), 1000); + }, + check: function (time_code){ + if(time_code > this.time_in && time_code < this.time_out){ + this.start(); + } else{ + this.end(); + } + } + }, + {notes: "Credits", time_in: 528, time_out: 600, + displayed: undefined, // Needed for unexpected behavior in Chrome. + start: function (){ + if(this.displayed){ return;} + this.displayed = true; + var credits_button = document.getElementById("credits_link"); + credits_button.style.display = "block"; + if(!this.setup){ + this.setup = true; + var passed_event = this; + credits_button.addEventListener("click", function (){ + ignite.transition("right", true); + passed_event.end(); + }); + } + /* The following setTimeout call is necessary to prevent + * block and opacity from being set simultaneously, which would + * result in a spontaneous appearance instead of a fade-in. + */ + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.opacity = "1"; + } + })(credits_button), 1000); + }, + end: function (){ + if(!this.displayed){ return;} + this.displayed = false; + var credits_button = document.getElementById("credits_link"); + credits_button.style.opacity = "0"; + if(this.timeout_id){ + clearTimeout(this.timeout_id); + } + this.timeout_id = setTimeout((function (passed_button){ + return function (){ + passed_button.style.display = "none"; + } + })(credits_button), 1000); + }, + check: function (time_code){ + if(time_code > this.time_in && time_code < this.time_out){ + this.start(); + } else{ + this.end(); + } + } + } + ] +}; + + + + + + + + + + + + + diff --git a/media/ignite/resources/js/ignite_ll_websockets_resources.js b/media/ignite/resources/js/ignite_ll_websockets_resources.js new file mode 100644 index 0000000..a9bde52 --- /dev/null +++ b/media/ignite/resources/js/ignite_ll_websockets_resources.js @@ -0,0 +1,135 @@ +// This is the list of "link nodes" appearing in the video. +ignite.link_node_manager.content = [ + null, // First element is empty. This will be filled in by another file. + /* Content is arranged in groups. Each group has a begin and end time. + * Within each group, each node has a begin time. + * Nodes with a set position will appear outside the node list. + */ + {time_in: 11, time_out: 31, content: [ + {resource_id: "websockets", time_in: 12}, + {resource_id: "assorted.duplex", time_in: 17}, + {resource_id: "contributors.rob_hawkes", time_in: 23} + ]}, + {time_in: 48, time_out: 55, content: [ + {resource_id: "assorted.ajax", time_in: 49} + ]}, + {time_in: 55, time_out: 66, content: [ + {resource_id: "contributors.peter_lubbers", time_in: 56}, + {resource_id: "assorted.kaazing", time_in: 58} + ]}, + {time_in: 68, time_out: 76, content:[ + {resource_id: "websockets.websocket_org.about", time_in: 68} + ]}, + {time_in: 168, time_out: 177, content: [ + {resource_id: "websockets.dzone_article", time_in: 168} + ]}, + {time_in: 191, time_out: 202, content: [ + {resource_id: "assorted.nodejs", time_in: 192}, + {resource_id: "websockets.tutorials.socketio", time_in: 194} + ]}, + {time_in: 214, time_out: 267, content: [ + {resource_id: "contributors.tom_croucher", time_in: 215}, + {resource_id: "assorted.cloud9ide", time_in: 237}, + {resource_id: "assorted.change", time_in: 251}, + {resource_id: "assorted.etherpad", time_in: 261} + ]}, + {time_in: 268, time_out: 279, content: [ + {resource_id: "contributors.ondrej_zara", time_in: 269}, + {resource_id: "assorted.dev_derby", time_in: 272} + ]}, + {time_in: 324, time_out: 332, content: [ + {resource_id: "contributors.rob_hawkes.rawkets", time_in: 325} + ]}, + {time_in: 424, time_out: 466, content: [ + {resource_id: "assorted.kaazing_financial", time_in: 427}, + {resource_id: "websockets.games.buildnewgames", time_in: 431}, + {resource_id: "assorted.kaazing_betting", time_in: 445}, + {resource_id: "assorted.sentiment_tracking", time_in: 455}, + {resource_id: "assorted.inventory_tracking", time_in: 458} + ]}, + {time_in: 493, time_out: 508, content: [ + {resource_id: "assorted.pointclouds", time_in: 494}, + {resource_id: "assorted.teamup", time_in: 500} + ]} +]; +// This is the expandable list in the resource section. +ignite.resources.content = [ + {id: "mozilla_ignite", title: 'Mozilla Ignite', content: [ + {id: "official", title: 'Official', content: [ + {id: "official_site", title: 'Official Site', content: 'http://www.mozillaignite.org'}, + {id: "twitter", title: 'Twitter', content: 'http://twitter.com/MozillaIgnite'}, + {id: "us_ignite", title: 'US Ignite', content: 'http://us-ignite.org/'}, + {id: "nsf_gov", title: 'NSF.gov', content: 'http://www.nsf.gov/'} + ]}, + {id: "press", title: 'Press', content: [ + {id: "white_house", title: 'White House', content: 'http://www.whitehouse.gov/the-press-office/2012/06/13/we-can-t-wait-president-obama-signs-executive-order-make-broadband-const'}, + {id: "launch_day_video", title: 'Launch Day Video', content: 'http://www.youtube.com/watch?v=H-t26owiZUQ'}, + {id: "mark_surman", title: 'Mark Surman', content: 'http://www.nsf.gov/news/news_videos.jsp?cntn_id=124472&media_id=72664&org=NSF'} + ]}, + {id: "geni", title: 'GENI', content: [ + {id: "geni_site", title: 'Official Site', content: 'http://www.geni.net/'}, + {id: "geni_wikipedia", title: 'Wikipedia', content: 'http://en.wikipedia.org/wiki/Global_Environment_for_Network_Innovations'}, + {id: "kenny_1", title: 'Kenny on GENI, 1', content: 'http://www.screenr.com/2KL8'}, + {id: "kenny_2", title: 'Kenny on GENI, 2', content: 'http://www.screenr.com/FIz8'} + ]} + ]}, + {id: "websockets", title: 'Websockets', content: [ + {id: "tutorials", title: "Learn Websocket", content: [ + {id: "mdn_websockets", title: "MDN Websockets", content: "https://developer.mozilla.org/en-US/docs/WebSockets"}, + {id: "socketio", title: "Socket IO", content: "http://socket.io/"} + ]}, + {id: "websocket_org", title: "Websocket.org", content: [ + {id: "website", title: "Main Page", content: "http://www.websocket.org/"}, + {id: "demos", title: "Demos", content: "http://www.websocket.org/demos.html"}, + {id: "about", title: "About Websocket", content: "http://www.websocket.org/aboutwebsocket.html"} + ]}, + {id: "dzone_article", title: "DZone Article", content: "http://refcardz.dzone.com/refcardz/html5-websocket"}, + {id: "games", title: "Games", content: [ + {id: "game_on", title: "Game On", content: "https://gameon.mozilla.org/en-US/"}, + {id: "buildnewgames", title: "Build New Games", content: "http://buildnewgames.com/websockets/"} + ]} + ]}, + {id: "contributors", title: "Contributors", content:[ + {id: "rob_hawkes", title: "Rob Hawkes", content: [ + {id: "website", title: "Rob's Blog", content: "http://rawkes.com/"}, + {id: "rawkets", title: "Rawkets", content: "http://rawkets.com/"}, + {id: "twitter", title: "Twitter", content: "https://twitter.com/robhawkes"}, + {id: "github", title: "Github", content: "https://github.com/robhawkes"}, + {id: "interview", title: "Marakana TechTV", content: "http://www.youtube.com/watch?v=KxylQ3W2iqE"} + ]}, + {id: "peter_lubbers", title: "Peter Lubbers", content: [ + {id: "website", title: "Peter's Twitter", content: "https://twitter.com/peterlubbers"}, + {id: "interview", title: "Marakana TechTV", content: "http://www.youtube.com/watch?v=g2qYAd1vUdc"}, + {id: "articles", title: "Articles", content: "http://peterlubbers.sys-con.com/"}, + {id: "user_group", title: "SFHTML5.org", content: "http://www.sfhtml5.org/"}, + {id: "pro_html5", title: "ProHTML5.org", content: "http://www.prohtml5.com/"} + ]}, + {id: "tom_croucher", title: "Tom H-C", content: [ + {id: "website", title: "Website", content: "http://tomhughescroucher.com/"}, + {id: "twitter", title: "Twitter", content: "https://twitter.com/sh1mmer"}, + {id: "github", title: "Github", content: "https://github.com/sh1mmer"} + ]}, + {id: "ondrej_zara", title: "Ondrej Žára", content: [ // League Gothic does not display a useable character at ř + {id: "website", title: "Website", content: "http://ondras.zarovi.cz/"}, + {id: "twitter", title: "Twitter", content: "https://twitter.com/0ndras/"}, + {id: "github", title: "Github", content: "https://github.com/ondras/"}, + {id: "interview", title: "Interview", content: "https://hacks.mozilla.org/2012/08/interview-ondrej-zara-websockets-dev-derby-winner/"} + ]} + ]}, + {id: "assorted", display: "none", content: [ + {id: "duplex", title: "Full Duplex", content: "http://en.wikipedia.org/wiki/Duplex_%28telecommunications%29"}, + {id: "ajax", title: "AJAX", content: "https://developer.mozilla.org/en-US/docs/AJAX"}, + {id: "teamup", title: "TeamUp", content: "http://www.getteamup.com"}, + {id: "kaazing", title: "Kaazing", content: "http://kaazing.com/"}, + {id: "kaazing_financial", title: "Financial", content: "http://kaazing.com/solutions/financials"}, + {id: "kaazing_betting", title: "Betting", content: "http://kaazing.com/content/customer-case-studies"}, + {id: "sentiment_tracking", title: "Sentiment Tracking", content: "http://en.wikipedia.org/wiki/Sentiment_analysis"}, + {id: "inventory_tracking", title: "Inventory Tracking", content: "http://en.wikipedia.org/wiki/Radio-frequency_identification"}, + {id: "change", title: "Change.org", content: "http://www.change.org"}, + {id: "etherpad", title: "Etherpad", content: "http://etherpad.org/"}, + {id: "cloud9ide", title: "Cloud9 IDE", content: "https://c9.io/"}, + {id: "pointclouds", title: "Point Clouds", content: "http://en.wikipedia.org/wiki/Point_cloud"}, + {id: "nodejs", title: "Node.js", content: "http://nodejs.org"}, + {id: "dev_derby", title: "Dev Derby", content: "https://developer.mozilla.org/en-US/demos/devderby/2012/may"} + ]} +]; \ No newline at end of file diff --git a/media/ignite/resources/js/webrtc_main.js b/media/ignite/resources/js/webrtc_main.js index 131d356..77dd957 100644 --- a/media/ignite/resources/js/webrtc_main.js +++ b/media/ignite/resources/js/webrtc_main.js @@ -354,7 +354,7 @@ ignite = { }, 2666); setTimeout(/* walkthrough.cue(3, */function (){ - var test_resource = {resource_id: "demos"}; + var test_resource = {resource_id: "contributors"}; var test_node = ignite.link_node_manager.create_node(test_resource); ignite.link_node_manager.add_node(test_node); }, 4000); diff --git a/media/ignite/resources/js/websockets_main.js b/media/ignite/resources/js/websockets_main.js new file mode 100644 index 0000000..30e865e --- /dev/null +++ b/media/ignite/resources/js/websockets_main.js @@ -0,0 +1,803 @@ +/* + * This code written in whole by Jacob A Brennan. + * + * This work is licensed under the Creative Commons Attribution 3.0 Unported + * License. To view a copy of this license, visit + * http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative + * Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. + */ +ignite = { + // Define compatibility flags. This may be expanded in the future. + compatibility: { + EVENT: 1, + DOM: 2, + HTML5: 4, + CONTROLS: 8, + CSS_TRANSITION: 16, + status: 0, // Not undefined, so that bitwise operations will work. + check: function (dom_content_event){ + // First check if the event DOMContentLoaded can be listened for and will be fired. + if(dom_content_event){ + // Test for the ability to listen for events. + if(document.addEventListener){ + this.status |= this.EVENT; + } + } else{ + // Test for HTML5 video support by testing for the existence of the main video. + // Note: Assumes document.getElementById. Support charts show support back to IE6. + if(document.getElementById("lab_video") || document.getElementById("walkthrough_audio")){ + this.status |= this.HTML5; + } + // Test for progress bar click support, which requires clientWidth. + // Note: event.clientX is not tested here, but support charts show near universal compatibility. + var progress_bar = document.getElementById("control_progress") + if((progress_bar.clientWidth !== undefined) && (progress_bar.offsetLeft !== undefined) && progress_bar.offsetParent){ + this.status |= this.CONTROLS; + } + // Test for DOM manipulation. + if(document.createElement && document.appendChild){ + var test_element = document.createElement("div"); + var test_contents = document.createElement("span"); + test_contents.innerHTML = "textContent check"; + test_element.appendChild(test_contents) + if(test_element.setAttribute || test_element.innerHTML){ + this.status |= this.DOM; + } + // textContent is used by the svg DOM in the custom controls. + if(!test_contents.textContent){ + this.status &= ~this.CONTROLS; + } + var test_style = test_element.style; + if( "transition" in test_style || + "MozTransition" in test_style || + "WebkitTransition" in test_style || + "OTransition" in test_style){ + this.status |= this.CSS_TRANSITION; + } + } + /* Remaining Tests: + * mp4 || webm || theora.ogv + * inline SVG + * Embedded fonts + */ + } + return this.status; + }, + notify: function (){ + /* Function must be delayed to allow for page loading, + * particularly the support_message div. + */ + setTimeout(function (){ + document.getElementById("support_message").style.display = "block"; + if(!(ignite.compatibility.status & (ignite.compatibility.EVENT | ignite.compatibility.DOM | ignite.compatibility.HTML5))){ + document.getElementById("support_none").style.display = "block"; + } else if(!(ignite.compatibility.status & ignite.compatibility.CSS_TRANSITION && ignite.compatibility.status & ignite.compatibility.CONTROLS)){ + document.getElementById("support_limited").style.display = "block"; + document.getElementById("support_button").addEventListener("click", function (){ + document.getElementById("support_message").style.display = "none"; + }, false); + } + }, 1000); + } + }, + setup: function (){ + this.seeking = false; + this.popcorn = Popcorn("#lab_video"); + window.addEventListener("resize", function (){ ignite.resize()}, false); + window.addEventListener("keydown", function (e){ ignite.key_down(e);}, false); + // Configure html urls: + var logo_background = document.getElementById("logo_background"); + logo_background.src = ignite.url.resource_background; + var logo1 = document.getElementById("logo1"); + logo1.src = ignite.url.logo1; + var logo2 = document.getElementById("logo2"); + logo2.src = ignite.url.logo2; + var demo_link = document.getElementById("demo_link"); + demo_link.href = ignite.url.hackable_demo; + // Configure Custom Controls: + var controls = document.getElementById("controls"); + if(this.compatibility.status & this.compatibility.CONTROLS){ + // Capture standard play events. + this.popcorn.media.addEventListener("click", function (){ + if(ignite.walkthrough_in_progress){ return;} + if(ignite.popcorn.paused()){ + ignite.popcorn.play() + } else{ + ignite.popcorn.pause(); + } + }, false); + // Big Play Button + document.getElementById("control_big_play").addEventListener("click", function (){ + if(ignite.walkthrough_in_progress){ return;} + ignite.popcorn.play(); + }, false) + // Play/Pause Button + var play_button = document.getElementById("control_play") + play_button.addEventListener("click", function (){ + if(ignite.walkthrough_in_progress){ return;} + if(ignite.popcorn.currentTime() == ignite.popcorn.duration()){ + ignite.popcorn.currentTime(0); + ignite.popcorn.play(); + return; + } + if(ignite.popcorn.paused()){ ignite.popcorn.play();} + else{ ignite.popcorn.pause();} + }, false); + this.popcorn.on("playing", function (){ + document.getElementById("control_big_play").style.opacity = "0"; + setTimeout(function (){ + document.getElementById("control_big_play").style.display = "none"; + }, 1000) + play_button.getElementById("play" ).style.opacity = "0"; + play_button.getElementById("pause").style.opacity = "1"; + }); + this.popcorn.on("pause", function (){ + var play_button = document.getElementById("control_play") + play_button.getElementById("play" ).style.opacity = "1"; + play_button.getElementById("pause").style.opacity = "0"; + }); + this.popcorn.on("ended", function (){ + var play_button = document.getElementById("control_play") + play_button.getElementById("play" ).style.opacity = "1"; + play_button.getElementById("pause").style.opacity = "0"; + }); + // Progress Bar and Timer + var progress_bar = document.getElementById("control_progress"); + var buffered_bar = document.getElementById("control_buffered_time"); + var elapsed_bar = document.getElementById("control_elapsed_time"); + var timer = document.getElementById("control_timer"); + progress_bar.addEventListener("click", function (event){ + if(ignite.walkthrough_in_progress){ return;} + var duration = ignite.popcorn.duration(); + if(!duration){ return;} + var resized_width = progress_bar.clientWidth; + var actual_left = 0; + var offset_element = progress_bar; + while(offset_element){ + actual_left += offset_element.offsetLeft; + offset_element = offset_element.offsetParent; + } + var click_percent = (event.clientX-actual_left) / resized_width; + var seek_time = duration * click_percent; + elapsed_bar.style.width = ""+(click_percent*100)+"%"; + ignite.popcorn.currentTime(seek_time); + }); + this.popcorn.on("timeupdate", function (){ + var duration = ignite.popcorn.duration(); + if(!duration){ return;} + var current_time = ignite.popcorn.currentTime(); + var elapsed_percent = current_time / duration; + elapsed_bar.style.width = ""+(elapsed_percent*100)+"%"; + var extra_0 = ((current_time%60) < 10)? "0" : ""; + current_time = ""+Math.floor(current_time/60)+":"+extra_0+Math.floor(current_time%60); + var timer_text = timer.getElementById("svg_timer"); + if(ignite.current_duration){ + timer_text.textContent = ""+current_time+"/"+ignite.current_duration; + } else{ + timer_text.textContent = ""+current_time; + } + }); + this.popcorn.on("progress", function (){ + ignite.current_duration = ignite.popcorn.duration(); + if(!ignite.current_duration){ return;} + var buffered_range = ignite.popcorn.buffered(); + var buffer_end = buffered_range.end(0); + if(!buffer_end){ buffer_end = 0} + buffered_bar.style.width = ""+((buffer_end/ignite.current_duration)*100)+"%"; + var current_time = ignite.popcorn.currentTime() + var extra_0 = ((current_time%60) < 10)? "0" : ""; + current_time = ""+Math.floor(current_time/60)+":"+extra_0+Math.floor(current_time%60); + ignite.current_duration = ""+Math.floor(ignite.current_duration/60)+":"+Math.floor(ignite.current_duration%60); + var timer_text = timer.getElementById("svg_timer"); + if(ignite.current_duration){ + timer_text.textContent = ""+current_time+"/"+ignite.current_duration; + } else{ + timer_text.textContent = ""+current_time; + } + }); + // Volume: + var mute_button = document.getElementById("control_mute"); + mute_button.addEventListener("click", function (){ + if(ignite.popcorn.muted()){ + ignite.popcorn.unmute(); + mute_button.getElementById("sound" ).style.opacity = "1"; + } else{ + ignite.popcorn.muted(true); + mute_button.getElementById("sound" ).style.opacity = "0"; + } + }, false); + } else{ + this.popcorn.media.controls = "true"; + controls.style.display = "none"; + } + // Setup frame slider: + this.frame = document.getElementById("frame"); + this.slider = document.getElementById("slider"); + this.middle = document.getElementById("video_content"); + this.right = document.getElementById("credits" ); + this.left = document.getElementById("resources" ); + this.video_width = 1280; + this.video_height = 720; + this.slider_state = "middle"; + this.arrow_left = document.getElementById("arrow_left" ); + this.arrow_right = document.getElementById("arrow_right"); + this.arrow_left.addEventListener("click", function (){ + ignite.transition("left"); + }, false) + this.arrow_right.addEventListener("click", function (){ + ignite.transition("right"); + }, false) + this.resize(); + // Setup Resource Section: + var setup_node = function (node, tier){ + for(var I = 0; I < node.content.length; I++){ + var resource = node.content[I]; + resource.tier = tier+1; + if(resource.display == "none"){ + continue; + } + var container_li = document.createElement("li"); + /* A separate block container is needed to prevent our resources + * from having an ancestor positioned absolutely. Otherwise + * percentage sizing would be based on that ancestor instead of + * the frame. */ + node.list.appendChild(container_li) + var r_element + var logo_text; + if(typeof(resource.content) == "string"){ + r_element = document.createElement("a"); + resource.element = r_element; + r_element.setAttribute("id", "rsc_"+resource.title) + r_element.setAttribute("class", "resource tier"+(tier+1)); + r_element.setAttribute("href", resource.content); + r_element.setAttribute("target", "_blank"); + logo_text = ' link">'; + r_element.innerHTML = '
'+resource.title+'
'; + r_element.innerHTML = '
'+resource.title+'
= video_aspect_ratio){ + // Center Horizontally + modified_height = size.height; + modified_width = video_aspect_ratio * modified_height; + this.frame.style.top = "0px"; + this.frame.style.left = ""+Math.floor((size.width-modified_width)/2)+"px"; + } else{ + // Center Vertically + modified_width = size.width; + modified_height = modified_width / video_aspect_ratio; + this.frame.style.top = ""+Math.floor((size.height-modified_height)/2)+"px"; + this.frame.style.left = "0px"; + } + this.frame.style.width = modified_width +"px"; + this.frame.style.height = modified_height+"px"; + document.body.style.fontSize = Math.round(modified_height/20)+"px"; + this.left.style.fontSize = Math.round(modified_height/16)+"px"; + document.getElementById("walkthrough_link").style.fontSize = Math.round(modified_height/13)+"px"; + document.getElementById("credits_link").style.fontSize = Math.round(modified_height/13)+"px"; + document.getElementById("demo_link").style.fontSize = Math.round(modified_height/13)+"px"; + this.middle.style.top = "0px"; + this.left.style.top = "0px"; + this.right.style.top = "0px"; + this.slider.style.top = "0px"; + this.middle.style.left = ( modified_width )+"px"; + this.left.style.left = "0px"; + this.right.style.left = ( modified_width*2)+"px"; + switch(this.slider_state){ + case "middle":{ + this.slider.style.left = "-100%"; + break; + } + case "left":{ + this.slider.style.left = "0%"; + break; + } + case "right":{ + this.slider.style.left = "-200%" + break; + } + } + this.middle.style.width = modified_width+"px"; + this.left.style.width = modified_width+"px"; + this.right.style.width = modified_width+"px"; + this.slider.style.width = (modified_width*3)+"px"; + this.middle.style.height = modified_height+"px"; + this.left.style.height = modified_height+"px"; + this.right.style.height = modified_height+"px"; + this.slider.style.height = modified_height+"px"; + }, + transition: function (direction, force){ + this.slider.style.transition = "left 1s"; + this.slider.style.MozTransition = "left 1s"; + this.slider.style.WebkitTransition = "left 1s"; + this.slider.style.OTransition = "left 1s"; + switch(direction){ + case "left":{ + if(this.arrow_left.style.opacity != "1" && !force){ + return; + } + switch(this.slider_state){ + case "middle":{ + this.slider_state = "left"; + break; + } + case "right":{ + this.slider_state = "middle"; + break; + } + } + break; + } + case "right":{ + if((this.arrow_right.style.opacity != "1" && !force)){ + return; + } + switch(this.slider_state){ + case "middle":{ + this.slider_state = "right"; + break; + } + case "left":{ + this.slider_state = "middle"; + break; + } + } + break; + } + } + switch(this.slider_state){ + case "left":{ + ignite.link_node_manager.clear_nodes(); + this.slider.style.left = "0%"; + this.arrow_left.style.opacity = "0"; + this.arrow_right.style.opacity = "1"; + this.popcorn.pause() + break; + } + case "middle":{ + this.slider.style.left = "-100%"; + this.arrow_left.style.opacity = "1"; + this.arrow_right.style.opacity = "0"; + if(!this.walkthrough_in_progress){ + ignite.link_node_manager.setup_at(ignite.popcorn.currentTime()); + if(ignite.popcorn.currentTime() != ignite.popcorn.duration()){ + // Don't play if returning to video from credits or resources after video has ended. + this.popcorn.play(); + } + } + break; + } + case "right":{ + ignite.link_node_manager.clear_nodes(); + this.slider.style.left = "-200%"; + this.arrow_right.style.opacity = "0"; + this.popcorn.pause() + break; + } + } + }, + link_node_manager: { + current_nodes: new Array(), + add_node: function (node, custom){ + ignite.middle.appendChild(node); + if(custom){ + this.custom_node = node; + node.style.top = custom.top; + node.style.left = custom.left; + node.style.transition = "opacity 1s"; + node.style.MozTransition = "opacity 1s"; + node.style.WebkitTransition = "opacity 1s"; + node.style.OTransition = "opacity 1s"; + } else{ + var position; + for(var I = 0; I < this.current_nodes.length; I++){ + if(!this.current_nodes[I]){ + position = I; + break; + } + } + if(position === undefined){ + position = Math.min(this.current_nodes.length, 4) + } + if(this.current_nodes.length > position && this.current_nodes[position]){ + this.bump_node(this.current_nodes[position]); + } + this.current_nodes[position] = node; + var percent = 30 + position*8 + node.style.top = percent+"%"; + node.style.left = "7%"; + node.style.transition = "opacity 1s, left 2s, top 1s"; + node.style.MozTransition = "opacity 1s, left 2s, top 1s"; + node.style.WebkitTransition = "opacity 1s, left 2s, top 1s"; + node.style.OTransition = "opacity 1s, left 2s, top 1s"; + } + /* The following statement must be delayed from the other settings + * to ensure that the transition happens. + */ + setInterval(function (){node.style.opacity = "1";}, 100); + }, + bump_node: function (node){ + node.style.transition = "opacity 1s, left 2s, top 1s"; + node.style.MozTransition = "opacity 1s, left 2s, top 1s"; + node.style.WebkitTransition = "opacity 1s, left 2s, top 1s"; + node.style.OTransition = "opacity 1s, left 2s, top 1s"; + var place = this.current_nodes.indexOf(node); + this.current_nodes[place] = null; + place--; + if(place < 0){ + this.remove_node(node); + } else{ + node.style.top = 30+(8*place)+"%"; + var old_node = this.current_nodes[place]; + if(old_node){ + this.bump_node(old_node); + } + this.current_nodes[place] = node; + } + }, + create_node: function (node_json){ + var node = document.createElement("a"); + var resource = ignite.resources.get_resource_from_id(node_json.resource_id); + if(typeof(resource.content) == "string"){ + node.setAttribute("class", "link_node"); + node.setAttribute("href", resource.content) + node.setAttribute("target", "_blank"); + node.innerHTML = '
'+resource.title+'
'; + } else{ + node.setAttribute("class", "link_node link_node_group"); + node.innerHTML = '
'+resource.title+'
'; + node.addEventListener("click", function (){ + if(ignite.walkthrough_in_progress){ return;} + ignite.transition("left"); + setTimeout(function (){ + ignite.resources.navigate_id(node_json.resource_id); + }, 500); + }, false); + } + return node; + }, + remove_node: function (node){ + if(node == this.custom_node){ + node.style.opacity = "0"; + this.custom_node = undefined; + } else{ + node.style.left = "-100%"; + var position = this.current_nodes.indexOf(node); + if(position != -1){ + this.current_nodes[position] = undefined; + } + } + setTimeout(function (){ + ignite.middle.removeChild(node); + }, 1000); + }, + clear_nodes: function (){ + if(this.custom_node){ + this.remove_node(this.custom_node); + } + for(var I = 0; I < this.current_nodes.length; I++){ + var node = this.current_nodes[I]; + if(node){ + this.remove_node(node); + } + } + }, + setup_at: function (time_code){ + // Setup Global events: + var global_group = this.content[0]; + for(var event_index = 0; event_index < global_group.content.length; event_index++){ + var indexed_event = global_group.content[event_index]; + indexed_event.check(ignite.popcorn.currentTime()); + } + // Setup current link node group: + var display_group; + var display_nodes = new Array(); + for(var I = 1 ; I < this.content.length; I++){ + // This index starts at 1 so as to skip the global group at position 0. + var group = this.content[I]; + if(group.time_in <= time_code && group.time_out > time_code){ + display_group = group; + break; + } + } + if(!display_group){ return;} + for(var node_index = display_group.content.length-1; node_index >= 0; node_index--){ + var indexed_node = display_group.content[node_index]; + if(indexed_node.time_in > time_code){ + continue; + } + display_nodes.push(indexed_node); + if(display_nodes.length >= 5){ + break; + } + } + if(display_nodes.length <= 0){ return;} + for(var I = display_nodes.length-1; I >= 0; I--){ + var indexed_node = display_nodes[I]; + var new_node = this.create_node(indexed_node); + var custom; + if(indexed_node.position){ + custom = indexed_node.position; + } + this.add_node(new_node, custom) + } + } + } +}; +ignite.resources = { + highlight: function (resource){ + switch(resource.tier){ + case 1:{ + if(this.highlight_tier1){ + this.unhighlight(this.highlight_tier1); + } + this.highlight_tier1 = resource; + break; + } + case 2:{ + if(this.highlight_tier2){ + this.unhighlight(this.highlight_tier2); + } + this.highlight_tier2 = resource; + break; + } + } + resource.element.firstChild.style.background = "rgb(239, 72, 25)"; + for(var I = 0; I < resource.content.length; I++){ + var sub_rsc = resource.content[I]; + var old_left = sub_rsc.element.style.left; + var old_top = sub_rsc.element.style.top; + sub_rsc.element.style.left = (10+((resource.tier-1)*28))+"%"; + sub_rsc.element.style.top = resource.element.style.top; + sub_rsc.element.style.display = "block"; + sub_rsc.element.style.transition = "top 1s, left 0.5s"; + sub_rsc.element.style.MozTransition = "top 1s, left 0.5s"; + sub_rsc.element.style.WebkitTransition = "top 1s, left 0.5s"; + sub_rsc.element.style.OTransition = "top 1s, left 0.5s"; + var mover_func = (function (indexed_rsc, indexed_left, indexed_top){ + return function (){ + indexed_rsc.element.style.left = indexed_left; + indexed_rsc.element.style.top = indexed_top; + } + })(sub_rsc, old_left, old_top) + setTimeout(mover_func, 50); + } + }, + unhighlight: function (resource){ + if(resource.tier == 1){ + if(this.highlight_tier2){ + this.unhighlight(this.highlight_tier2); + } + } + this["highlight_tier"+resource.tier] = null; + resource.element.firstChild.style.background = null; + for(var I = 0; I < resource.content.length; I++){ + var sub_rsc = resource.content[I]; + sub_rsc.element.style.display = "none"; + sub_rsc.element.style.transition = ""; + sub_rsc.element.style.MozTransition = ""; + sub_rsc.element.style.WebkitTransition = ""; + sub_rsc.element.style.OTransition = ""; + } + }, + navigate_id: function (resource_id){ + var navigation_steps = resource_id.split("."); + var parent_resource = ignite.resources; + for(var nav_index = 0; nav_index < navigation_steps.length; nav_index++){ + var step_id = navigation_steps[nav_index]; + for(var res_index = 0; res_index < parent_resource.content.length; res_index++){ + var test_resource = parent_resource.content[res_index]; + if(test_resource.id == step_id){ + parent_resource = test_resource; + this.highlight(parent_resource); + break; + } + } + } + }, + get_resource_from_id: function (resource_id){ + var navigation_steps = resource_id.split("."); + var parent_resource = ignite.resources; + for(var nav_index = 0; nav_index < navigation_steps.length; nav_index++){ + var step_id = navigation_steps[nav_index]; + for(var res_index = 0; res_index < parent_resource.content.length; res_index++){ + var test_resource = parent_resource.content[res_index]; + if(test_resource.id == step_id){ + parent_resource = test_resource; + break; + } + } + } + return parent_resource; + } +}; +ignite.compatibility.check(true); +if((ignite.compatibility.status & ignite.compatibility.EVENT)){ + document.addEventListener("DOMContentLoaded", function (){ + ignite.compatibility.check(); + var full_featured = ( + ignite.compatibility.CONTROLS | + ignite.compatibility.CSS_TRANSITION | + ignite.compatibility.DOM | + ignite.compatibility.EVENT | + ignite.compatibility.HTML5); + if(ignite.compatibility.status != full_featured){ + ignite.compatibility.notify() + } + if(ignite.compatibility.status & (ignite.compatibility.DOM | ignite.compatibility.HTML5)){ + ignite.setup(); + } + }); +} else{ + ignite.compatibility.notify() +} \ No newline at end of file diff --git a/media/ignite/resources/js/websockets_urls.js b/media/ignite/resources/js/websockets_urls.js new file mode 100644 index 0000000..cb764ab --- /dev/null +++ b/media/ignite/resources/js/websockets_urls.js @@ -0,0 +1,8 @@ +ignite.url = { + node_linkbox: ignite_bundle.data.MEDIA_URL + "resources/svg/linkbox_padding.svg", + node_logo: ignite_bundle.data.MEDIA_URL + "resources/svg/ignite_embossed_logo.svg", + logo1: ignite_bundle.data.MEDIA_URL + "resources/svg/ignite_w_text.svg", + logo2: ignite_bundle.data.MEDIA_URL + "resources/svg/websockets_w_text.svg", + resource_background: ignite_bundle.data.MEDIA_URL + "resources/svg/ignite_embossed_logo.svg", + hackable_demo: "https://github.com/mozilla/mozilla-ignite-learning-lab-demos/tree/master/lab-4-websockets" +}; \ No newline at end of file diff --git a/media/ignite/resources/static/websockets.html b/media/ignite/resources/static/websockets.html new file mode 100644 index 0000000..851d60c --- /dev/null +++ b/media/ignite/resources/static/websockets.html @@ -0,0 +1,186 @@ + + + + + Mozilla Ignite Learning Lab - WebRTC + + + + + + + + + +
+
+ Your browser does not support HTML5. Please update your browser to view this video. +
+
+ Your browser is out of date. Please update your browser to access all features of this video. +
+ +
+
+
+
+
+ +
+ + + Big Play + + +
+ + Play / Pause + + + + + + + + + + + +
+
+
+
+ + Mute / Unmute + + + + + + + + + + + Timer + + +
+
+
+
Walkthrough
+ +
+ +
Hackable Demo
+
Credits
+
+
+ + decorative background +
    +
    +
    +
      +
    • Credits
    • +
    • +Open the Studio +Design and Development +
    • +
    • +Kenny Katzgrau +Interviews And Writing +
    • +
    • Special Thanks
    • +
    • +Rob Hawkes +Interview, Expert +
    • +
    • +Peter Lubbers +Interview, Google +
    • +
    • +Tom Hughes-Croucher +Interview, Change.org +
    • +
    • +Ondrej Žára +Interview, Seznam +
    • +
    +
    +
    + Mozilla Ignite Logo + WebRTC Learning Lab Logo + + + + + + + + +
    + + \ No newline at end of file diff --git a/media/ignite/resources/svg/websockets_w_text.svg b/media/ignite/resources/svg/websockets_w_text.svg new file mode 100644 index 0000000..87ab0e5 --- /dev/null +++ b/media/ignite/resources/svg/websockets_w_text.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + +