Results 1 to 3 of 3

Thread: GM help?

Threaded View

  1. #1

    Joined
    Jun 2012
    Posts
    2,267
    Pronouns
    He / Him
    Userbars
    40
    Thanks
    1,504
    Thanked
    2,189/819
    DL/UL
    16/0
    Mentioned
    232 times
    Time Online
    65d 10h 26m
    Avg. Time Online
    22m

    GM help?

    Code:
    if(document.body.innerHTML.indexOf('Red Apple') > -1) {
    var item= document.evaluate('//b[. = "What What What Stick"]',document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);if (item.snapshotlength > 0){item = item.snapshotItem(0);selectedlink=item.previousSibling.previousSibling;window.location = selectedlink}return;}
    Could someone explain to me what is happening here, step by step please?
    I'm trying to learn by adapting available code


    The only thing I partially understand is
    Code:
    if(document.body.innerHTML.indexOf('Red Apple') > -1)
    Where the character string "Red Apple" is searched for in the page. And an if event is triggered if it is > -1? I don't under stand the > -1 part.
    Last edited by Shawn; 06-09-2012 at 09:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •