1 2function getURLParameters(param, ch){ 3 var vars = []; 4 var hash; 5 var hashes = window.location.href.slice(window.location.href.indexOf(ch) + 1).split('&'); 6 console.log("hashes:: "+ hashes); 7 for (var i=0; i<hashes.length; i++) { 8 hash = hashes[i].split('='); 9 var hashKey = hash[0]; 10 if(hashKey.indexOf("?")>0){ 11 hashKey = hashKey.substring(hashKey.indexOf("?")+1); 12 console.log("hashKey setted to " + hashKey); 13 } 14 15 vars.push(hashKey); 16 vars[hashKey] = hash[1]; 17 } 18 19 if (vars[param]) { 20 return vars[param]; 21 } 22 return undefined; 23} 24 25 26function setupNoImages(){ 27 const style = document.createElement("style"); 28 style.textContent = "img { display: none !important; }"; 29 document.head.appendChild(style); 30} 31 32/* 33VAPID PUBLIC KEY: 34MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESqd99D7LuisE047Qr6XkBfeyFuEDd1AIb2bk-F7G7dYU_2EfMAf2Jl11BWI-LkYvXip-Y4LWLN_Bz21c90ygPw 35 36VAPID PRIVATE KEY: 37MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCAeiPAOfodNTxrpo1uAN-DAmaUl2AOYiuXXyZHmA5srFg 38*/ 39async function setupWebpush(){ 40 const publicVapidKey = "BOgPisdW0W0KovFmDR2Q2fr1bWTPVYFWSqac26YP7WzgT8WbzZpYADNnvAkbI-OvbwikkjRq1Kj7YNe1HNKnEV4"; 41// 1) Check support 42 if (!('serviceWorker' in navigator)) { 43 console.log('Service workers are not supported.'); 44 return; 45 } 46 if (!('PushManager' in window)) { 47 console.log('Push messaging is not supported.'); 48 return; 49 } 50 51 // 2) Register service worker 52 const registration = await navigator.serviceWorker.register('https://mkcontroller.com/library/sw.js'); 53 console.log('Service worker registered', registration); 54 55 // 3) Ask notification permission 56 const permission = await Notification.requestPermission(); 57 if (permission !== 'granted') { 58 console.log('Permission not granted'); 59 return; 60 } 61 62 // 4) Subscribe to push 63 const subscription = await registration.pushManager.subscribe({ 64 userVisibleOnly: true, 65 applicationServerKey: urlBase64ToUint8Array(publicVapidKey) 66 }); 67 68 console.log('Got subscription', subscription); 69 70 const rawKeys = subscription.toJSON(); 71 72 const payload = { 73 endpoint: rawKeys.endpoint, 74 keys: { 75 p256dh: rawKeys.keys.p256dh, 76 auth: rawKeys.keys.auth, 77 }, 78 79 // Extra custom metadata 80 metadata: { 81 url: location.href, 82 origin: location.origin + location.pathname, 83 pathname: location.pathname, 84 language: navigator.language || null, 85 userAgent: navigator.userAgent, 86 platform: navigator.platform, 87 timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, 88 screen: { 89 width: screen.width, 90 height: screen.height, 91 }, 92 timestamp: new Date().toISOString(), 93 } 94 }; 95 96 97 // 5) Send subscription to your Java backend 98 await fetch('https://mkcontroller.com/app/mkcontroller-server/rest/push/webpush/public', { 99 method: 'POST', 100 headers: { 'Content-Type': 'application/json' }, 101 body: JSON.stringify(payload) 102 }); 103 104 console.log('Subscription sent to server'); 105 } 106 107 // helper: base64url to Uint8Array 108 function urlBase64ToUint8Array(base64String) { 109 const padding = '='.repeat((4 - base64String.length % 4) % 4); 110 const base64 = (base64String + padding) 111 .replace(/-/g, '+') 112 .replace(/_/g, '/'); 113 114 const rawData = window.atob(base64); 115 const outputArray = new Uint8Array(rawData.length); 116 117 for (let i = 0; i < rawData.length; ++i) { 118 outputArray[i] = rawData.charCodeAt(i); 119 } 120 return outputArray; 121 } 122 123function bootstrap() { 124 var noimages = false; 125 if (window.location.href.includes("noimages")) { 126 console.log("URL contains noimages"); 127 noimages = true; 128 } 129 130 if(noimages == false){ 131 setupWebpush(); 132 } 133 134 if(noimages == true){ 135 setupNoImages(); 136 } 137} 138 139 140console.log('mkcontroller - landing page core boot'); 141setTimeout(bootstrap, 8000);
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.