2010-08-23 60 views

回答

2

well greasemonkey只是JavaScript注入頁面。

所以假設你知道如何使用Greasemonkey的,你只需要編寫代碼的短peice的找到鏈接/按鈕,操作它的文本類似(如果你沒有的jQuery):

document.getElementById('buttonIDName').innerHtml = 'test'; 
document.getElementById('buttonIDName').href = 'javascript:alert("you clicked test")'; 

如果你沒有碰巧有jQuery的或類似的可用,那麼你可以這樣做:

$('#buttonIDName').html('test').click(function(){alert('you clicked test');}); 

Greasemonkey的是另一種JS腳本,這被頁面加載後運行。

2

更新:我只在英國域名上的主雅虎賬戶上測試了腳本。當然,雅虎對不同的國家使用明顯不同的代碼。

下面的腳本已更新爲可以在美國域名上使用,並且(可能/有希望)是英文版的大多數雅虎版本。


「好吧,我是個新手,可能會有人請寫劇本到改字‘收件箱’,以‘測試在雅虎郵件’

好吧,既然該腳本需要60秒寫和60秒來測試,這裏是...

/* Save this file as "YaHellFoo.user.js". Then open it (Ctrl-O) with Firefox and 
    let Greasemonkey install it. 
*/ 

// ==UserScript== 
// @name   Dirt Simple Demo, just uses jQuery to change the "Inbox" link to "test". 
// @namespace  YaHell 
// @include  http://*.mail.yahoo.com/* 
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js 
// ==/UserScript== 

if (window.top != window.self) //don't run on frames or iframes 
    return; 


$(document).ready (Greasemonkey_main); 


function Greasemonkey_main() 
{ 
    $("a:contains('Inbox')").each 
    (
     function (index) 
     { 
      var jNode = $(this); 
      if (jNode.text() == "Inbox") 
       jNode.text("test") 
     } 
    ); 

    //-- Different countries' YaHell instances display Inbox with different code! 
    $("span:contains('Inbox')").each 
    (
     function (index) 
     { 
      var jNode = $(this); 
      if (jNode.text() == "Inbox") 
       jNode.text("test") 
     } 
    ); 
} 
相關問題