Conquer Club

Javascript question

Talk about all things related to Conquer Club

Moderator: Community Team

Forum rules
Please read the community guidelines before posting.

Javascript question

Postby support81ghent on Mon Nov 08, 2010 11:25 am

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
User avatar
Corporal support81ghent
 
Posts: 67
Joined: Tue May 18, 2010 11:53 am
Location: Gent

Re: Javascript question

Postby sherkaner on Mon Nov 08, 2010 3:44 pm

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.
Colonel sherkaner
 
Posts: 1595
Joined: Thu May 03, 2007 3:21 am
Location: Zwolle

Re: Javascript question

Postby support81ghent on Fri Nov 19, 2010 6:33 pm

still in need of help
User avatar
Corporal support81ghent
 
Posts: 67
Joined: Tue May 18, 2010 11:53 am
Location: Gent

Re: Javascript question

Postby theherkman on Tue Nov 23, 2010 11:25 am

If I get around to it, I will do this tonight. PM me with details on the script, functions, and other uses.
MOD ABUSE LINKS
rdsrds2120
Andy/KingA


Image
Click that picture and you will go apeshit...
User avatar
Private theherkman
 
Posts: 677
Joined: Sun Mar 14, 2010 11:29 am
Location: En urz bazez!!!


Return to Conquer Club Discussion

Who is online

Users browsing this forum: No registered users