Jump to content

Can anyone tell me what this code means?

Go to solution Solved by Ziggy,

Recommended Posts

We are having issues with the links on our sermons page. https://fcclife.me/2sermons Squarespace support said it is being affected by the injected code. I inherited the site, so I did not add this code, and have since redesigned the site. Is this code doing anything? Can I just delete it?

This is in the header box:

<!-- CHANGE THE HEX COLOR CODE BELOW -->
<style>
#timer div {
    color: #000000;
    display: table-cell;
    font-size: 100px;
    letter-spacing: 2px;
    font-weight: 500;
    color: #FFFFFF;
  padding: 20px;
    border-radius: 300px;
    text-align: center;
  }
#timer {
  margin: 0 auto;
  display: table;
}
#timer div span {
      letter-spacing: 1px;
      color: e47362;
      font-size: 20px;
      margin-left: -4px;
      margin-top: 40px;
      display: block;
    }
@media (max-width : 667px) {
  #timer div {
      padding: 16px;
      font-size: 26px !important;
  }
  #timer div span {
        margin-top: 2px;
        font-size: 12px !important;
      }
  }
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<!-- CHANGE THE TARGET TIME AND DATE BELOW -->
<script>
function makeTimer() {

var endTime = new Date("December 24, 2021 14:00:00 EST");
var endTime = (Date.parse(endTime)) / 1000;

var now = new Date();
var now = (Date.parse(now) / 1000);

var timeLeft = endTime - now;

var days = Math.floor(timeLeft / 86400); 
var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));

if (hours < "10") { hours = "0" + hours; }
if (minutes < "10") { minutes = "0" + minutes; }
if (seconds < "10") { seconds = "0" + seconds; }

$("#days").html(days + "<span>Days</span>");
$("#hours").html(hours + "<span>Hours</span>");
$("#minutes").html(minutes + "<span>Minutes</span>");
$("#seconds").html(seconds + "<span>Seconds</span>");

}

setInterval(function() { makeTimer(); }, 1000);
</script>

<style>
.counter-container {
  color: #000000;
  text-align: center;
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-evenly;
}
#counterbox {
  display: inline-block;
  min-width:450px;
}
#counterbox p {
  text-align: center;
  width: 100%;
  display: block;
}
.counter {
  font-size:60px;
  line-height: 40px;
  font-weight: 100;
}
@media (max-width:870px) {
  .counter-container {
    display: block !important;
    width: 100% !important;
  }
   .counter-countainer #counterbox {
      margin-top: 20px;
      margin-bottom: 20px;
  }
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript">
/*=============== SQUARE STUDIO ANIMATED COUNTER PLUGIN START ===============*/
function watch(){MutationObserver=window.MutationObserver||window.WebKitMutationObserver,new MutationObserver(function(a){for(var b=0;b<a.length;b++){if("attributes"===a[b].type){var d=new Event("pageChange");document.dispatchEvent(d)}}}).observe(document.body,{attributes:!0,attributeFilter:["id"]})}var executed=!1;$(document).ready(function(){function a(){$(".counter-container").length>0&&$(window).scroll(function(){b()})}function b(){if(!executed){var a=.1*$(".counter-container").outerHeight();$(window).scrollTop()>$(".counter-container").offset().top-$(window).height()+a&&(executed=!0,$(".counter").each(function(){var a=$(this),b=a.attr("data-count");$({countNum:a.text()}).animate({countNum:b},{duration:3e3,easing:"linear",step:function(){a.text(Math.floor(this.countNum))},complete:function(){a.text(this.countNum)}})}))}}a()}),document.addEventListener("pageChange",function(){executed=!1,$(window).unbind("scroll"),init()}),window.onload=watch;
/*================ SQUARE STUDIO ANIMATED COUNTER PLUGIN END ================*/
</script>

And this is in the Footer box:

<script src="https://apps.elfsight.com/p/platform.js" defer></script>
<div class="elfsight-app-ce1c82cc-76cb-4023-b9c1-d41080bb95b4"></div>

I'm thankful for any insight!

Link to comment
  • Solution

Looks like it's all for a timer and animated counter. You can always copy it, back it up, and then remove it to see what happens, if it's necessary code you can always replace it.

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Create an account or sign in to comment

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

×
×
  • 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.