Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Step 1: Copy the Entire Code Snippet

Code Block
<script>
	$(document).ready(function() {
		var siteDomain = "thisisatestsiteonly.com";
  		if (window.location && window.location.href && window.location.href.includes(siteDomain)) {
			var languageReplacementMap = {
	
            " TEXT-NEEDING-CHANGE ": " DESIRED-TEXT ",
		  	  " TEXT-NEEDING-CHANGE ": " DESIRED-TEXT "
			}
			setInterval(function() {
				try  var languageReplacementMapCollection = {};
	  				for (var str in languageReplacementMap) {
		const replacementStringSearchQuery	 			var ccNode, ccWalker = $("div:contains('" + str + "'), span:contains('" + str + "')");
		languageReplacementMapCollection[str] = replacementStringSearchQuery;
	  }
	  for (var str in languageReplacementMapCollection) {
		var pageElements = languageReplacementMapCollection[str];
		if (pageElements && pageElements.length) {
		  pageElements.html(function() { return $(this).html().replacedocument.createTreeWalker(document, NodeFilter.SHOW_TEXT, null, false);
				 	 	while (ccNode = ccWalker.nextNode()) {
				 	 		var parentTagName = ccNode && ccNode.parentElement && ccNode.parentElement.nodeName;
				  			if ((parentTagName === "DIV" || parentTagName === "SPAN") && parentTagName !== "SCRIPT") {
				  				ccNode.textContent = ccNode.textContent.replaceAll(str, languageReplacementMap[str]);
				  			}
				 }); 		}
			  		}
			  	} catch(error) {}
			}, 100);
		}
 	});
</script>

Step 2: Open the Page Editor and Edit the HTML

...