Stops the automatic playing of recommended tracks on Soundcloud.
当前为
// ==UserScript==
// @name Stop Automatic Recommendations on Soundcloud
// @namespace soundcloud-no-autoplay
// @author Veeno
// @contributor Kai Kuehner
// @contributor Technowise
// @contributor Andreas J. Schwarz
// @description Stops the automatic playing of recommended tracks on Soundcloud.
// @include http://www.soundcloud.com/*
// @include https://www.soundcloud.com/*
// @include http://soundcloud.com/*
// @include https://soundcloud.com/*
// @grant none
// @version 1.6
// ==/UserScript==
//-------------------------------------------------------------------------------------------
var sc_cp = {
"title": null,
"checkInterval": null,
"titleElement": "a.playbackSoundBadge__context",
"autoPlayString": "Playing from related tracks for ",
"attribute": "title",
"buttonElement": "button.playControl",
"isAutoPlay": function() {
sc_cp.title = document.querySelector(sc_cp.titleElement).getAttribute(sc_cp.attribute);
return sc_cp.title != null && sc_cp.title.substring(0, sc_cp.autoPlayString.length) == sc_cp.autoPlayString;
},
"checkA": function () {
if(!sc_cp.isAutoPlay()) {
clearInterval(sc_cp.checkInterval);
sc_cp.checkInterval = setInterval(sc_cp.checkB, 100);
}
},
"checkB": function () {
if(sc_cp.isAutoPlay()) {
document.querySelector(sc_cp.buttonElement).click();
clearInterval(sc_cp.checkInterval);
sc_cp.checkInterval = setInterval(sc_cp.checkA, 500);
}
}
};
window.onload = function() {
sc_cp.checkInterval = setInterval(sc_cp.checkA, 500);
};