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 = '