Skip to content

Commit

Permalink
Update Youtube Stop Autoplay.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyawesome authored Apr 19, 2019
1 parent a7e1fb0 commit 9935d51
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions Youtube Stop Autoplay.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Youtube Stop Autoplay
// @namespace https://github.com/johnnyawesome
// @version 1.0.5
// @version 1.0.6
// @description Take over the world! :)
// @author JohnnyAwesome
// @match http://www.youtube.com/*
@@ -14,23 +14,17 @@
// @noframes
// ==/UserScript==

(function() {
'use strict';
'use strict';

setInterval(turnAutoplayOff, 5000);
setInterval(turnAutoplayOff, 10000);

function turnAutoplayOff(){
function turnAutoplayOff(){

//if Autplay is turned on....
if(document.querySelector(".yt-uix-checkbox-on-off input[type='checkbox']:checked + label")){
console.log("Status of Autoplay:", document.getElementById("toggle").getAttribute("aria-pressed"));

//...turn it off.
document.getElementById('autoplay-checkbox').click();
}

if(document.getElementById("improved-toggle").getAttribute("aria-pressed") == 'true'){
document.getElementById("improved-toggle").click();
}
if(document.getElementById("toggle").getAttribute("aria-pressed") == 'true'){
console.log("Autoplay is turned on. Turning it off.")
document.getElementById("toggle").click();
}
})();
}

0 comments on commit 9935d51

Please sign in to comment.