1
我的Greasemonkey腳本完全按照我希望的方式工作,但它以某種方式阻止網站本身的JavaScript。他們只是不工作了。Greasemonkey腳本阻止網站的其他腳本
我使用非常有用的waitForKeyElements()在加載某個容器後開始一些操作。
什麼令人不安其他腳本?
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant none
// ==/UserScript==
var newText = 'changed';
// changes after loading .containerid
waitForKeyElements (
"#containerid", renameTop
);
function renameTop() {
var searchlinkTop = document.getElementById('containerid');
searchlinkTop.innerHTML = newText;
}
// some normal changes
function waitForKeyElements (
// ... the script's content
哇,謝謝!它適用於此腳本。 –
哇,謝謝!它適用於我的小腳本。 但我還有另一個更大的腳本,幾個月來也遭受這個問題。當然,我也嘗試過你的建議,但它打破了整個劇本......?這種方法有沒有例外? 較大的腳本使用例如 // @require http://github.com/sizzlemctwizzle/GM_config/raw/master/gm_config.js GM_xmlhttpRequest({method:「GET」, url:'http://ajax.googleapis.com/ajax/ libs/jquery/1.3.2/jquery.min.js', onload:...;}}); GM_registerMenuCommand(...); window.addEventListener(「load」,Gm_main,false); $('div.twitter')。remove(); –
第二個腳本使用了幾個'GM_'函數。您需要爲每個'GM_'函數添加'@ grant'指令。除此之外,請爲第二個腳本打開一個新問題(將此答案標記爲答案後)。 –