Last active
April 30, 2019 04:14
-
-
Save dazoe/0efcd4c49e0dbf26e44639a91f5207ed to your computer and use it in GitHub Desktop.
Zoom netflix videos by using "=" and "-"
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 Netflix Zoom | |
// @namespace netflix.tld | |
// @version 0.3 | |
// @description try to take over the world! ??? Profit. | |
// @author Dave Akers | |
// @match https://www.netflix.com/* | |
// @grant none | |
// ==/UserScript== | |
/* | |
-# DON'T BE A DICK PUBLIC LICENSE | |
-> Version 1.1, December 2016 | |
-> Copyright (C) 2016 Dave Akers | |
- | |
- Everyone is permitted to copy and distribute verbatim or modified | |
- copies of this license document. | |
- | |
-> DON'T BE A DICK PUBLIC LICENSE | |
-> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
- | |
- 1. Do whatever you like with the original work, just don't be a dick. | |
- Being a dick includes - but is not limited to - the following instances: | |
- 1a. Outright copyright infringement - Don't just copy this and change the name. | |
- 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick. | |
- 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick. | |
- | |
- 2. If you become rich through modifications, related works/services, or supporting the original work, | |
- share the love. Only a dick would make loads off this work and not buy the original work's | |
- creator(s) a pint. | |
- | |
- 3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes | |
- you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back. | |
-*/ | |
(function() { | |
'use strict'; | |
var newVersion = true; | |
var findVideoElement = function() { | |
var wrapper = document.getElementsByClassName('video-container')[0]; | |
if (!wrapper) { | |
newVersion = false; | |
wrapper = document.getElementsByClassName('player-video-wrapper')[0]; | |
} | |
return wrapper.getElementsByTagName('video')[0]; | |
}; | |
var zoomVideo = function(offset) { | |
var ele = findVideoElement(); | |
console.log(ele); | |
var 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
Here's a simpler version. Use the keypads + -