Hi,

It looks like the page that you want to run the script on, does not
match any of the @include's.

>>> I want to alter the target of a link on the webpage
>>> https://oasis2.ecfmg.org/srinfo.asp. The title of the link is Step 2 CS - I
>>> want to change the title to Step 2 CK and the target to
>>> http://www.facebook.com/AMVQA.


// ==UserScript==
// @name Insert a script name here
// @namespace Insert something unique to this script here
// @description Insert a short description of your script here.

// @include https://oasis2.ecfmg.org/srinfo.asp

// ==/UserScript==


The namespace is used to prevent clashes between scripts of the same
name - ie, so that your 'changeElements' script can co-exist with the
original 'changeElements' script.


For further information about the @include metadata tag, see
http://wiki.greasespot.net/Include_and_exclude_rules .
Long story short, if you want to only run the script on one single
page, just enter that web address, else use the wildcard * character
to match multiple pages.


RE: Matt's code sample, assuming that the "LINK-URL-GOES-HERE" was
suitably replaced by yourself and there's not any AJAX trickery
creating the <a> tag after the initial page is loaded (ie, after the
script has finished running), I don't see any reason why it would not
work.

Perhaps install the Firebug addon for Firefox and run the code within
the 'console' there (or use the web console via ctrl+shift+k if you
are using firefox 4+ ) to test whether it is the code or the
userscript that is the issue.


kwah




On 14 August 2011 19:44, Harman Hundal <[email protected]> wrote:
> Thank you reply Matt,
> I tried using the script you gave me, it doesn't work. I'd like to chat with
> you for 10 min over gmail chat if you have time. Can you please let me know
> when you'll be online and free.
>
> I'll even pay you 40$ if you help me get this done, If you don't want the
> money, then I will send it to UNICEF.
> Sincerely,
> Harman
>
> On Fri, Aug 12, 2011 at 23:41, Matt Sargent <[email protected]>
> wrote:
>>
>> Wow. That seems like a whole lot of code for a simple task. It's difficult
>> to check, since the page you reference is password locked. But, assuming the
>> link only appears once per page, something like this should work. (This is
>> completely untested, of course.)
>>
>>
>> //  usual header stuff here
>>
>>
>>    var link = document.evaluate("//a[@href = 'LINK-URL-GOES-HERE']",
>>                document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
>> null).singleNodeValue;
>>    if (link) {
>>        link.href = 'http://www.facebook.com/AMVQA';
>>        link.firstChild.data = 'Step 2 CK';
>>    }
>>
>>
>> If it's possible that the link can appear multiple times, the XPATH will
>> need to be adjusted, and you'll need to loop through the results. And if the
>> page is AJAX in nature, that's another ball of wax.
>>
>>
>> On 8/12/2011 2:43 PM, Harman Hundal wrote:
>>>
>>> Please help, My area of expertise is Encryption. But I need a little help
>>> with Javascript. I have learnt the basics of HTML but javascript is a bit
>>> harder for me to understand. However I need help urgently.
>>>
>>> I want to alter the target of a link on the webpage
>>> https://oasis2.ecfmg.org/srinfo.asp. The title of the link is Step 2 CS - I
>>> want to change the title to Step 2 CK and the target to
>>> http://www.facebook.com/AMVQA.
>>>
>>> I have found a userscript that seems to be useful once I've figured out
>>> how to suitably modify it. And this is where I am facing trouble. I have
>>> gone to a lot of forums to read more about it, tried many different scripts
>>> and spent a lot of hours trying to figure this out - But have failed. I do
>>> not have much time left - So Please help.
>>>
>>> Please let me know how should I alter this userscript for my purpose. I
>>> need to the same thing i outlined above on many pages, if you guide me with
>>> the first one, I'll be able to modify the script myself thereon. I'd be
>>> grateful if you could modify the script I have pasted below and return it to
>>> me.
>>>
>>> I'd be deeply indebted if you could help me on this right now. I have
>>> literally no time to learn it myself or experiment on it (as I'd like to if
>>> I had time on my side).
>>>
>>>
>>> Here is the Script :
>>>
>>> [snipped]
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "greasemonkey-users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/greasemonkey-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to