1// Enable styling body background while using vue hotreload 2// Tags with side effect (<script> and <style>) are ignored in client component templates. 3 4 5class BackgroundLoad { 6 // change background style on load 7 // and also on page load event 8 9 constructor () { 10 let url = new URL(document.location); 11 this.path = url.pathname; 12 this.update(); 13 // document.addEventListener("pageLoaded", this.handlePageLoad.bind(this), false); 14 $(document).on( "panikweb:load-page", this.handlePageLoad.bind(this)); 15 } 16 17 18 handlePageLoad (e) { 19 this.path = e.detail; 20 this.update(); 21 } 22 23 update () { 24 let theme = this.get_theme_name(); 25 document.body.className = theme; 26 let path = document.location.pathname; 27 28 // home page uses different theme 29 if (path == "/") { 30 document.body.classList.add('home'); 31 } 32 33 } 34 35 get_theme_name () { 36 let hash = window.location.hash; 37 if (hash == "#blue") return "blue"; 38 if (hash == "#yellow") return "yellow"; 39 40 var currentTime = new Date().getHours(); 41 if (document.body) { 42 if (3 <= currentTime && currentTime <15) { 43 return "yellow"; 44 } 45 else { 46 return "blue"; 47 } 48 } 49 } 50} 51 52 53window.onload = function() { 54 let backgroundLoad = new BackgroundLoad(); 55}
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.