Skip to content

Commit

Permalink
Use by default the supplied JS files.
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Jan 30, 2012
1 parent c0a2d0e commit 986bfa8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
13 changes: 5 additions & 8 deletions index.html
Expand Up @@ -22,6 +22,7 @@
<link rel="stylesheet" href="css/default.css" type="text/css" media="screen" />
<!-- Google Web Fonts -->
<link href='http://fonts.googleapis.com/css?family=Iceland' rel='stylesheet' type='text/css'>

</head>
<body>
<div class="container-fluid">
Expand Down Expand Up @@ -114,13 +115,9 @@ <h2>Meanwhile you can check the <a href="logs/">logs</a></h2>
</div>
<a id="exit" href="javascript:onclick = stopTutorial();" class="btn">Exit video tutorial</a>
</div>
<script type="text/javascript" src="https://raw.github.com/citizen-cyberscience-centre/t4t-webapp/master/js/tutorial.js"></script>
<script type="text/javascript" src="https://raw.github.com/citizen-cyberscience-centre/t4t-webapp/master/js/test4theory.js"></script>
<script> if (typeof getBoincData == 'undefined') {
console.log('Raw Github failed, falling back to local copy');
document.write('<script type="text/javascript" src="js/tutorial.js"><\/script>');
document.write('<script type="text/javascript" src="js/test4theory.js"><\/script>');
}
</script>

<!-- Test4theory JS -->
<script type="text/javascript" src="js/tutorial.js"></script>
<script type="text/javascript" src="js/test4theory.js"></script>
</body>
</html>
25 changes: 5 additions & 20 deletions js/tutorial.js
Expand Up @@ -17,6 +17,9 @@

var pop = Popcorn("#video");

// Enable preload
pop.preload("auto");

function addPopOvers() {
$("#info").popover({
html: true,
Expand All @@ -41,22 +44,6 @@ function addPopOvers() {
});
}

var loaded = function() {
// store the returned timeRanges object as we use it more than once
var buff = pop.buffered();

// if we have buffered more then half the video
if ( buff.length > 0 && buff.end(0) > ( pop.duration() / 2 ) ) {
pop.controls( true );
pop.play();
console.log( "LOADED" );
// if less then half the video has loaded call our function again
} else {
console.log( "Still Loading...." );
setTimeout( loaded, 10 );
}
}

function stopTutorial(){
$("#left-sidebar").animate({opacity:1},100);
$("#main-content").animate({opacity:1},100);
Expand All @@ -74,9 +61,6 @@ function stopTutorial(){
pop.pause();
}




function startTutorial() {
$("#left-sidebar").animate({opacity:0},1);
$("#main-content").animate({opacity:0},1);
Expand Down Expand Up @@ -214,7 +198,8 @@ function startTutorial() {
});


loaded();
pop.controls(true);
pop.play();

$().popover({trigger: 'hover'});

Expand Down

0 comments on commit 986bfa8

Please sign in to comment.