Created
April 17, 2022 21:37
-
-
Save chajath/7cb88a8874b86df3b6d030e87be33ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name NewNetflixZoom2 | |
// @namespace amazon.tld | |
// @version 0.1 | |
// @description try to take over the world! ??? Profit. | |
// @author Anonymouse | |
// @include https://www.netflix.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var newVersion = true; | |
var findVideoElement = function() { | |
return document.querySelectorAll('video')[0]; | |
}; | |
var zoomVideo = function(offset) { | |
var ele = findVideoElement(); | |
var newPercent; | |
if (ele.style.height.endsWith('px')) { | |
newPercent = 100; | |
} else { | |
newPercent = parseInt(ele.style.height) + offset; | |
} | |
if (isNaN(newPercent)) newPercent = 100; | |
console.log(newPercent); | |
if (newPercent < 100) newPercent=100; | |
ele.style.position = 'absolute'; | |
ele.style.height = newPercent + '%'; | |
ele.style.width = '100%'; | |
if (!newVersion) { | |
ele.style.top = (-((newPercent - 100) / 2)) + '%'; | |
} | |
console.log(ele.style.height); | |
}; | |
document.onkeydown = function(evt) { | |
if (evt.keyCode == 187) { // "=" zoomin | |
zoomVideo(1); | |
} | |
if (evt.keyCode == 189) { // "-" zoomout | |
zoomVideo(-1); | |
} | |
}; | |
console.log('Netflix Zoom loaded.'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment