Page 1 of 1

Javascript question

PostPosted: Mon Nov 08, 2010 11:25 am
by support81ghent
ok first of all, thanks for spending 2minutes time reading this/helping me ...

ok, im not looking for someone who can help me with 2javascriptthings ...

first thing: the script has to check the url on top for example: www.conquerclub.com if the url is correct, it has to redirect to http://www.conquerclub.com/player.php?mode=mygames1

second thing: the script has to search for text on the page for example: Waiting for your next turn... if the text is found, it has to redirect to http://www.conquerclub.com/player.php?m ... es1&next=Y

I know its simple, but I cant seem to find this to work ... I tried:

if (url == "www.conquerclub.com") {
window.location.href = "http://www.conquerclub.com/player.php?mode=mygames1"
}
if (text == "Waiting for your next turn..." {
window.location.href = "http://www.conquerclub.com/player.php?mode=mygames1&next=Y"
}
if (text == "You played last the previous round, so you must wait until either an opponent begins their turn or half of the round passes." {
window.location.href = "http://www.conquerclub.com/player.php?mode=mygames1&next=Y"
}

but it doesnt work ...
can someone edit this to the right please? thanks in advance

Re: Javascript question

PostPosted: Mon Nov 08, 2010 3:44 pm
by sherkaner
Not entirely sure what you mean, but I'll have a go.
Code: Select all
var url = window.location.toString();
if (url.indexOf("www.conquerclub.com") > -1) { //just checking if this exists in the URL, not sure whether you want this
  window.location.href = "http://www.conquerclub.com/player.php?mode=mygames1"
}
var text = document.getElementById("action").textContent;
if (text.indexOf("Waiting for your next turn...") > -1) {
  window.location.href = "http://www.conquerclub.com/player.php?mode=mygames1&next=Y"
}


Try some javascript-things out with firebug, to see what works. It helps.

Re: Javascript question

PostPosted: Fri Nov 19, 2010 6:33 pm
by support81ghent
still in need of help

Re: Javascript question

PostPosted: Tue Nov 23, 2010 11:25 am
by theherkman
If I get around to it, I will do this tonight. PM me with details on the script, functions, and other uses.