PageSourceSearch

https://www.netsafeutah.org/js/highlights.js

js netsafeutah.org collected 2026-09-24 12:52:25 UTC 9,327 bytes, 256 lines download raw bytes

1var highlights_interval = 7000; // 7 seconds
2
3var current_highlight = -1;
4var highlights_timer = 0;
5var highlights_timer_bar = 0;
6var highlight_time = 0;
7
8function highlights_next()
9{
10	next_highlight = current_highlight + 1;
11	if (next_highlight >= highlights.length)
12	{
13		next_highlight = 0;
14	}
15	show_highlight(next_highlight);
16	return false;
17}
18
19function highlights_prev()
20{
21	prev_highlight = current_highlight - 1;
22	if (prev_highlight < 0)
23	{
24		prev_highlight = highlights.length - 1;
25	}
26	show_highlight(prev_highlight);
27	return false;
28}
29
30function get_image_path(image)
31{
32	if (image.substr(0, 7) != 'https://')
33	{
34		image = '/images/highlight/images/' + image;
35	}
36	return image;
37}
38
39function show_highlight(i)
40{
41	highlight_time = 0;
42	if (current_highlight >= 0)
43	{
44		$('.highlights-box img.bottom-img').attr('src', get_image_path(highlights[current_highlight].image));
45	}
46	$('.highlights-box img.top-img').hide();
47	if (highlights_timer !== 0)
48	{
49		clearTimeout(highlights_timer);
50		highlights_timer = setTimeout('highlights_next()', highlights_interval);
51	}
52	$('.highlight-indicator a').removeClass('active');
53	$('.highlights-menu li:nth-child(' + (i + 3) + ') a').addClass('active');
54	$('.highlights-box h4').html(highlights[i].heading);
55	$('.highlights-box img.top-img').attr('src', get_image_path(highlights[i].image)).fadeIn(500);
56	if (highlights[i].image_link != null)
57	{
58		$('.highlights-box img.top-img').css({ cursor: 'pointer' }).unbind('click').click(function () { 
59
60			is_video = /\.(f4v|mp4|mov)$/
61			
62			if (is_video.test(highlights[i].image_link)) {
63			
64				// open it using Fancybox and Kaltura if possible...
65				if(highlights[i].entry_id) {
66					content_code = getEmbedCode(highlights[i].entry_id,highlights[i].heading);
67					$.fancybox.open(content_code);
68				}
69				
70				// ...otherwise use ShadowBox and JWPlayer...
71				else {
72					
73					
74					// set defaults...
75					image_player = 'flv';
76					image_width = 500;
77					image_height = 375;
78					video_file = highlights[i].image_link;
79					use_cc_files = true;
80					
81					// iPad...
82					 if(navigator.userAgent.match(/iPad/i)) { 
83						image_player = 'qt';
84						use_cc_files = false;
85					 } 
86					
87					// iPhone...
88					 if(navigator.userAgent.match(/iPhone/i)) { 
89						image_player = 'qt';
90						use_cc_files = false;
91						
92						// don't use Shadowbox...
93						location.href = highlights[i].image_link;
94						return false;
95					 } 
96						
97					// Android...
98					 if(navigator.userAgent.match(/android/i)) { 
99						image_player = 'flv'; // force use of Flash player
100						
101						// don't use Shadowbox...
102						location.href = highlights[i].image_link;
103						return false;
104					 } 
105					
106					// "NetSafe Clips - Cell Phone & Photos" is a different size...
107					if(highlights[i].image_link == 'https://eq.uen.org/emedia/items/5eb04aff-d716-5621-8f75-46716875b3de/1/1-CellPhones_Photos_iPhone.mp4') {
108						image_width = 640;
109						image_height = 360;
110					}
111					
112					// Closed Captioned videos need extra variables...
113					if(use_cc_files) {
114	
115						switch (video_file)
116						{
117							// "What is the Internet?"
118							case 'https://eq.uen.org/emedia/items/0b77d543-e0ba-4d79-e710-fff71e5c2a80/1/uen1-final_high_QTCC.mp4':
119								video_file = 'https://eq.uen.org/emedia/items/0b77d543-e0ba-4d79-e710-fff71e5c2a80/1/uen1-final_high_QTCC.mp4&captions.file=caption_files/uen1-final_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
120								break;
121							
122							// "What is Personal Information?"
123							case 'https://eq.uen.org/emedia/items/c90d746d-cf5c-a7db-d95e-338bc493a9cb/1/uen2-final_high_QTCC.mp4':
124								video_file = 'https://eq.uen.org/emedia/items/c90d746d-cf5c-a7db-d95e-338bc493a9cb/1/uen2-final_high_QTCC.mp4&captions.file=caption_files/uen2-final_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
125								
126								break;
127								
128							// "Tell an Adult"
129							case 'https://eq.uen.org/emedia/items/48d6aa51-8bd5-85d4-998e-d03c161fef2a/1/uen3-final_high_QTCC.mp4':
130								video_file = 'https://eq.uen.org/emedia/items/48d6aa51-8bd5-85d4-998e-d03c161fef2a/1/uen3-final_high_QTCC.mp4&captions.file=caption_files/uen3-final_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
131								break;
132								
133							// "Be Kind Online"
134							case 'https://eq.uen.org/emedia/items/672796eb-1ba4-5f35-bc69-9fab854bd74e/1/uen4-final_high_QTCC.mp4':
135								video_file = 'https://eq.uen.org/emedia/items/672796eb-1ba4-5f35-bc69-9fab854bd74e/1/uen4-final_high_QTCC.mp4&captions.file=caption_files/uen4-final_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
136								break;
137								
138							// "Cyber Bullies are No Fun"
139							case 'https://eq.uen.org/emedia/items/f9def275-e58b-e27b-36e4-c464f980b51e/1/uen5-final-02_high_QTCC.mp4':
140								video_file = 'https://eq.uen.org/emedia/items/f9def275-e58b-e27b-36e4-c464f980b51e/1/uen5-final-02_high_QTCC.mp4&captions.file=caption_files/uen5-final-02_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
141								break;
142								
143							// "What is Personal Information?"
144							case 'https://eq.uen.org/emedia/items/8b92e276-5fd9-4b3c-b1b5-b02dba77ecdc/1/UEN6-fc-03_high_QTCC.mp4':
145								video_file = 'https://eq.uen.org/emedia/items/8b92e276-5fd9-4b3c-b1b5-b02dba77ecdc/1/UEN6-fc-03_high_QTCC.mp4&captions.file=caption_files/UEN6-fc-03_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
146								break;
147								
148							// "Online 'Friends'"
149							case 'https://eq.uen.org/emedia/items/b01fdd48-d39a-4f87-b07d-87200ef66de3/1/UEN7-fc-03_high.mp4':
150								video_file = 'https://eq.uen.org/emedia/items/b01fdd48-d39a-4f87-b07d-87200ef66de3/1/UEN7-fc-03_high.mp4&captions.file=caption_files/UEN7-fc-03_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
151								break;
152								
153							// "Talk to an Adult You Trust"
154							case 'https://eq.uen.org/emedia/items/972413c7-764c-4434-ac2e-2164ff327f08/1/UEN8-fc-02_high.mp4':
155								video_file = 'https://eq.uen.org/emedia/items/972413c7-764c-4434-ac2e-2164ff327f08/1/UEN8-fc-02_high.mp4&captions.file=caption_files/UEN8-fc-02_high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
156								break;
157								
158							// "Posting Pictures Online"
159							case 'https://eq.uen.org/emedia/items/9b25c8e7-deea-4b7c-b3ef-5f9b90d447e8/1/UEN9-fc-03_high.mp4':
160								video_file = 'https://eq.uen.org/emedia/items/9b25c8e7-deea-4b7c-b3ef-5f9b90d447e8/1/UEN9-fc-03_high.mp4&captions.file=caption_files/UEN9-fc-03_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
161								break;
162								
163							// "Information about NetSafe Utah"
164							case 'https://eq.uen.org/emedia/items/ceb0f137-3041-4b52-843b-3d9e5911dfec/1/UEN1
1645-fc-02_qt-high_QTCC.mp4':
165								video_file = 'https://eq.uen.org/emedia/items/ceb0f137-3041-4b52-843b-3d9e5911dfec/1/UEN15-fc-02_qt-high_QTCC.mp4&captions.file=caption_files/UEN15-fc-02_qt-high_Out.xml&plugins=captions-1&captions.state=false&autostart=true';
166								break;
167							
168						}
169					
170					}
171					
172					Shadowbox.open({ 
173						player: image_player, 
174						content: video_file, 
175						width: image_width, 
176						height: image_height
177					});
178				}
179				
180			}
181			
182			else {
183				document.location = highlights[i].image_link
184			}
185			
186			
187		});
188	}
189	else
190	{
191		$('.highlights-box img.top-img').css({ cursor: '' }).unbind('click');
192	}
193	$('.highlights-box .highlight-text').html(highlights[i].text);
194	current_highlight = i;
195	return false;
196}
197
198function update_time_bar()
199{
200	$('.highlights-timer div').css({ width: ((highlight_time/highlights_interval)*100) + '%' });
201	highlight_time = highlight_time + 50;
202}
203
204function highlights_play()
205{
206	highlights_next();
207	//$('.highlights-timer').show();
208	$('.highlight-play a').css({ backgroundImage: 'url(/images/highlight/btn-pause.gif)' })
209	highlights_timer = setTimeout('highlights_next()', highlights_interval);
210	//update_time_bar();
211	//highlights_timer_bar = setInterval('update_time_bar()', 50);
212	return false;
213}
214
215function highlights_pause()
216{
217	//$('.highlights-timer').hide();
218	highlight_time = 0;
219	//clearInterval(highlights_timer_bar);
220	$('.highlight-play a').css({ backgroundImage: 'url(/images/highlight/btn-play.gif)' })
221	clearTimeout(highlights_timer);
222	highlights_timer = 0;
223	return false;
224}
225
226$(document).ready(function()
227{	
228	// get first box id
229	code = $('.highlights-box:first').attr('id');
230	
231	// get highlights
232	$.getJSON('/tools/highlights_data.php', 'code=' + code, function (data)
233	{
234		highlights = data;
235		
236		// create slide indicators and preload images
237		insert_after = $('.highlight-prev');
238		for (i=0; i<highlights.length; i++)
239		{
240			insert_after.after('<li class="highlight-indicator"><a href="" aria-label="highlight"><span>' + (i + 1) + '</span></a></li>');
241			insert_after = $('.highlight-indicator:last');
242			$('<img>').attr('src', get_image_path(highlights[i].image));
243		}
244		
245		// set event handlers for menu
246		$('.highlight-prev a').click(highlights_prev);
247		$('.highlight-next a').click(highlights_next);
248		$('.highlight-play a').toggle(highlights_pause, highlights_play);
249		$('.highlight-indicator a').click(function() { show_highlight(($(this).find('span').html() - 1)); return false; });
250		
251		// hide loader
252		$('.highlights-loading').fadeOut(100);
253		$('.highlights-menu').fadeIn(100);
254		highlights_play();
255	});	
256});

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.