Reset video width with 'W'

This commit is contained in:
Brian Buller 2022-02-23 09:31:06 -06:00
parent 1aa2b7f9ab
commit 7e045e8759

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Video Zen // @name Video Zen
// @namespace http://bullercodeworks.com // @namespace http://bullercodeworks.com
// @version 0.2 // @version 0.3
// @description Watch video in 'zen' mode // @description Watch video in 'zen' mode
// @author brian@bullercodeworks.com // @author brian@bullercodeworks.com
// @match http*://*/* // @match http*://*/*
@ -77,7 +77,6 @@
} }
function canZen() { function canZen() {
var v = document.getElementsByTagName('video')[0]; var v = document.getElementsByTagName('video')[0];
console.log(v);
return v != null; return v != null;
} }
function doPressEscape() { function doPressEscape() {
@ -97,6 +96,12 @@
console.log("Zen mode cannot be activated."); console.log("Zen mode cannot be activated.");
} }
} }
function doSetWidthTo100() {
if(zenExists()) {
var v = document.getElementsByTagName('video')[0];
v.style.width = '100%';
}
}
document.addEventListener('keyup',(e)=>{ document.addEventListener('keyup',(e)=>{
console.log("Event Caught"); console.log("Event Caught");
@ -104,6 +109,9 @@
case 'Escape': case 'Escape':
doPressEscape(); doPressEscape();
break; break;
case 'KeyW':
doSetWidthTo100();
break;
} }
}); });
})(); })();