1window.addEventListener("load", (event) => { 2 var elements = document.querySelectorAll("[data-frequency]"); 3 4 var frequencyList = []; 5 6 const queryString = window.location.search; 7 const urlParams = new URLSearchParams(queryString); 8 const refresh = urlParams.get("refresh"); 9 10 var adminRefresh = false; 11 var adminRefreshPause = false; 12 13 if (refresh == "admin") { 14 adminRefresh = true; 15 } else if (refresh == "admin-pause") { 16 adminRefreshPause = true; 17 } else if (elements) { 18 var refreshButton = document.querySelector(".signal-admin-refresh-button"); 19 if (refreshButton) { 20 refreshButton.style.display = "block"; 21 } 22 } 23 24 for (let i = 0; i < elements.length; i++) { 25 if ( 26 adminRefreshPause || 27 adminRefresh || 28 elements[i].getAttribute("refresh-needed") == true 29 ) { 30 if (elements[i].getAttribute("data-frequency") != null) { 31 frequencyList.push(elements[i].getAttribute("data-frequency")); 32 } 33 } 34 } 35 36 var finalFrequencyList = []; 37 38 for (let j = 0; j < frequencyList.length; j++) { 39 if (!finalFrequencyList.includes(frequencyList[j])) { 40 finalFrequencyList.push(frequencyList[j]); 41 } 42 } 43 44 frequencyList = finalFrequencyList; 45 46 var count = 0; 47 48 var window_location = window.location.protocol + "//" + window.location.host; 49 window_location += "/wp-json/signal/echoes"; 50 51 httpRequest( 52 frequencyList, 53 count, 54 window_location, 55 adminRefresh, 56 adminRefreshPause 57 ); 58}); 59 60function httpRequest( 61 frequencyList, 62 count, 63 window_location, 64 adminRefresh, 65 adminRefreshPause 66) { 67 if (frequencyList.hasOwnProperty(count)) { 68 var element = frequencyList[count]; 69 70 const xhttpPost = new XMLHttpRequest(); 71 xhttpPost.open("POST", window_location, true); 72 xhttpPost.setRequestHeader("Content-Type", "text/plain"); 73 xhttpPost.setRequestHeader("page-url", window.location.href); 74 xhttpPost.send(element); 75 76 xhttpPost.onload = function () { 77 if (this.status == "200") { 78 console.log("yodelayheehoo " + JSON.parse(this.response).message); 79 } else { 80 console.log("yodelayheehoo failed: " + element); 81 } 82 83 httpRequest( 84 frequencyList, 85 count + 1, 86 window_location, 87 adminRefresh, 88 adminRefreshPause 89 ); 90 }; 91 } else { 92 if (adminRefresh) { 93 var redirectURL = 94 window.location.protocol + 95 "//" + 96 window.location.host + 97 window.location.pathname; 98 99 const urlParams = new URLSearchParams(window.location.search); 100 urlParams.delete("refresh"); 101 102 if (urlParams.toString()) { 103 redirectURL += "?" + urlParams.toString(); 104 } 105 106 window.location.href = redirectURL; 107 } 108 109 if (adminRefreshPause || adminRefresh) { 110 var refreshButton = document.querySelector( 111 ".signal-admin-refresh-button" 112 ); 113 114 if (refreshButton) { 115 refreshButton.style.display = "block"; 116 } 117 } 118 } 119}
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.