문제

My Greasemonkey script works exactly as I want it to by but it somehow blocks javascripts from the website itself. They just don't work anymore.

I use the very useful waitForKeyElements() to start some actions after a certain container has been loaded.

What is disturbing the other scripts?

// @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
도움이 되었습니까?

해결책

See "jQuery in Greasemonkey 1.0 conflicts...".
The problem is the @grant none. This is a very poorly though-out "feature" of Greasemonkey that guarantees that you will have conflicts and errors. You're just lucky that this time it was so obvious and immediate.

Change @grant none to @grant GM_addStyle. This will restore the sandbox and remove the conflict.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top