Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
5
Indexable
(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";
    var $;
    /* all Pure helper functions */

    function waitForElement(selector, trigger, delayInterval, delayTimeout) {
      var interval = setInterval(function () {
        if (
          document &&
          document.querySelector(selector) &&
          document.querySelectorAll(selector).length > 0
        ) {
          clearInterval(interval);
          trigger();
        }
      }, delayInterval);
      setTimeout(function () {
        clearInterval(interval);
      }, delayTimeout);
    }


    /* Variation Init */
    function init() {
      var url = window.location.pathname;
      var lastSegment = url.split('/').filter(function (segment) {
        return segment.trim() !== '';
      }).pop();
      var variationText = lastSegment.replace(/-/g, ' ');
      var words = variationText.split(" ");
      for (var i = 0; i < words.length; i++) {
        words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
      }
      var finalText = "Request a " + words.join(" ") + " Demo";
      var finalctatext = "Book Your Free " + words.join(" ") + " Demo"

      document.querySelector('html body .card .card-title').innerText = finalText;
      document.querySelector('html body #marketo-form .mktoButtonRow [type="submit"]').innerText = finalctatext;
    }

    /* Initialize variation */
    if (window.location.href.indexOf('/lp') !== -1) {
      waitForElement('html body #marketo-form .mktoButtonRow [type="submit"]', init, 50, 15000);
    }
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();


Editor is loading...
Leave a Comment