1function OfflineMode() { 2 let connection = window.navigator.onLine; 3 const elements = { 4 messages: document.querySelectorAll('[data-offline-message]'), 5 disabling: document.querySelectorAll('[data-offline-disabling]') 6 }; 7 8 function set() { 9 document.body.dataset.offlineMode = "" + !connection + ""; 10 window.onbeforeunload = null; 11 12 if (!connection) { 13 window.onbeforeunload = function() { 14 return js_translations['offline_mode']; 15 }; 16 17 $.notify({ 18 message: "" + js_translations['offline_mode'] + "" 19 }, { 20 type: 'info', 21 placement: { 22 from: 'bottom', 23 align: 'right' 24 } 25 }); 26 } 27 28 elements.messages.forEach(function(message) { 29 message.style.display = connection ? 'none' : 'block'; 30 }); 31 elements.disabling.forEach(function(disable) { 32 if ( 33 disable.getAttribute('data-offline-disabling') !== 'disabled' || 34 disable.getAttribute('data-offline-disabling-temporary') 35 ) { 36 disable.removeAttribute('disabled'); 37 } 38 39 if (!connection) { 40 disable.setAttribute('disabled', 'disabled'); 41 } 42 }); 43 } 44 45 function watcher() { 46 set(); 47 48 window.addEventListener('offline', function() { 49 connection = false; 50 set(); 51 }); 52 window.addEventListener('online', function() { 53 54 connection = true; 55 set(); 56 }); 57 } 58 59 watcher(); 60} 61 62OfflineMode();
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.