2

A website that I frequent utilizes the following javascript

    function idle() {
     $(document).unbind('mousemove');
     $(document).unbind('keydown');
     $(document).on('mousemove', function () {
         resetTimebomb('keydown');
     });
     $(document).on('keydown', function () {
         resetTimebomb('mousemove');
     });
     setTimeout('idle();', 60000);
 }

 function resetTimebomb(psUnbind) {
     $(document).unbind(psUnbind);
     $.ajax({
         global: false,
         url: '/internal/reset_timebomb.php',
         success: function (sData) {
             if ($.trim(sData).length && sData != 'STILL_LOGGED_IN') {
                 timeout();
             }
         }
     });
 }

 function timeout() {
     var sReturnTo = '&return_to=' + encodeURIComponent(window.location.pathname + window.location.search);
     var sReturnToUser = typeof (iLoggedInUserID) != 'undefined' ? '&return_to_user=' + iLoggedInUserID.toString() : '';
     window.location = '/index.php?message=TIMEOUT' + sReturnTo + sReturnToUser;
 }

And that js appears in the middle of a js file thousands of lines long. This js causes an auto-logout after a fairly brief duration, and I would like it if I did not get booted so quickly. The timeout of "60000" seems to be 10 minutes. By whatever means necessary, I would like to either

1) Increase the timeout duration, or
2) eliminate the timeout functions altogether, or
3) simulate activity, even when the window is not in focus, to trigger the timeout reset.

I would utilize something like NoScript, but I need to allow all other scripts on the page. It is just these particular function, in the middle of a massive file, that I need to subvert.

Thanks.

I would be most grateful if the solution involved utilizing my router, which runs a variant of Tomato firmware, so that all of my devices, tablet included, could benefit from the solution.

Judith
  • 673
  • 5
  • 18
David
  • 143

1 Answers1

0

no no no..you have some misconceptions here.

  1. The timeout of "60000" seems to be 10 minutes

    60000milliseconds = 60 seconds = 1 minute

  2. setTimeout basically gives you delay.Its not a timer.It simply means that in your case function idle() will be executed after 1 minute.

if you want to get rid of timer and continue with you game,There is a small trick to it.

Just edit one line..

success: function (sData) {
    if ($.trim(sData).length && sData != 'STILL_LOGGED_IN') {
        timeout();//erase this like,comment it out.
    }

Convert this in to:

  if ($.trim(sData).length && sData != 'STILL_LOGGED_IN') {

    }

timeout() redirects you to after some time..to avoid this just dont call it.