1var timeoutStreamTimer; 2 3function timeoutStartTimer() { 4 if (stationGetStationSetting('timeout') == "Timeout") { 5 debugConsoleOutput("timeout::timeoutStartTimer", "Creating new timeout timer.", timeoutOutputToConsole); 6 debugConsoleOutput("timeout::timeoutStartTimer", "Resetting any exiting timers first", timeoutOutputToConsole); 7 timeoutCancelTimer(); 8 var dur_min = stationGetStationSetting('timeoutduration'); 9 var dur_mls = dur_min * 60000; 10 debugConsoleOutput("timeout::timeoutStartTimer", "Starting timeout timer for " + dur_min + " minutes (" + dur_mls + ")", timeoutOutputToConsole); 11 timeoutStreamTimer = setTimeout("timeoutOnTimerEnd()", dur_mls); 12 } 13} 14 15function timeoutCancelTimer() { 16 clearTimeout(timeoutStreamTimer); 17 timeoutStreamTimer = null; 18 debugConsoleOutput("timeout::timeoutCancelTimer", "Destroyed any existing timeout timer. timeoutStreamTimer = " + timeoutStreamTimer, timeoutOutputToConsole); 19} 20 21function timeoutOnTimerEnd() { 22 timeoutUpdatePromptCount(); 23 debugConsoleOutput("timeout::timeoutOnTimerEnd", "timeoutOnTimerEnd", timeoutOutputToConsole); 24 //playerChangeState('Stop'); 25 var tomodal = document.getElementById("TimeoutContainer"); 26 classie.add(tomodal, 'to-show'); 27 debugConsoleOutput("timeout::timeoutOnTimerEnd", "Starting countdown", timeoutOutputToConsole); 28 timeoutSoftAlertTimer = setTimeout("timeoutSoftAlertIntervalFinished()", timeoutSoftAlertTimerInterval); 29} 30 31function timeoutYesButtonWasClicked() { 32 debugConsoleOutput("timeout::timeoutYesButtonWasClicked", "Reaction button was clicked.", timeoutOutputToConsole); 33 document.title = tabTitleNormal; 34 timeoutUpdatePositiveResponseCount(); 35 timeoutCancelSoftAlertTimer(); 36 37 // 2020-07-16 - clearing the toggleInactivityTimeout 38 debugConsoleOutput("timeout::timeoutYesButtonWasClicked", "toggleInactivityTimeout flag set to FALSE.", true); 39 SNPlayer.toggleInactivityTimeout(false); 40 41 debugConsoleOutput("timeout::timeoutYesButtonWasClicked", "Clearing the toggleInactivityTimeout flag.", true); 42 SNPlayer.toggleInactivityTimeout(false); 43 timeoutRestartTimer(); 44} 45 46 47function timeoutRestartTimer() { 48 debugConsoleOutput("timeout::timeoutRestartTimer", "Restarting timeout timer.", timeoutOutputToConsole); 49 var tomodal = document.getElementById("TimeoutContainer"); 50 classie.remove(tomodal, 'to-show'); 51 $("#divTimer").html("--"); 52 53 if (gCurrentPlayerState !== "Playing") { 54 debugConsoleOutput("timeout::timeoutRestartTimer", "Stream has stopped already", timeoutOutputToConsole); 55 //if (gGatewayLookupEnabled === true) { 56 // debugConsoleOutput("timeout::timeoutRestartTimer", "Trying gateway lookup after timeout...", timeoutOutputToConsole); 57 // gGatewayLookupInProgress = true; 58 // gwFetchGateways(); 59 //} 60 //else { 61 // debugConsoleOutput("timeout::timeoutRestartTimer", "Skipping gateway lookup after timeout...", timeoutOutputToConsole); 62 // gGatewayLookupInProgress = false; 63 // playerStartStream(); 64 //} 65 playerStartStream(); 66 } else { 67 debugConsoleOutput("timeout::timeoutRestartTimer", "Stream is already streaming - have to start timeoutStreamTimer manually.", timeoutOutputToConsole); 68 timeoutStartTimer(); 69 } 70} 71 72 73var TimeoutModalEffects = (function () { 74 function init() { 75 var overlay = document.querySelector('.to-overlay'); 76 var modal = document.querySelector('.to-modal'); 77 //close = modal.querySelector('.od-close'); 78 79 function removeModal(hasPerspective) { 80 classie.remove(modal, 'to-show'); 81 if (hasPerspective) { 82 classie.remove(document.documentElement, 'md-perspective'); 83 } 84 } 85 86 function removeModalHandler() { 87 removeModal(classie.has(el, 'md-setperspective')); 88 } 89 } 90 init(); 91})(); 92 93 94// =================================================================================== 95// ================================ TIMEOUT COUNTDOWN ================================ 96// =================================================================================== 97var timeoutSoftAlertTimer; 98var timeoutSoftAlertTimerInterval = 1000; 99var timeoutSoftAlertTimerTotalPlay = 40; 100var timeoutSoftAlertTimeCurrentPlay = timeoutSoftAlertTimerTotalPlay; 101var tabTitleNormal = document.title; 102var tabTitleAlert = "!! TIMEOUT ALERT !!"; 103 104 105function timeoutSoftAlertIntervalFinished() { 106 107 if (timeoutSoftAlertTimer !== null) { 108 debugConsoleOutput("timeout::timeoutSoftAlertIntervalFinished", "retimeoutSoftAlertIntervalFinished", timeoutOutputToConsole); 109 $("#divTimer").html(timeoutSoftAlertTimeCurrentPlay); 110 111 if ((timeoutSoftAlertTimeCurrentPlay % 2) !== 0) { 112 document.title = tabTitleNormal; 113 } else { 114 document.title = tabTitleAlert; 115 } 116 117 if (timeoutSoftAlertTimeCurrentPlay == 0) { 118 timeoutCancelSoftAlertTimer(); 119 120 // 2020-07-16 - clearing the toggleInactivityTimeout 121 debugConsoleOutput("timeout::timeoutSoftAlertIntervalFinished", "toggleInactivityTimeout flag set to TRUE.", true); 122 SNPlayer.toggleInactivityTimeout(true); 123 playerChangeState('Stop'); 124 125 timeoutPlayBeep('soft_alert'); 126 } else if (timeoutSoftAlertTimeCurrentPlay > 0) { 127 128 if (timeoutSoftAlertTimeCurrentPlay == 40 || timeoutSoftAlertTimeCurrentPlay == 20 || timeoutSoftAlertTimeCurrentPlay < 11 && timeoutSoftAlertTimeCurrentPlay >= 0) { 129 timeoutPlayBeep('soft_alert'); 130 } 131 timeoutSoftAlertTimeCurrentPlay = timeoutSoftAlertTimeCurrentPlay - 1; 132 debugConsoleOutput("timeout::timeoutSoftAlertIntervalFinished", "timeoutSoftAlertTimeCurrentPlay count is " + timeoutSoftAlertTimeCurrentPlay, timeoutOutputToConsole); 133 //timeoutSoftAlertTimerInterval = 1000; 134 timeoutStreamTimer = setTimeout("timeoutSoftAlertIntervalFinished()", timeoutSoftAlertTimerInterval); 135 } 136 } 137} 138 139function timeoutPlayBeep(filename) { 140 debugConsoleOutput("timeout::timeoutPlayBeep", "timeoutPlayBeep", timeoutOutputToConsole); 141 var mp3Source = '<source src="/sounds/' + filename + '.mp3" type="audio/mpeg">'; 142 var oggSource = '<source src="/sounds/' + filename + '.ogg" type="audio/ogg">'; 143 var wavSource = '<source src="/sounds/' + filename + '.wav" type="audio/wav">'; 144 var embedSource = '<embed hidden="true" autostart="true" loop="false" src="/sounds/' + filename + '.mp3">'; 145 document.getElementById("TimeoutSound").innerHTML = '<audio autoplay="autoplay">' + mp3Source + oggSource + wavSource + embedSource + '</audio>'; 146} 147 148function timeoutCancelSoftAlertTimer() { 149 clearTimeout(timeoutSoftAlertTimer); 150 timeoutSoftAlertTimer = null; 151 debugConsoleOutput("timeout::timeoutCancelSoftAlertTimer", "Cancelling softalert timer. timeoutSoftAlertTimer = " + timeoutSoftAlertTimer, timeoutOutputToConsole); 152 timeoutSoftAlertTimeCurrentPlay = timeoutSoftAlertTimerTotalPlay; 153 debugConsoleOutput("timeout::timeoutCancelSoftAlertTimer", "timeoutSoftAlertTimeCurrentPlay reset to " + timeoutSoftAlertTimeCurrentPlay, timeoutOutputToConsole); 154} 155 156// =================================================================================== 157// ================================ TIMEOUT REPORTING ================================ 158// =================================================================================== 159var timeoutLastTimeoutPromptTransmitted = 0 160 161function timeoutUpdateLastTimeoutTransmitted() { 162 var currentDate = new Date(); 163 var currentMilliseconds = currentDate.getTime(); 164 165 timeoutLastTimeoutPromptTransmitted = currentMilliseconds; 166 debugConsoleOutput("timeout::timeoutUpdateLastTimeoutTransmitted", "timeoutLastTimeoutPromptTransmitted set to: " + timeoutLastTimeoutPromptTransmitted, true); 167} 168 169 170function timeoutUpdatePromptCount() { 171 try { 172 var currentDate = new Date(); 173 var currentMilliseconds = currentDate.getTime(); 174 var dur_min = stationGetStationSetting('timeoutduration'); 175 var dur_mls = dur_min * 60000; 176 177 debugConsoleOutput("timeout::timeoutUpdatePromptCount", "currentMilliseconds: " + currentMilliseconds, true); 178 debugConsoleOutput("timeout::timeoutUpdatePromptCount", "timeoutLastTimeoutPromptTransmitted: " + timeoutLastTimeoutPromptTransmitted, true); 179 180 if (currentMilliseconds - timeoutLastTimeoutPromptTransmitted < dur_mls - 2000) { 181 debugConsoleOutput("timeout::timeoutUpdatePromptCount", "FAKE timeout", true); 182 } else { 183 // OK to transmit 184 debugConsoleOutput("timeout::timeoutUpdatePromptCount", "OK to report timeout", true); 185 var _playertype = "Desktop"; 186 if (stationGetBrowserSetting("BrowserIsMobileDevice") === true) { 187 _playertype = "MobilePlayer"; 188 } 189 var dur_min = stationGetStationSetting('timeoutduration'); 190 var timeoutreportingurl = "/BBridge.asmx/UpdateTimeoutPromptCount?call=" + gStationCallLetters + "&accesskey=" + gStationAccessKey + "&promptcount=1" + "&playertype=" + _playertype + "&timeoutduration=" + dur_min + "&ip=" + gIp + "&uid=" + gUID + "&debug=false"; 191 debugConsoleOutput("timeout::timeoutUpdatePromptCount", timeoutreportingurl, true); 192 $.get(timeoutreportingurl); 193 timeoutUpdateLastTimeoutTransmitted(); 194 } 195 } catch (e) { 196 debugConsoleOutput("timeout::timeoutUpdatePromptCount", "ERROR: " + e, true, 2); 197 } 198} 199 200 201function timeoutUpdatePositiveResponseCount() { 202 try { 203 var _playertype = "Desktop"; 204 if (stationGetBrowserSetting("BrowserIsMobileDevice") === true) { 205 _playertype = "MobilePlayer"; 206 } 207 var dur_min = stationGetStationSetting('timeoutduration'); 208 var timeoutreportingurl = "/BBridge.asmx/UpdateTimeoutPositiveResponseCount?call=" + gStationCallLetters + "&accesskey=" + gStationAccessKey + "&positiveresponsecount=1" + "&playertype=" + _playertype + "&timeoutduration=" + dur_min + "&ip=" + gIp + "&uid=" + gUID + "&debug=false"; 209 debugConsoleOutput("timeout::timeoutUpdatePositiveRespopnseCount", timeoutreportingurl, true); 210 $.get(timeoutreportingurl); 211 } catch (e) { 212 debugConsoleOutput("timeout::timeoutUpdatePositiveRespopnseCount", "ERROR: " + e, true, 2); 213 } 214}
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.