1 2(function () { 3 "use strict"; 4 5 // Guard so you can tell it's running 6 window.__mychartJscramblerLoader = window.__mychartJscramblerLoader || { runs: 0 }; 7 window.__mychartJscramblerLoader.runs++; 8 9 var DEBUG = false; 10 11 // >>> IMPORTANT: set this to your real jScrambler URL <<< 12 var J_SCRAMBLER_SRC = "https://nck52700.jscrambler.com/cc/1588655105.js"; 13 14 //https://st-ea.nck52700.jscrambler.com/cc/1588655105.js = non-prod 15 //https://nck52700.jscrambler.com/cc/1588655105.js = prod 16 17 // If your app uses a base path like /MyChart or /mychart, set it here (optional). 18 // Example: var BASE_PATH = "/mychart"; 19 var BASE_PATH = "/myatriumhealth"; 20 21 var PAYMENT_PATH_PREFIXES = [ 22 "/app/bill-pay", 23 "/billing/guestpay", 24 "/app/payment-method-management", 25 "/app/payment-method-management/add-payment-method", 26 "/clinical/medications", 27 "/echeckin" 28 ]; 29 30 function log() { 31 if (!DEBUG) return; 32 try { console.log.apply(console, ["[jScramblerLoader]"].concat([].slice.call(arguments))); } catch (e) {} 33 } 34 35 function normalizePath(path) { 36 if (!path) return "/"; 37 if (path.length > 1 && path.endsWith("/")) return path.slice(0, -1); 38 return path; 39 } 40 41 function stripBase(path) { 42 if (!BASE_PATH) return path; 43 var p = normalizePath(path); 44 var b = normalizePath(BASE_PATH); 45 if (p.toLowerCase().indexOf(b.toLowerCase()) === 0) { 46 var stripped = p.slice(b.length); 47 return stripped || "/"; 48 } 49 return p; 50 } 51 52 function isPaymentCapableRoute(pathname) { 53 var raw = normalizePath(pathname || location.pathname); 54 var path = stripBase(raw).toLowerCase(); 55 56 for (var i = 0; i < PAYMENT_PATH_PREFIXES.length; i++) { 57 var prefix = normalizePath(PAYMENT_PATH_PREFIXES[i]).toLowerCase(); 58 if (path === prefix || path.indexOf(prefix + "/") === 0) return true; 59 } 60 return false; 61 } 62 63 function loadScriptOnce(src) { 64 if (!src || typeof src !== "string") { 65 log("ERROR: J_SCRAMBLER_SRC is not set properly:", src); 66 return; 67 } 68 69 var id = "jscrambler-loader"; 70 if (document.getElementById(id)) { 71 log("Script already present, skipping:", src); 72 return; 73 } 74 75 var s = document.createElement("script"); 76 s.id = id; 77 s.src = src; 78 s.async = true; 79 80 s.onload = function () { log("Loaded jScrambler OK:", src); }; 81 s.onerror = function (e) { log("FAILED to load jScrambler:", src, e); }; 82 83 var head = document.head || document.getElementsByTagName("head")[0]; 84 if (!head) { 85 log("No <head> found yet; retrying shortly."); 86 setTimeout(function(){ loadScriptOnce(src); }, 50); 87 return; 88 } 89 90 head.appendChild(s); 91 log("Injected <script> tag into <head>:", s); 92 } 93 94 function handle() { 95 var href = location.href; 96 var pathname = location.pathname; 97 var match = isPaymentCapableRoute(pathname); 98
99 window.__mychartJscramblerLoader.lastCheck = { 100 href: href, 101 pathname: pathname, 102 basePath: BASE_PATH, 103 match: match, 104 readyState: document.readyState, 105 time: new Date().toISOString() 106 }; 107 108 log("Check route:", window.__mychartJscramblerLoader.lastCheck); 109 110 if (match) loadScriptOnce(J_SCRAMBLER_SRC); 111 } 112 113 // Initial 114 try { handle(); } catch (e) { log("ERROR during initial handle()", e); } 115 116 // Catch SPA route changes 117 function hookHistory() { 118 try { 119 var origPush = history.pushState; 120 var origReplace = history.replaceState; 121 122 function wrap(fn) { 123 return function () { 124 var ret = fn.apply(this, arguments); 125 setTimeout(handle, 0); 126 return ret; 127 }; 128 } 129 130 if (origPush) history.pushState = wrap(origPush); 131 if (origReplace) history.replaceState = wrap(origReplace); 132 133 window.addEventListener("popstate", function(){ setTimeout(handle, 0); }); 134 window.addEventListener("hashchange", function(){ setTimeout(handle, 0); }); 135 136 log("History hooks installed."); 137 } catch (e) { 138 log("ERROR hooking history:", e); 139 } 140 } 141 142 hookHistory(); 143 144 // Safety net 145 setInterval(function(){ 146 try { handle(); } catch (e) {} 147 }, 2000); 148 149})();
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.