1/* -------------------- */ 2/* Radio Station Script */ 3/* -------------------- */ 4 5/* Smooth Scrolling */ 6function radio_scroll_to(id) { 7 elem = document.getElementById(id); 8 var jump = parseInt((elem.getBoundingClientRect().top - 50) * .2); 9 document.body.scrollTop += jump; 10 document.documentElement.scrollTop += jump; 11 if (!elem.lastjump || elem.lastjump > Math.abs(jump)) { 12 elem.lastjump = Math.abs(jump); 13 setTimeout(function() { radio_scroll_to(id);}, 100); 14 } else {elem.lastjump = null;} 15} 16 17/* Get Day of Week */ 18function radio_get_weekday(d) { 19 if (d == '0') {day = 'sunday';} 20 else if (d == '1') {day = 'monday';} 21 else if (d == '2') {day = 'tuesday';} 22 else if (d == '3') {day = 'wednesday';} 23 else if (d == '4') {day = 'thursday';} 24 else if (d == '5') {day = 'friday';} 25 else if (d == '6') {day = 'saturday';} 26 return day; 27} 28 29/* Cookie Value Function */ 30/* since @2.3.2 */ 31radio_cookie = { 32 set: function (name, value, days) { 33 if (days) { 34 var date = new Date(); 35 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 36 var expires = '; expires=' + date.toUTCString(); 37 } else {var expires = '';} 38 document.cookie = 'radio_' + name + '=' + JSON.stringify(value) + expires + '; path=/'; 39 }, 40 get : function(name) { 41 var nameeq = 'radio_' + name + '=', ca = document.cookie.split(';'); 42 for(var i=0; i < ca.length; i++) { 43 var c = ca[i]; 44 while (c.charAt(0) == ' ') { 45 c = c.substring(1,c.length); 46 if (c.indexOf(nameeq) == 0) { 47 /* 2.5.0: fix for possible empty value */ 48 value = c.substring(nameeq.length, c.length).trim(); 49 if ((value == '') || (value == 'undefined') || (typeof value == 'undefined')) {return null;} 50 return JSON.parse(value); 51 } 52 } 53 } 54 return null; 55 }, 56 delete : function(name) { 57 document.cookie = 'radio_' + name + '=; expires=-1; path=/'; 58 } 59} 60 61/* Debounce Delay Callback */ 62var radio_resize_debounce = (function () { 63 var debounce_timers = {}; 64 return function (callback, ms, uniqueId) { 65 if (!uniqueId) {uniqueId = "nonuniqueid";} 66 if (debounce_timers[uniqueId]) {clearTimeout (debounce_timers[uniqueId]);} 67 debounce_timers[uniqueId] = setTimeout(callback, ms); 68 }; 69})(); 70 71/* User Timezone Display */ 72function radio_timezone_display() { 73 if (typeof radio_display_override == 'function') { 74 override = radio_display_override(); 75 if (override) {return;} 76 } 77 if (jQuery('.radio-user-timezone').length) { 78 userdatetime = new Date(); 79 useroffset = -(userdatetime.getTimezoneOffset()); 80 if ((useroffset * 60) == radio.timezone.offset) {return;} 81 if (typeof jstz == 'function') {tz = jstz.determine().name();} 82 else {tz = Intl.DateTimeFormat().resolvedOptions().timeZone;} 83 if (tz.indexOf('/') > -1) { 84 tz = tz.replace('/', ', '); tz = tz.replace('_',' '); 85 houroffset = parseInt(useroffset); 86 if (houroffset == 0) {userzone = ' [UTC]';} 87 else { 88 houroffset = houroffset / 60; 89 if (houroffset > 0) {tz += ' [UTC+'+houroffset+']';} 90 else {tz += ' [UTC'+houroffset+']';} 91 } 92 jQuery('.radio-user-timezone').html(tz).css('display','inline-block'); 93 jQuery('.radio-user-timezone-title').css('display','inline-block'); 94 } 95 } 96} 97 98/* Retrigger Responsive Schedules */ 99function radio_responsive_schedules() { 100 if (jQuery('#master-program-schedule').length) {radio_table_responsive(false,false);} 101 if (jQuery('#master-schedule-tabs').length) {radio_tabs_responsive(false,false);} 102 if (jQuery('#master-schedule-grid').length) {radio_grid_responsive(false);} 103 if (jQuery('#master-schedule-calendar').length) {radio_calendar_responsive(false);} 104} 105 106/* Update Time Displays */ 107function radio_convert_times() { 108 if (!radio.convert_show_times) {return;} 109 /* schedule: .show-time; widgets: .current-shift, .upcoming-show-schedule; show page: .show-shift-time, .override-time */ 110 jQuery('.show-time, .current-shift, .upcoming-show-shift, .override-time, .show-shift-time').each(function() { 111 start = jQuery(this).find('.rs-start-time'); 112 end = jQuery(this).find('.rs-end-time'); 113 starthtml = start.html(); starttime = start.attr('data'); startformat = start.attr('data-format'); 114 endhtml = end.html(); endtime = end.attr('data'); endformat = end.attr('data-format'); 115 startdisplay = radio_user_time(starttime, startformat); 116 enddisplay = radio_user_time(endtime, endformat); 117 if ((starthtml != startdisplay) || (endhtml != enddisplay)) { 118 if (radio.debug) {console.log('Start: '+starthtml+' => '+startdisplay+' - End: '+endhtml+' => '+enddisplay);} 119 showusertime = jQuery(this).parent().find('.show-user-time').show(); 120 showusertime.find('.rs-start-time').html(startdisplay); 121 showusertime.find('.rs-end-time').html(enddisplay); 122 } else {jQuery(this).parent().find('.show-user-time').hide();} 123 if (jQuery(this).find('.rs-start-date').length) { 124 date = jQuery(this).find('.rs-start-date'); 125 datehtml = date.html(); datetime = date.attr('data'); dateformat = date.attr('data-format'); 126 datedisplay = radio_user_time(datetime, dateformat); 127 if (datehtml == datedisplay) {datedisplay = '';}
128 if (radio.debug) {console.log('Date: '+datehtml+' => '+datedisplay);} 129 showusertime = jQuery(this).parent().find('.show-user-time'); 130 showusertime.find('.rs-start-date').html(datedisplay); 131 } 132 }); 133 radio_responsive_schedules(); 134} 135 136/* Convert To Time Display */ 137function radio_user_time(time, format) { 138 if (typeof radio_user_override == 'function') { 139 override = radio_user_override(time, format); 140 if (override) {return override;} 141 } 142 datetime = new Date(time * 1000); 143 zonetime = moment(datetime.toISOString()); 144 formatted = radio_convert_time(zonetime, format); 145 return formatted; 146} 147 148/* Convert Time to Formatted Time */ 149function radio_convert_time(zonetime, format) { 150 formatted = ''; 151 for (var i = 0; i < format.length; i++) { 152 k = format.charAt(i); 153 v = radio_format_key(zonetime, k); 154 formatted += v; 155 } 156 return formatted; 157} 158 159/* Format Time Key */ 160function radio_format_key(zonetime, key) { 161 v = key; 162 for (i in radio.moment_map) { 163 if (i == key) { 164 k = radio.moment_map[i]; 165 v = zonetime.format(k); 166 if (((i == 'd') || (i == 'm') || (i == 'h') || (i == 'H') || (i == 'i') || (i == 's')) && (v < 10)) {v = '0'+v;} 167 else if (i == 'D') {v = radio.labels.sdays[v];} 168 else if (i == 'l') {v = radio.labels.days[v];} 169 else if (i == 'N') {v++;} 170 else if (i == 'S') {d = zonetime.format('D'); v.replace(d, '');} 171 else if (i == 'F') {v = radio.labels.months[v];} 172 else if (i == 'M') {v = radio.labels.smonths[v];} 173 else if ((i == 'a') || (i == 'A')) { 174 if (v.substr(0,1) == 'a') {v = radio.units.am;} 175 if (v.substr(0,1) == 'p') {v = radio.units.pm;} 176 if (i == 'A') {v = v.toUpperCase();} 177 } 178 } 179 } 180 return v; 181} 182 183/* Pageload Function */ 184if (typeof jQuery == 'function') { 185 jQuery(document).ready(function() { 186 radio_timezone_display(); 187 radio_convert_times(); 188 }); 189}
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.