PageSourceSearch

https://ipulidaho.org/wp-content/plugins/opening-hours/wp/js/js.js?ver=7.0.6

js ipulidaho.org collected 2026-09-24 12:55:59 UTC 8,547 bytes, 268 lines download raw bytes

1// JavaScript Document
2
3function we_are_open(action, index) {
4	if (typeof action == 'undefined') {
5		var action = 'init';
6	}
7	
8	if (typeof index == 'object' && index != null) {
9		var indexes = index;
10		index = null;
11	}
12	else if (typeof index != 'number') {
13		var index = null;
14	}
15	
16	var data = {},
17		ajax_data = {},
18		html = '',
19		e = null,
20		indexes = (typeof indexes == 'object') ? indexes : [],
21		elements = [],
22		reload_check = false;
23	
24	if (index != null && jQuery('.opening-hours.update, .opening-hours-conditional.update').length) {
25		e = jQuery('.opening-hours.update, .opening-hours-conditional.update').eq(index);
26		data = (typeof e == 'object' && e != null && jQuery(e).length && typeof jQuery(e).data('data') == 'object' && jQuery(e).data('data') != null) ? jQuery(e).data('data') : {};
27	}
28
29	switch (action)
30	{
31	case 'init':
32		if (!jQuery('.opening-hours.update, .opening-hours-conditional.update').length) {
33			return;
34		}
35		
36		indexes = [];
37		
38		jQuery('.opening-hours.update, .opening-hours-conditional.update').each(function(index) {
39			indexes[index] = null;
40			
41			if (typeof jQuery(this).data('data') != 'object' || jQuery(this).data('data') == null) {
42				return;
43			}
44
45			if (!reload_check && typeof jQuery(this).data('data') == 'object' && (jQuery(this).hasClass('reload') || typeof jQuery(this).data('data').reload == 'boolean' && jQuery(this).data('data').reload)) {
46				reload_check = true;
47				data = jQuery(this).data('data');
48				setTimeout(function() { we_are_open('reload', index); }, data.change * 1000);
49				return false;
50			}
51			
52			data = jQuery(this).data('data');
53			
54			if (jQuery(this).hasClass('opening-hours-conditional')) {
55				if (typeof data.immediate == 'boolean' && data.immediate) {
56					indexes[index] = 1;
57				}
58				else if (typeof data.change == 'number' && data.change > 0 && data.change <= 129600) {
59					indexes[index] = (data.change >= 3600) ? 3600000 : data.change * 1000;
60				}
61				
62				return;
63			}
64			
65			if (typeof data.immediate == 'boolean' && data.immediate) {
66				indexes[index] = 1;
67			}
68			else if (typeof data.change == 'number' && data.change > 0 && data.change <= 86400) {
69				indexes[index] = data.change * 1000;
70			}
71
72			return;
73		});
74		
75		if (reload_check) {
76			return;
77		}
78		
79		for (index in indexes) {
80			if (indexes[index] != null) {
81				setTimeout(function() { we_are_open('update', indexes); }, Math.min.apply(null, indexes.filter(Boolean)));
82				break;
83			}
84		}
85		
86		return;
87	case 'reload':
88		if (e == null || index == null || !jQuery('.opening-hours.update, .opening-hours-conditional.update').length || index > jQuery('.opening-hours.update, .opening-hours-conditional.update').length - 1 || typeof data != 'object' || (!jQuery(e).hasClass('reload') && (typeof data.reload != 'boolean' || typeof data.reload == 'boolean' && !data.reload))) {
89			return;
90		}
91	
92		document.location.reload();
93		return;
94	case 'update':
95		if (typeof indexes != 'object' || indexes == null || !indexes.length || !jQuery('.opening-hours.update, .opening-hours-conditional.update').length || indexes.length != jQuery('.opening-hours.update, .opening-hours-conditional.update').length) {
96			return;
97		}
98
99		jQuery('.opening-hours.update, .opening-hours-conditional.update').each(function(index) {
100			if (!(index in indexes) || indexes[index] == null) {
101				return;
102			}
103			
104			data = (typeof jQuery(this).data('data') == 'object' && jQuery(this).data('data') != null) ? jQuery(this).data('data') : {};
105			
106			if (!reload_check && jQuery(this).hasClass('reload') || typeof data.reload == 'boolean' && data.reload) {
107				reload_check = true;
108				we_are_open('reload', index);
109				return false;
110			}
111
112			if (jQuery(this).hasClass('opening-hours-conditional')) {
113				elements[index] = {
114					action: 'update',
115					classes: (typeof data.classes == 'object') ? data.classes : [],
116					parameters: null,
117					content: null
118				};
119				return;
120			}
121			
122			elements[index] = {
123				action: 'refresh',
124				classes: jQuery(this).attr('class').split(' '),
125				parameters: (typeof data.parameters == 'object') ? data.parameters : {},
126				content: (typeof data.content == 'string') ? data.content : null
127			};
128		});
129		
130		if (reload_check) {
131			return;
132		}
133		
134		ajax_data = {
135			action: 'we_are_open_wp_ajax',
136			type: action,
137			elements: elements
138		};
139		 
140		jQuery.post(we_are_open_wp_ajax.url, ajax_data, function(response) {
141			data = {};
142			html = '';
143			
144			if (response.success) {
145				indexes = [];
146				
147				jQuery('.opening-hours.update, .opening-hours-conditional.update').each(function(index) {
148					indexes[index] = null;
149					
150					if (!(index in response.elements)) {
151						return;
152					}
153					
154					if (jQuery(this).hasClass('opening-hours-conditional')) {
155						if (typeof jQuery(this).data('data') != 'object' || typeof jQuery(this).data('data') == 'object' && jQuery(this).data('data') == null) {
156							return;
157						}
158							
159						data = jQuery(this).data('data');
160						
161						if (typeof data.html == 'undefined') {
162							return;
163						}
164						
165						html = (typeof data.html == 'string' && data.html.length) ? data.html : null;
166		
167						data.change = parseInt(response.elements[index].seconds_to_change);
168						data.closed_now = response.closed_now;
169						data.content = (typeof response.content == 'string') ? response.content : null;
170						data.open_now = response.open_now;
171						
172						if ((data.closed != response.closed_now || data.open != response.open_now) && (html == null || !data.remove_html)) {
173							if (data.remove_html) {
174								data.html = jQuery(this).html();
175								jQuery(this).html('');
176							}
177							
178							if (data.hide && !jQuery(this).hasClass('hide')) {
179								jQuery(this).removeClass('show');
180								jQuery(this).addClass('hide');
181							}
182						}
183						else if ((data.open == response.open_now || data.closed == response.closed_now) && (html != null || !data.remove_html)) {
184							if (data.remove_html) {
185								data.html = null;
186								jQuery(this).html('');
187							}
188							
189							jQuery(this).data('data', data);
190
191							if (data.hide && jQuery(this).hasClass('hide')) {
192								jQuery(this).removeClass('hide');
193								jQuery(this).addClass('show');
194							}
195						}
196						
197						if (typeof data.change == 'number' && data.change > 0 && data.change <= 86400) {
198							indexes[index] = (data.change >= 3600) ? 3600000 : data.change * 1000;
199						}
200						
201						return;
202					}
203					
204					if (jQuery(this).hasClass('opening-hours')) {
205						data = (typeof response.elements[index] == 'object') ? response.elements[index] : {};
206						jQuery(this)
207							.data('data', {
208								change: data.seconds_to_change,
209								closed_now: !response.open_now,
210								content: (typeof data.html == 'string') ? data.content.replace(/\\(\')/gi, '$1') : null,
211								parameters: data.parameters,
212								open_now: response.open_now,
213								reload: data.reload
214							})
215							.html((typeof data.html == 'string') ? data.html.replace(/\\(\')/gi, '$1') : '');
216							
217							if (response.open_now) {
218								jQuery(this).removeClass('closed-now').addClass('open-now');
219							}
220							else {
221								jQuery(this).removeClass('open-now').addClass('closed-now');
222							}
223							
224						if (typeof data.seconds_to_change == 'number' && data.seconds_to_change > 0 && data.seconds_to_change <= 86400) {
225							indexes[index] = data.seconds_to_change * 1000;
226						}
227						
228						return;
229					}
230						
231					if (typeof jQuery(this).data('data') != 'object' || jQuery(this).data('data') == null) {
232						return;
233					}
234			
235					if (!reload_check && typeof jQuery(this).data('data') == 'object' && (jQuery(this).hasClass('reload') || typeof jQuery(this).data('data').reload == 'boolean' && jQuery(this).data('data').reload)) {
236						reload_check = true;
237						data = jQuery(this).data('data');
238						setTimeout(function() { we_are_open('reload', index); }, data.change * 1000);
239						return false;
240					}
241			
242					return;
243				});
244				
245				if (reload_check) {
246					return;
247				}
248
249				for (index in indexes) {
250					if (indexes[index] != null) {
251						setTimeout(function() { we_are_open('update', indexes); }, Math.min.apply(null, indexes.filter(Boolean)));
252						break;
253					}
254				}
255				
256			}
257			
258		}, 'json');
259
260		return;
261	}
262	return;
263}
264
265jQuery(document).ready(function($){
266	we_are_open();
267	return;
268});

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.