views:

93

answers:

4

Hi all, 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)

+2  A: 

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.

Andy
A: 

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)

ram
Stack Overflow is not a code writing service. Take Andy's script as a basis and replace `buttonIDName` by the ID of the button you want to change.
Pekka
This should have been a comment to Andy's answer and/or an edit to the question. Only use "Answers" for answers.
Brock Adams
+2  A: 

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")
        }
    );
}
Brock Adams
A: 

Brock thank you but, it does not change the link on the left folder toolbox see attached image alt text

ram
@ram please stop adding answers - SO works differently from a forum. Please reply by adding a comment to an answer, and by editing your question
Pekka
@ram: I tested the script on my Yahoo account, but I see that we are in different domains. The script has been modified to work on USA, Yahoo accounts.
Brock Adams
@Brock: when I use yahoo classic it works, but on yahoo with ajax it doesn't
ram
@ram: This is a site for programmers. You are expected to provide relevant **details** and to show some effort at creating and debugging the solutions. Merely saying "it doesn't work" is insufficient. Also, by "yahoo with ajax" do you mean Yahoo's "Yahoo! Mail Plus"? The one that costs $20 a year? There's no way in hell we're *paying* yahoo, just to test a script we'll never use.
Brock Adams