greasemonkey不是太難學,大部分編碼都是簡單的javascript。 tampermonkey只是一個chrome插件,它支持某些特定的greasmonkey編碼。 (你在做什麼,這大概不是必需的)
應該只需要幾行注入你的.js和.css
我相信你真的想要你的東西運行源頁面完全後加載後,如果運行前,將通過源被覆蓋在加載時
這裏是我的代碼,做一個簡單的MOD給Facebook:
var script = document.createElement('script');
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
script.addEventListener('load', function(){
$ = unsafeWindow['jQuery'];
$.noConflict();
// all jQ code goes below here
// ---------------------------
function doFont(){
$('.fbChatTabSelector .numMessages').css('font-size','8px'); // change font smaller on red chat bubble
$('.fbChatTabSelector .numMessages').css('color','yellow'); // change font color on red chat bubble
$('.fbJewel .jewelCount').css('color','yellow'); // change font color of red bubble up top (alert jewel)
}
window.setTimeout(doFont, 30000); // wait 30 seconds and apply changes. i only do this because fb loads in chunks and my script executes before the entire page is loaded. you would only need this if your source page loads alot ofstuff with ajax
//------------------------------------
// end jQ code
}, false);
希望幫助
這個問題也與我的興趣有關,因爲我想要@ququire jquery並在greasemonkey中使用它 - 但唯一能夠工作的構造是上面實際下載每個頁面負載時再次下載腳本的構造。
你試過螢火蟲和網頁開發者嗎? – qwertymk 2012-03-30 00:48:04