1// Script to swap <h2...h10> for divs copying the classes applied to them. 2 3function duplicateChildNodes(parentId, appendedNode) { 4 var parent = parentId; 5 NodeList.prototype.forEach = Array.prototype.forEach; 6 var children = parent.childNodes; 7 children.forEach(function (item) { 8 var cln = item.cloneNode(true); 9 appendedNode.appendChild(cln); 10 }); 11} 12 13function replaceElement(element, maxCounterReplace = 0) { 14 var checkPresentDOM = document.querySelectorAll(element); 15 if (checkPresentDOM.length > 0) { 16 $(element).each(function () { 17 var clonedNode = document.createElement("div"); 18 const styles = window.getComputedStyle(this); 19 if (this.childElementCount > 0) { 20 duplicateChildNodes(this, clonedNode); 21 } else { 22 clonedNode.textContent = this.innerText; 23 } 24 if (styles.cssText !== "") { 25 clonedNode.style.cssText = styles.cssText; 26 } else { 27 const cssText = Object.values(styles).reduce((css, propertyName) => { 28 return `${css}${propertyName}:${styles.getPropertyValue( 29 propertyName 30 )};`; 31 }); 32 clonedNode.style.cssText = cssText; 33 } 34 35 $(this).replaceWith(clonedNode); 36 }); 37 } else if (maxCounterReplace < 15) { 38 maxCounterReplace++; 39 setTimeout(function () { 40 replaceElement(element, maxCounterReplace); 41 }, 500); 42 } 43} 44 45setTimeout(function () { 46 replaceElement("#post-243029 h5"); 47 replaceElement(".solution-block h4"); 48 replaceElement(".et_pb_column_23 h5"); 49 replaceElement("#post-137817 h4"); 50 replaceElement("#post-138927 h5"); 51 replaceElement("#brands-audience-mobile h4"); 52}, 600); 53 54if ("/advertising-and-marketing-services/".includes(window.location.pathname)) { 55 replaceElement(".et_pb_row.et_pb_row_7.et_pb_equal_columns.et_pb_gutters1.et_pb_row_6col h4"); 56 replaceElement(".et_pb_text_inner.et_multi_view_swapped h4", 0); 57} 58 59$("h1").append("<h2></h2>"); 60$(".et_pb_bg_layout_light h1").append("<h3></h3>"); 61$(".et_pb_accordion_0").append("<h1></h1>"); 62$(".et_pb_module.et_pb_accordion.et_pb_accordion_0").prepend( 63 "<h1></h1><h2></h2><h3></h3><h4></h4>" 64); 65$(".et_pb_module.et_pb_accordion.et_pb_accordion_1").prepend( 66 "<h1'></h1><h2></h2><h3 ></h3><h4></h4>" 67); 68$( 69 ".et_pb_module.et_pb_text.et_pb_text_84.et_pb_text_align_center.et_pb_bg_layout_light" 70).prepend("<h1></h1><h2></h2><h3></h3><h4></h4>"); 71$(".largeNumber").prepend("<h3></h3>"); 72 73var maxCounter = 0; 74function replacesforDivs() { 75 if ($(".solution-block h4").length > 0) { 76 replaceElement(".solution-block h4"); 77 } else { 78 function timerMax() { 79 setTimeout(function () { 80 replacesforDivs(); 81 }, 300); 82 } 83 if (maxCounter < 10) { 84 timerMax(); 85 } 86 // We would try to call it a max of 10 Times. 87 maxCounter++; 88 } 89} 90 91replacesforDivs();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.