ccd0
11 years ago
9 changed files with 98 additions and 55 deletions
@ -1,14 +0,0 @@ |
|||
// Scripts obtain settings by calling this function
|
|||
function setting(name) { |
|||
return JSON.parse(localStorage[name]); |
|||
} |
|||
|
|||
// Default settings
|
|||
function setDefault(name, value) { |
|||
if (!(name in localStorage)) { |
|||
localStorage[name] = JSON.stringify(value); |
|||
} |
|||
} |
|||
setDefault("videoexpand", true); |
|||
setDefault("videohover", false); |
|||
setDefault("videomuted", false); |
@ -1,5 +1,25 @@ |
|||
if (window.addEventListener) window.addEventListener("load", function(e) { |
|||
document.getElementById("playerheader").appendChild(settingsMenu); |
|||
|
|||
var video = document.getElementsByTagName("video")[0]; |
|||
|
|||
var loopLinks = [document.getElementById("loop0"), document.getElementById("loop1")]; |
|||
function setupLoopLink(i) { |
|||
loopLinks[i].addEventListener("click", function(e) { |
|||
video.loop = (i != 0); |
|||
if (i == 1 && video.currentTime >= video.duration) { |
|||
video.currentTime = 0; |
|||
} |
|||
video.play(); |
|||
loopLinks[i].style.fontWeight = "bold"; |
|||
loopLinks[1-i].style.fontWeight = "inherit"; |
|||
e.preventDefault(); |
|||
}, false); |
|||
} |
|||
for (var i = 0; i < 2; i++) { |
|||
setupLoopLink(i); |
|||
} |
|||
|
|||
video.muted = setting("videomuted"); |
|||
video.play(); |
|||
}, false); |
|||
|
Loading…
Reference in new issue