...
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 { for (var str in languageReplacementMap) { var ccNode, ccWalker = document.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> |
...
If that script is not successful then this is an alternative:
Code Block | ||||
---|---|---|---|---|
| ||||
<!-- language script to support div,span,select --> <script> $(document).ready(function() { var siteDomain = "thisisatestsiteonly.com"; if (window.location && window.location.href && window.location.href.includes(siteDomain)) { var languageReplacementMap = { var languageReplacementMap = { " TEXT-NEEDING-CHANGE ": " DESIRED-TEXT ", " TEXT-NEEDING-CHANGE ": " DESIRED-TEXT ", } setInterval(function() { "TEXT-NEEDING-CHANGE": "DESIRED-TEXT" var languageReplacementMapCollection = {}; } setInterval(function() { try { for (var str in languageReplacementMap) { var ccNode, const replacementStringSearchQuery 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 (["DIV", "SPAN", "OPTION"].includes(parentTagName) && parentTagName !== "SCRIPT") { ccNode.textContent = ccNode.textContent.replaceAll(str, languageReplacementMap[str]) }); } } } } } catch(error) {} }, 100); } }); </script> |
Step 2: Open the Page Editor and Edit the HTML
...