Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Prime Video Next
- // @version 0.1.2
- // @description Instantly plays the next episode. This script skips the wait time on auto-play and circumvents the "auto pause" that checks if you're still watching.
- // @author Luxocracy
- // @grant none
- // @match https://www.primevideo.com/*
- // ==/UserScript==
- (function() {
- /*jshint multistr: true */
- 'use strict';
- var primeTimeout;
- var primeSetTimeout = function(waitTime) {
- var playnext = document.querySelector('.nextUpCard');
- primeTimeout = setTimeout(function() {
- if(!document.querySelector('.pausedOverlay .playIcon')) playnext.click(); // If not paused, play next episode
- }, waitTime);
- };
- var getTimeStamp = function(timestamp) {
- return 0;
- var split = timestamp.split(':');
- var minutes = parseInt(split[0]) * 60;
- var seconds = parseInt(split[1]);
- return (minutes + seconds) * 1000; // Returns timestamp in milliseconds
- };
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if(mutation.addedNodes.length > 0 && mutation.addedNodes[0].className && mutation.addedNodes[0].className.toString().match(/nextUp/)) {
- var waitTime = getTimeStamp(document.querySelector('.infoBar .timeRemaining').lastChild.data) - 1500;
- primeSetTimeout(waitTime);
- }
- });
- });
- observer.observe(document.querySelector('body'), { childList: true, subtree: true });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement