treat controls as links when clicked with modifier keys

This commit is contained in:
ccd0 2013-11-10 21:34:03 -08:00
parent 9c335764c4
commit 5fbd7a6a95

View File

@ -6,13 +6,15 @@ if (window.addEventListener) window.addEventListener("load", function(e) {
var loopLinks = [document.getElementById("loop0"), document.getElementById("loop1")]; var loopLinks = [document.getElementById("loop0"), document.getElementById("loop1")];
function setupLoopLink(i) { function setupLoopLink(i) {
loopLinks[i].addEventListener("click", function(e) { loopLinks[i].addEventListener("click", function(e) {
video.loop = (i != 0); if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
if (i != 0 && video.currentTime >= video.duration) { video.loop = (i != 0);
video.currentTime = 0; if (i != 0 && video.currentTime >= video.duration) {
video.currentTime = 0;
}
loopLinks[i].style.fontWeight = "bold";
loopLinks[1-i].style.fontWeight = "inherit";
e.preventDefault();
} }
loopLinks[i].style.fontWeight = "bold";
loopLinks[1-i].style.fontWeight = "inherit";
e.preventDefault();
}, false); }, false);
} }
for (var i = 0; i < 2; i++) { for (var i = 0; i < 2; i++) {