
////site-uploads/1001348/frontjs/speed.js
$(function () {
  /*Delete slider component in mobile*/
  if ($(window).width() < 700) {
    $('#comp_1631559189130').remove();
    $('.slide').remove();
    $('.hidden-xs').remove();
    $('.desktop-only').remove();
  }

  /* load weatehr widget  */
  const userInteractionEvents = [
    'mouseover',
    'keydown',
    'touchmove',
    'touchstart',
  ];
  userInteractionEvents.forEach(function (event) {
    window.addEventListener(event, triggerScriptLoader, {
      passive: true,
    });
  });

  function triggerScriptLoader() {
    loadScripts();
    userInteractionEvents.forEach(function (event) {
      window.removeEventListener(event, triggerScriptLoader, {
        passive: true,
      });
    });
  }
  function loadScripts() {
    if (!$('#home_video').attr('src')) {
      $('#home_video').attr(
        'src',
        '/site-uploads/1001348/videos/home-video.mp4'
      );
    }

    if (!$('#_twitter_widgets').length) {
      $('._twitter_widgets_wrapper').append(
        '<script id="_twitter_widgets" async="" src="https://platform.twitter.com/widgets.js"\
        charset="utf-8"></script>'
      );
    }

    if (!$('.fb-page.fb_iframe_widget').length) {
      $('._facebook_iframe_wrapper').prepend(
        '<div class="fb-page fb_iframe_widget" data-adapt-container-width="true"\
        data-height="400" data-hide-cover="false"\
        data-href="https://www.facebook.com/factoryrecreation" data-show-facepile="true"\
        data-small-header="true" data-tabs="timeline" data-width=""\
        fb-iframe-plugin-query="adapt_container_width=true&amp;app_id=&amp;container_width=300&amp;height=400&amp;hide_cover=false&amp;href=https%3A%2F%2Fwww.facebook.com%2Ffactoryrecreation&amp;locale=en_GB&amp;sdk=joey&amp;show_facepile=true&amp;small_header=true&amp;tabs=timeline&amp;width="\
        fb-xfbml-state="rendered"><span\
            style="vertical-align: bottom; width: 300px; height: 400px;">\
            <iframe allow="encrypted-media" allowfullscreen="true"\
                allowtransparency="true" data-testid="fb:page Facebook Social Plugin"\
                frameborder="0" height="400px" name="f1f54475f2dff2" scrolling="no"\
                src="https://www.facebook.com/v12.0/plugins/page.php?adapt_container_width=true&amp;app_id=&amp;channel=https%3A%2F%2Fstaticxx.facebook.com%2Fx%2Fconnect%2Fxd_arbiter%2F%3Fversion%3D46%23cb%3Dfbacd903315ed%26domain%3Dsimplywebeditor.com%26is_canvas%3Dfalse%26origin%3Dhttp%253A%252F%252Fsimplywebeditor.com%252Ff32796880d54f94%26relation%3Dparent.parent&amp;container_width=300&amp;height=400&amp;hide_cover=false&amp;href=https%3A%2F%2Fwww.facebook.com%2Ffactoryrecreation&amp;locale=en_GB&amp;sdk=joey&amp;show_facepile=true&amp;small_header=true&amp;tabs=timeline&amp;width="\
                style="border: none; visibility: visible; width: 300px; height: 400px;"\
                title="fb:page Facebook Social Plugin" width="1000px"></iframe></span>\
    </div>'
      );
    }
  }
});
////site-uploads/1001348/frontjs/Search_script_v1.js
if (document.getElementById('searchbox')) {
  document
    .getElementById('searchbox')
    .addEventListener('keyup', function (event) {
      event.preventDefault();
      if (event.keyCode === 13) {
        document.getElementById('searchbtn')?.click();
      }
    });
}
function srch(e, page_name) {
  e.preventDefault();
  console.log(page_name);
  //var e = document.getElementById("pagedd");
  //var dest= e.options[e.selectedIndex].value;
  var valuee = document.getElementById('searchbox')?.value;
  if (valuee != '') {
    if (page_name == 'Inventory') {
      window.location = '/Search-Inventory/search/'.concat(valuee);
    } else {
      window.location = 'https://factoryrecreation-shoponline.com/search?type=product&q='.concat(valuee);
    }
  } else {
    document.getElementById('searchbox').placeholder = 'This field is required';
    var sheet = window.document.styleSheets[0];
    sheet.insertRule(
      'input#searchbox::-webkit-input-placeholder {color: red !important}',
      sheet.cssRules.length
    );
    sheet.insertRule(
      'input#searchbox::-moz-placeholder {color:#909; opacity:1;}',
      sheet.cssRules.length
    );
    sheet.insertRule(
      'input#searchbox:-moz-placeholder {color:#909; opacity:1;}',
      sheet.cssRules.length
    );
  }
}
////site-uploads/1001348/frontjs/script.js
(function () {
  const second = 1000,
    minute = second * 60,
    hour = minute * 60,
    day = hour * 24;

  //I'm adding this section so I don't have to keep updating this pen every year :-)
  //remove this if you don't need it
  let today = new Date(),
    dd = String(today.getDate()).padStart(2, '0'),
    mm = String(today.getMonth() + 1).padStart(2, '0'),
    yyyy = today.getFullYear(),
    nextYear = yyyy + 1,
    dayMonth = '08/20/',
    birthday = dayMonth + yyyy;

  today = mm + '/' + dd + '/' + yyyy;
  if (today > birthday) {
    birthday = dayMonth + nextYear;
  }
  //end

  const countDown = new Date(birthday).getTime(),
    x = setInterval(function () {
      const now = new Date().getTime(),
        distance = countDown - now;

      if ($('.WebsiteModal.in').length) {
        (document.getElementById('days').innerText = Math.floor(
          distance / day
        )),
          (document.getElementById('hours').innerText = Math.floor(
            (distance % day) / hour
          )),
          (document.getElementById('minutes').innerText = Math.floor(
            (distance % hour) / minute
          )),
          (document.getElementById('seconds').innerText = Math.floor(
            (distance % minute) / second
          ));
      }

      //do something later when date is reached
      if (distance < 0) {
        document.getElementById('headline').innerText = "It's my birthday!";
        document.getElementById('countdown').style.display = 'none';
        document.getElementById('content').style.display = 'block';
        clearInterval(x);
      }
      //seconds
    }, 0);
})();
