Jump to content

AimlessFly

Circle Member
  • Posts

    1
  • Joined

  • Last visited

Posts posted by AimlessFly

  1. Hello, that's added in the advanced > custom code setting popup on a page working good on 7.0 , but when i switched over to 7.1 it stopped working, can you tell me what's wrong thanks. 

    Here is the code: 

     

    <style>
      /* Hide blocks outside of edit mode */
      body:not(.sqs-edit-mode) .sqs-layout .sqs-block {
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
      }

      /* Show specific blocks when condition is met */
      body:not(.sqs-edit-mode) .removex {
        pointer-events: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
      }

      /* Lock and fade out certain elements */
      body:not(.sqs-edit-mode) .subslock {
        opacity: 0 !important;
        pointer-events: none;
      }

      body:not(.sqs-edit-mode) .fadeload {
        opacity: 1 !important;
      }

      body:not(.sqs-edit-mode) .sqs-layout {
        opacity: 0;
        transition: opacity 1ms ease-in-out;
      }

      /* Responsive font size for header */
      @media screen and (max-width: 768px) {
        .subsmessage h1 {
          font-size: 1.5rem;
        }
      }

      @media screen and (min-width: 769px) {
        .subsmessage h1 {
          font-size: 2rem;
        }
      }

      /* Button styling */
      .subs-button {
        border: none;
        padding: 15px 32px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
        margin: 4px 2px;
        cursor: pointer;
      }

      .subs-button.join-now {
        background-color: hsl(19, 87%, 53%);
        color: white;
      }

      .subs-button.member-login {
        background-color: white;
        color: black;
        border: 1px solid black;
      }

      /* Responsive button adjustments */
      @media screen and (max-width: 768px) {
        .subs-button {
          font-size: 12px;
          padding: 10px 20px;
        }
      }
    </style>

    <iframe style="visibility:hidden;pointer-events:none;z-index:-9999;opacity:0;position:absolute;top:0;left:0;width:100%;height: 200px;" class="subscription-checkx" src="/account/frame/subscriptions"></iframe>
    <div class="subsnotice subslock" style="position:fixed;z-index:9;top:55%;left:50%;transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);width: 400px;height: 200px;transition: all ease-in-out 200ms;">
      <div class="subsmessage" style="left:0;margin-top: 36px;width:100%;display:block;text-align:center;">
        <h1>Members Access Only</h1>
        <button class="subs-button member-login" onclick="location.href='https://www.texashuntingleaselistings.com/account/login';">Member Login</button>
        <button class="subs-button join-now" onclick="location.href='https://www.texashuntingleaselistings.com/subscriptions/texas-hunting-lease-listing-monthly-subscription';">Join Now</button>
      </div>
    </div>
    <style>.xs-hide{display:none Important;visbility: hidden;}</style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
    <script type="text/javascript">
      $(window).load(function(){
       setTimeout(function(){
         $(".sqs-layout").addClass("fadeload");
       },2000);
      });
    </script>
    <script type="text/javascript">
      $(window).load(function(){
       setInterval(function(){
         /* SUBSCRIPTION PRODUCT NAME */
         var name = "Texas Hunting Lease Listings - Monthly Subscription";
         /* YOUR SERIAL KEY */
         var serial_key = "jd0PasDner9f0Gm0v0dZ";
         
         /* DON'T CHANGE */
         var subs = "Subscriptions";
         /* DON'T CHANGE */
         var next = "Next Order";
         
        if (($(".subscription-checkx").contents().text().search(next) > -1)){
            /* ACCESS GREANTED **/
            $(".sqs-layout .sqs-block").addClass('removex');
            $(".subsnotice").addClass('subslock');
        }else{
            $(".sqs-layout .sqs-block").removeClass('removex');
            $(".subsnotice").removeClass('subslock');
          $("body").find(serial_key);
        }
       },2000);
      });
    </script>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
     $(function () {
       $(this).bind("contextmenu", function (e) 
                    {}
       );
     });
    </script>
    <script type="text/javascript">
      console.log("Script initialized and observer is about to start.");

      // This function is used to update the contact button
      function updateContactButton(node) {
        var contactInfo = node.getAttribute("href").trim();
        var phoneNumberPattern = /^\+?(\d.*){3,}$/;
        var urlPattern = /^(http|https):\/\/[^ "]+$/;

        if (contactInfo.includes("@")) {
          node.setAttribute("href", "mailto:" + contactInfo);
          node.textContent = "Send Email";
          console.log("Contact info set as email:", contactInfo);
        } else if (phoneNumberPattern.test(contactInfo)) {
          node.setAttribute("href", "tel:" + contactInfo.replace(/[^0-9+]/g, ""));
          node.textContent = "Call Now";
          console.log("Contact info set as phone number:", contactInfo);
        } else if (urlPattern.test(contactInfo)) {
          node.setAttribute("href", contactInfo);
          node.textContent = "Visit Page";
          console.log("Contact info set as URL:", contactInfo);
        } else {
          console.log(
            "The contact information format is unrecognized:",
            contactInfo
          );
          node.textContent = "Contact Not Available";
          node.removeAttribute("href");
          node.style.pointerEvents = "none";
          node.style.opacity = "0.5";
        }
      }

      // MutationObserver to watch for when the .sv-product__cta-btn element is added or removed
      var observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
          mutation.addedNodes.forEach(function (node) {
            // Check if the added node is the element we want (or contains the element we want)
            if (node.nodeType === 1 && node.matches(".sv-product__cta-btn")) {
              console.log(".sv-product__cta-btn element added to DOM.");
              updateContactButton(node);
            } else if (
              node.nodeType === 1 &&
              node.querySelector(".sv-product__cta-btn")
            ) {
              console.log(".sv-product__cta-btn element found within added nodes.");
              updateContactButton(node.querySelector(".sv-product__cta-btn"));
            }
          });
        });
      });

      // Options for the observer (which mutations to observe)
      var config = { attributes: false, childList: true, subtree: true };

      // Start observing the document
      observer.observe(document.body, config);

      console.log(
        "Observer has started and is watching for .sv-product__cta-btn elements."
      );
    </script>

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