1class DZMTabAway { 2 3 constructor() { 4 this.originalTitle = null 5 this.settings = null 6 this.inactivityTimer = null 7 this.toggleTimer = null 8 this.isShowingMessage = false 9 } 10 11 init() { 12 const allSettings = window.dzm_opc_salesbooster_settings ?? {} 13 this.settings = allSettings.tabAway ?? null 14 15 if (!this.settings || !this.settings.active) return 16 17 this.originalTitle = document.title 18 19 document.addEventListener('visibilitychange', () => { 20 if (document.hidden) { 21 this.onTabHidden() 22 } else { 23 this.onTabVisible() 24 } 25 }) 26 } 27 28 onTabHidden() { 29 const delay = (this.settings.inactivityDelay ?? 30) * 1000 30 31 this.inactivityTimer = setTimeout(() => { 32 this.startBlinking() 33 }, delay) 34 } 35 36 onTabVisible() { 37 clearTimeout(this.inactivityTimer) 38 clearInterval(this.toggleTimer) 39 this.inactivityTimer = null 40 this.toggleTimer = null 41 document.title = this.originalTitle 42 this.isShowingMessage = false 43 } 44 45 startBlinking() { 46 const interval = (this.settings.toggleInterval ?? 2) * 1000 47 const lang = window.dzm_opc_salesbooster_lang ?? {} 48 const message = lang.tabAwayMessage || 'â¤ï¸ Wir vermissen dich!' 49 50 document.title = message 51 this.isShowingMessage = true 52 53 this.toggleTimer = setInterval(() => { 54 this.isShowingMessage = !this.isShowingMessage 55 document.title = this.isShowingMessage ? message : this.originalTitle 56 }, interval) 57 } 58} 59 60new DZMTabAway().init()
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.