用于更改“收件箱”的 Greasemonkey 脚本“测试”在雅虎邮箱

发布于 2024-09-15 16:04:55 字数 197 浏览 4 评论 0原文

使用 Greasemonkey 脚本,我想将链接“收件箱”更改为“测试”,它可能是在 AJAX 中。怎么做呢? Ram

来自OP评论的更新,如下:

好吧,我是一名新手,有人可以编写脚本将雅虎邮件上的“收件箱”一词更改为“测试”吗? (安迪的脚本不适合我)

with Greasemonkey script, I would like to change the link "inbox" to "test", it's probably in AJAX. How to do it? Ram

Update from OP remark, below:

Well i'm a newbie, could some one please write the script to change the word "inbox" to "test" on yahoo mail? (Andy's script didn't work for me)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

邮友 2024-09-22 16:04:55

好吧,greasemonkey 只是注入到页面中的 javascript。

因此,假设您知道如何使用 Greasemonkey,您只需要编写一小段代码来查找链接/按钮并操作其文本,例如(如果您没有 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 脚本,在页面加载后运行。

well greasemonkey is just javascript injected into the page.

So assuming you know how to use greasemonkey, you just need to write a short peice of code to find the link/button and manipulate its text something like (if you don't have jQuery):

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

If you did happen to have Jquery or the like available then you could do something like:

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

Greasemonkey is just another JS script, that gets run after page load.

终止放荡 2024-09-22 16:04:55

更新:我只在我的主雅虎帐户(位于英国域)上测试了该脚本。当然,雅虎针对不同国家/地区使用明显不同的代码。

下面的脚本已更新为适用于美国域和(可能/希望)大多数雅虎英文版本。


“好吧,我是一名新手,有人可以编写脚本来将雅虎邮件上的“收件箱”一词更改为“测试”吗?

好吧,因为该脚本需要 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")
        }
    );
}

Update: I had only tested the script on my main Yahoo account which is on the UK domain. Of course, Yahoo uses markedly different code for different countries.

The script, below has been updated to work on the US domain and (probably/hopefully) most Yahoo editions in English.


"Well i'm a newbie, could some one please write the script to change the word "inbox" to "test" on yahoo mail?

Well, since that script took 60 seconds to write and 60 seconds to test, here it is...

/*  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")
        }
    );
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文