PageSourceSearch

https://orgull.cat/wp-content/plugins/radio-station/js/radio-station.js?ver=1630514035

js orgull.cat collected 2026-10-02 13:23:53 UTC 6,650 bytes, 186 lines download raw bytes

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

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.