SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict trogdor1024's Avatar
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript / Greasmonkey Question

    I go to a website that has a javascript based timeout and I was wondering if there was a way (using a Greasemonkey script?) that I could either disable the timer or significantly increase the timeout value. Below are the relevant parts of the html on the page...

    Code HTML4Strict:
    <html>
    <head>
    <script language="JavaScript">
    var timeout = 600*1000;
    var btimd = timeout + 5000;
    var tOF = '';
     
    function lOut() {
    newwin.close();
    location.href = 'http://www.somewhere.com'
    }
     
    function timedOut() {
    clearTimeout(tOF);
    tOF = setTimeout('lOut()',btimd);
    }
     
    timedOut();
    </script>
    </head>
    <body>
    ...whatever...
    </body>
    </html>

    The most promising thought I've had is setting up a Greasemonkey script that basically runs "clearTimeout(tOF)" but that does not work, perhaps I cannot reference "tOF".

    Do you have any thoughts on where to go from here?

    thx,

    Trogdor

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Possibly overriding the timedOut() function.

    function timedOut() {}
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict trogdor1024's Avatar
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Possibly overriding the timedOut() function.

    function timedOut() {}
    I did try that too but I am still redirected to "www.somewhere.com" after the time runs out.

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  5. #5
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The function timedOut has already been run, so it won't help to redefine it. You might be able to redefine lOut instead, since it's not run until the timeout. Eg.:
    Code:
    lOut = function() {}


Bookmarks

Posting Permissions

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