Quantcast

Jump to content


Photo

[GM] Script Redirect Error

greasemonkey

  • Please log in to reply
2 replies to this topic

#1 Grandmaster

Grandmaster
  • 748 posts


Users Awards

Posted 30 August 2014 - 06:49 AM

Hi, I was recently updating the Greasemonkey scripts and realised a few scripts are always giving redirection error. One of the scripts is as below. Anyone knows how to edit the script to solve the redirection issue?

// ==UserScript==
// @name           Double Or Nothing Autoplayer
// @namespace      http://userscripts.org/users/83296
// @description    Plays Double or Nothing for you.
// @include        http://www.neopets.com/medieval/doubleornothing.phtml*
// ==/UserScript==

var x = 1000 //change the page delay here; 1000 = 1 second
function timeout() {    //timeout function

if(document.body.innerHTML.indexOf('5,120 NP') != -1){
return
}

if(document.body.innerHTML.indexOf('Continue') != -1){
  var button = document.evaluate('//form[contains(@action,"doubleornothing.phtml")]/input[@Type = "submit" and @value = "Continue"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0);
  button.click();
  button.form.submit();
}

if (document.body.innerHTML.indexOf('Try again...') != -1){
  var button = document.evaluate('//form[contains(@action,"doubleornothing.phtml")]/input[@Type = "submit" and @value = "Try again..."]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0);
  button.click();
  button.form.submit();
}

var links = document.evaluate("//a[@href]", document, null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

for (var i = 0; i < links.snapshotLength; ++i)
{
    flip = links.snapshotItem(i);

    if (flip.href.match('doubleornothing.phtml.type=cointoss'))
    {
    document.location=flip.href;                        
    return;
    }
}

}
window.setTimeout(timeout, x) 


#2 Kway

Kway
  • Proud to be a Brony

  • 1242 posts


Users Awards

Posted 30 August 2014 - 02:22 PM

Did you figure it out?



#3 Grandmaster

Grandmaster
  • 748 posts


Users Awards

Posted 01 September 2014 - 02:33 AM

Did you figure it out?

 

Not yet. That's why I'm asking.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users