Name:
for example "Enable 2/5/10 sec rewind | Netflix"URL:
paste the script *Note, double-check that the script starts with:javascript:
javascript:eval(atob('Ci8qCiAgbWFkZ...
Last active
October 13, 2022 22:47
-
-
Save ackvf/b180e9883069ad753969a30cb2622787 to your computer and use it in GitHub Desktop.
Bookmarklets
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
/* | |
The next line is the code for the Bookmarklet | |
javascript:eval(atob('Ci8qCiAgbWFkZSBieSBRd2VydHkueHl6IDxxd2VydHlAcXdlcnR5Lnh5ej4KICBzdWJtaXQgaXNzdWVzIGhlcmU6IGh0dHBzOi8vZ2lzdC5naXRodWIuY29tL2Fja3ZmL2IxODBlOTg4MzA2OWFkNzUzOTY5YTMwY2IyNjIyNzg3CiAgaHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS9xdWVzdGlvbnMvNDI5ODA4NC9odG1sNS1mcmFtZS1ieS1mcmFtZS12aWV3aW5nLWZyYW1lLXNlZWtpbmcvNjY0NjQyMzUjNjY0NjQyMzUKKi8KZnVuY3Rpb24gaGFuZGxlS2V5KGV2KSB7CiAgbGV0IGQgPSAwOwoKICBzd2l0Y2ggKGV2LmtleSkgewogICAgY2FzZSAiLCI6IGQgPSAtNTsgYnJlYWs7CiAgICBjYXNlICIuIjogZCA9ICs1OyBicmVhazsKICAgIGNhc2UgIj8iOiBkID0gLTEwOyBicmVhazsKICAgIGNhc2UgIjoiOiBkID0gKzEwOyBicmVhazsKICAgIGNhc2UgIjwiOiBkID0gLTI7IGJyZWFrOwogICAgY2FzZSAiPiI6IGQgPSArMjsgYnJlYWs7CiAgfQoKICBpZiAoZCkgdmlkZW8uc2Vlayh2aWRlby5nZXRDdXJyZW50VGltZSgpICsgZCAqIDEwMDApCn0KICAKZnVuY3Rpb24gZ2V0UGxheWVyKCkgewogIGxldCBwbGF5ZXIgPSBuZXRmbGl4LmFwcENvbnRleHQuc3RhdGUucGxheWVyQXBwLmdldEFQSSgpLnZpZGVvUGxheWVyCiAgbGV0IHNlc3Npb24gPSBwbGF5ZXIuZ2V0QWxsUGxheWVyU2Vzc2lvbklkcygpLmZpbmQocyA9PiBzLnN0YXJ0c1dpdGgoIndhdGNoIikpCiAgcmV0dXJuIHBsYXllci5nZXRWaWRlb1BsYXllckJ5U2Vzc2lvbklkKHNlc3Npb24pCn0KCmxldCB2aWRlbyA9IGdldFBsYXllcigpCgpkb2N1bWVudC5vbmtleXByZXNzID0gaGFuZGxlS2V5Cg==')) | |
*/ | |
// Create Bookmarklet code | |
function toBase64Bookmarklet(fn){ | |
const text = fn.toString() | |
const body = text.slice(text.indexOf('{') + 1, text.lastIndexOf('}')) | |
const bstring = `javascript:eval(atob('${btoa(body)}'))` | |
copy(bstring) | |
return bstring | |
} | |
// To verify that the code of the Bookmarklet is indeed what is executed, you can run this code and compare the output. | |
// function enhance() {...} // <- replace this with the code of the enhance function from the-script.js | |
toBase64Bookmarklet(enhance) // returns javascript:eval(atob('ewogIC8vIG1hZGUgYnk... |
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
function enhance(){ | |
/* | |
made by Qwerty.xyz <qwerty@qwerty.xyz> | |
submit issues here: https://gist.github.com/ackvf/b180e9883069ad753969a30cb2622787 | |
https://stackoverflow.com/questions/4298084/html5-frame-by-frame-viewing-frame-seeking/66464235#66464235 | |
*/ | |
function handleKey(ev) { | |
let d = 0; | |
switch (ev.key) { | |
case ",": d = -5; break; | |
case ".": d = +5; break; | |
case "?": d = -10; break; | |
case ":": d = +10; break; | |
case "<": d = -2; break; | |
case ">": d = +2; break; | |
} | |
if (d) video.seek(video.getCurrentTime() + d * 1000) | |
} | |
function getPlayer() { | |
let player = netflix.appContext.state.playerApp.getAPI().videoPlayer | |
let session = player.getAllPlayerSessionIds().find(s => s.startsWith("watch")) | |
return player.getVideoPlayerBySessionId(session) | |
} | |
let video = getPlayer() | |
document.onkeypress = handleKey | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment