diff options
| author | MaZderMind | 2014-11-09 19:43:33 +0100 | 
|---|---|---|
| committer | MaZderMind | 2014-11-09 19:43:33 +0100 | 
| commit | ed7b993d02eb1210e75eb04d88bdc04634b0891b (patch) | |
| tree | 94f371271073e3fb92449533fd755d4ce41c2723 /assets/js | |
| parent | b13164aa412fbb36ad8ad771da026c84bf97f37b (diff) | |
slide stream (basic form)
Diffstat (limited to '')
| -rw-r--r-- | assets/js/lustiges-script.js | 32 | 
1 files changed, 30 insertions, 2 deletions
| diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index 670c2de..d1608f8 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -1,5 +1,5 @@ +// mediaelement-player  $(function() { -  	$('video').mediaelementplayer({  		mode: 'auto_plugin',  		usePluginFullScreen: true, @@ -9,7 +9,11 @@ $(function() {  		features: ['playpause', 'volume','fullscreen']  	});  	$('audio').mediaelementplayer(); +}); + +// tabs +$(function() {  	// activate tab via hash and default to video  	function setTabToHash() {  		var activeTab = $('.nav-tabs a[href=' + window.location.hash + ']').tab('show'); @@ -22,8 +26,11 @@ $(function() {  	// adjust tabs when hash changes  	$(window).on('hashchange', setTabToHash).trigger('hashchange'); +}); + -	// click-to-irc +// click-to-irc +$(function() {  	$('.click-to-irc').on('click', function(e) {  		if($(this).hasClass('activating'))  			return; @@ -133,3 +140,24 @@ $(function() {  		interval(true);  	});  }); + +// slide-stream +$(function() { +	var +		updateTimer = 5000, /* reload slide image 2 seconds after the previous image was loaded */ +		$template = $('img.slide.template').clone().detach(); + +	function updateSlideImage() {console.log('updateSlideImage'); +		// no way around breaking the cache hard in FF +		// -> https://bugzilla.mozilla.org/show_bug.cgi?id=295942 +		$template +			.clone() +			.on('load', function() { +				$(this).replaceAll($('img.slide')); +				setTimeout(updateSlideImage, updateTimer); +			}) +			.attr('src', $template.data('src')+'?'+Date.now()); +	} + +	updateSlideImage(); +}); | 
