1/** 2 * AutoReload JavaScript functionality 3 */ 4(function($) { 5 'use strict'; 6 7 // Only proceed if we have the required data 8 if (typeof autoreloadData === 'undefined') { 9 return; 10 } 11 12 // Function to reload the page 13 function reloadPage() { 14 window.location.reload(); 15 } 16 17 // Set up the reload timer 18 let reloadTimer = setTimeout(reloadPage, autoreloadData.interval); 19 20 // Optional: Add a visual indicator that the page will reload 21 function createReloadIndicator() { 22 const indicator = $('<div>', { 23 class: 'autoreload-indicator', 24 css: { 25 position: 'fixed', 26 bottom: '20px', 27 right: '20px', 28 background: 'rgba(0, 0, 0, 0.7)', 29 color: 'white', 30 padding: '10px 15px', 31 borderRadius: '5px', 32 fontSize: '14px', 33 zIndex: '9999', 34 display: 'none' 35 } 36 }); 37 38 $('body').append(indicator); 39 return indicator; 40 } 41 42 // Create and show the indicator 43 const indicator = createReloadIndicator(); 44 45 // Show indicator based on message timing setting 46 setTimeout(function() { 47 const messageTiming = autoreloadData.messageTiming / 1000; // Convert back to seconds 48 indicator.text(autoreloadData.messages.reloadIn.replace('%d', messageTiming)).fadeIn(); 49 50 // Update countdown 51 let countdown = messageTiming; 52 const countdownInterval = setInterval(function() { 53 countdown--; 54 if (countdown > 0) { 55 indicator.text(autoreloadData.messages.reloadIn.replace('%d', countdown)); 56 } else { 57 clearInterval(countdownInterval); 58 indicator.fadeOut(); 59 } 60 }, 1000); 61 }, autoreloadData.interval - autoreloadData.messageTiming); 62 63 // Optional: Allow users to cancel the reload 64 $(document).on('mousemove keypress', function() { 65 clearTimeout(reloadTimer); 66 reloadTimer = setTimeout(reloadPage, autoreloadData.interval); 67 indicator.fadeOut(); 68 }); 69 70})(jQuery);
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.