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.