Jump to content

What does this JV code do?

Recommended Posts

Posted

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!

  • Replies 3
  • Views 894
  • Created
  • Last Reply
Posted
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?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

Posted

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 the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Posted

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.