Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

What does this JV code do?


GregLassale

Question

Site URL: https://gregorylassale.com/

 

Site URL: 

After double checking all the code on my site, I am left with a few lines of code in the header whose purpose I can't remember.

<script>
  window.oldSetTimeout = window.setTimeout;
  window.setTimeout = function(code, delay) {
    if (delay == 5000) {
      delay = 5500;
    }
    var retval = window.oldSetTimeout(code, delay);
    return retval;
  };
  window.oldSetInterval = window.setInterval;
  window.setInterval = function(code, delay) {
    if (delay == 5000) {
      delay = 5500;
    }
    var retval = window.oldSetInterval(code, delay);
    return retval;
  };
  </script>

 

Could a dev please interpret the code above for me and describe what it does? I want to make sure it belongs to an old plugin/feature I no longer use and that it's safe to delete. 

Thanks!

Link to post
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Popular Posts

The site seems to be doing fine without that bit of code. That said, I did put it back in and commented it out as it bugs me that I can't identify what it does. I think it might be part of a fix

3 answers to this question

Recommended Posts

  • 0
On 4/7/2021 at 7:51 PM, GregLassale said:

Site URL: https://gregorylassale.com/

 

 

Site URL: 

After double checking all the code on my site, I am left with a few lines of code in the header whose purpose I can't remember.


<script>
  window.oldSetTimeout = window.setTimeout;
  window.setTimeout = function(code, delay) {
    if (delay == 5000) {
      delay = 5500;
    }
    var retval = window.oldSetTimeout(code, delay);
    return retval;
  };
  window.oldSetInterval = window.setInterval;
  window.setInterval = function(code, delay) {
    if (delay == 5000) {
      delay = 5500;
    }
    var retval = window.oldSetInterval(code, delay);
    return retval;
  };
  </script>

 

Could a dev please interpret the code above for me and describe what it does? I want to make sure it belongs to an old plugin/feature I no longer use and that it's safe to delete. 

Thanks!

It just defined  the timer without the use of it, could you remove it and tell us if there is error in console panel?

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, 360 Degree Photo block, Animated Heading Block
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to post
  • 0

That is Javascript sometimes abbreviated as JS.

I suggest that if you remove the code that you make a copy somewhere in case you need to restore it.

You can even leave it in place and comment it out until you are sure it is not needed anymore. This is a bit more involved.

<script> and </script> for a particular script

...becomes...

<!-- script> and </script -->

Adding those characters make the script an HTML comment.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to post
  • 0
Posted (edited)

The site seems to be doing fine without that bit of code. That said, I did put it back in and commented it out as it bugs me that I can't identify what it does.

I think it might be part of a fix for a plugin I bought a couple of years that was causing a flicking issue. I emailed the dev to ses if he recognizes the code. 

I've never used the console panel but will look into it and report back if I do set an error. 

Thanks, guys.

Edited by GregLassale
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...