Skip to content

Instantly share code, notes, and snippets.

@mandrasch
Created September 29, 2015 15:21
Show Gist options
  • Select an option

  • Save mandrasch/77c2c38dcf664de430b3 to your computer and use it in GitHub Desktop.

Select an option

Save mandrasch/77c2c38dcf664de430b3 to your computer and use it in GitHub Desktop.
Twine2 Sugarcube2 Skip video in passage
<!-- video must be initialized in storyinit before, see: https://gist.github.com/programmieraffe/b0ae841d1961e038d87a -->
<a id="skip-video">Skip intro video</a><span id="next-step" style="display:none;">[[2025|Prelude]]</span><<html5playvideo "wasteland" 53>>
<<script>>
$( document ).ready(function() {
$("#story").hide().delay(3000).fadeIn(1500);
/* thank to http://stackoverflow.com/a/2880950/809939 */
document.getElementById('wasteland').addEventListener('ended',myHandler,false);
function myHandler(e) {
if(!e) {
e = window.event;
}
$("#skip-video").hide();
$("#next-step").show();
$("#story").fadeIn(1500);
}
$( document ).on( "click", "#passage-introvideo > a#skip-video",function(){
$("#story").hide();
console.log('skip click');
$(this).hide();
var video = document.getElementById('wasteland');
video.pause();
video.currentTime = 93;
video.play();
/*$("#next-step").fadeIn(1500);*/
}); /* eo skip video */
}); /* eo ready */
<</script>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment