PageSourceSearch

https://vasarnapihirek.hu/scripts/ads.topnews.js

js vasarnapihirek.hu collected 2026-10-02 11:49:21 UTC 12,927 bytes, 421 lines download raw bytes

1/**
2 * jQuery.topnews
3 * Copyright (c) 2010-2013 Artistokrats Design Studio - info(at)artistokrats(dot)com | http://artistokrats.com
4 * Dual licensed under MIT and GPL.
5 * Date: 30/09/2013
6 *
7 * @projectDescription Hírtop slider.
8 *
9 * @author Artistokrats Design Studio
10 * @version 3.0b
11**/
12
13
14
15var topnews_timing = 0, 
16	topnews_autoplay_delay = 7500, // default: 10000 – a slide-ok közötti várakozási idő
17	topnews_current = 0, 
18	topnews_sliding_speed = 800, 
19	topnews_sliding_effect = 'easeInOutCirc', 
20	topnews_swipeOptions = {
21		swipe: function( event, direction, distance, duration, fingerCount ) {
22			if ( direction.search('left') != -1 ) { topnews_sliding( 39, '', 'off' ); }
23			else if ( direction.search('right') != -1 ) { topnews_sliding( 37, '', 'off' ); }
24		},
25		threshold: 100, 
26		allowPageScroll: 'none'
27	};
28
29
30
31function topnews_speed_limit() {
32	top_news_browser = 'modern';
33
34	if (BrowserDetect.browser == 'Explorer') {
35		top_news_browser = 'old';
36	}
37	
38	else if (BrowserDetect.browser == 'Firefox') {
39		if (BrowserDetect.version < 4 || BrowserDetect.version == 'an unknown version') { top_news_browser = 'old'; }
40	}
41	
42	else if (BrowserDetect.browser == 'Opera') {
43		if (BrowserDetect.version < 10.6 || BrowserDetect.version == 'an unknown version') {
44			top_news_browser = 'old';
45		}
46	}
47	
48	else if (BrowserDetect.browser == 'Safari') {
49		if (BrowserDetect.version < 4 || BrowserDetect.version == 'an unknown version') { top_news_browser = 'old'; }
50	}
51
52	/*if ( top_news_browser == 'modern' ) { */return topnews_sliding_speed; /*}
53	else { return 0; }*/
54}
55
56
57
58$(function() {
59	var rovat_id = cikk_id = 0;
60
61	if ( $('.topnews-container').length > 0 ) {
62		$(document).bind('keyup', function(e) { topnews_sliding( e, 'keyCode', 'off' ); });
63		topnews_swiping_init();
64		topnews_timer( 0, topnews_autoplay_delay-100 );
65		topnews_autoplay();
66
67		resize_topnews_controllers();
68		topnews_resize_content();
69	}
70});
71
72
73
74function topnews_resize_content() {
75	if ( $('.topnews-container').length > 0 ) {
76		$tnimg = $('.tn-image');
77
78		if ( $(window).width() >= 960 ) {
79			$('.tn-info').css({ 'margin-left': 170, 'width': 310, 'height': 'auto' });
80		}
81
82		if ( $(window).width() < 960 ) {
83			$('.tn-info').css({
84				'margin-left': -( ($tnimg.width()-10) / 2 ), 
85				'width': $tnimg.width() - 20, 
86				'height': $tnimg.height() - 10 
87			});
88		}
89	}
90}
91
92
93
94$(window).resize(function() {
95	resize_topnews_controllers();
96	topnews_resize_content();
97});
98
99
100
101function topnews_swiping_init() {
102	if ( /android|iphone|ipod|ipad|blackberry|webos|iemobile|opera mini/g.test( navigator.userAgent.toLowerCase() ) ) {
103		$('.topnews').swipe( topnews_swipeOptions );
104	}
105}
106
107
108
109function topnews_sliding( e, is_keycode, autoplay_val ) {
110	if (is_keycode == 'keyCode') { var foo = e.keyCode; } else { var foo = e; }		// billentyűzetes és gombos navigáció együtt
111
112	if (foo == 37 || foo == 39) {
113		topnews_autoplay_stop();
114		topnews_disable_buttons();
115
116		var slides = $('.topnews'), 
117			distance = '150%';
118
119		if (autoplay_val == 'on') {
120			$('.tn-btn-pause').show(0);
121			$('.tn-btn-play').hide(0);
122		}
123
124
125		if (foo == 37) { // balra
126			var next = topnews_current - 1;
127
128			if (next > -1) {}
129			else {
130				var next = slides.length-1;
131				topnews_jumping_reorder_first();
132			}
133
134			
135			topnews_indicator( topnews_current, next, topnews_autoplay_delay );
136
137
138			if ( /android|iphone|ipod|ipad|blackberry|webos|iemobile|opera mini/g.test( navigator.userAgent.toLowerCase() ) == false ) {
139				if ( $(window).width() > 960 ) {
140					$divs = new Array( '.tn-icons', '.tn-image', '.tn-info', '.tn-issue', '.tn-cover' );
141					$divs.reverse();
142					divs_delay = 0;
143
144					for ( i = 0; i < $divs.length; i++ ) {
145						$( slides[next] ).find( $divs[i] ).css({ 'left': '-50%' });
146
147						$( slides[topnews_current] ).find($divs[i]).delay(divs_delay).animate({ 'left': '150%' }, topnews_speed_limit(), topnews_sliding_effect);
148						$( slides[next] ).find($divs[i]).delay(divs_delay).animate({ 'left': '50%' }, topnews_speed_limit(), topnews_sliding_effect);
149						divs_delay = divs_delay + 100;
150					}
151				}
152			}
153
154			
155			$( slides[topnews_current] ).animate({ 'left': distance, opacity: 0 }, topnews_speed_limit(), topnews_sliding_effect);
156			$( slides[next] ).animate({ 'left': '50%', opacity: 1 }, topnews_speed_limit(), topnews_sliding_effect, function() {
157				topnews_jumping_reorder( next );
158				topnews_enable_buttons( next );
159
160				if (autoplay_val == 'on') {
161					topnews_timer( next, topnews_autoplay_delay );
162					topnews_autoplay();
163				}
164				
165				return topnews_current = next;
166			});
167		}
168
169
170
171		else if (foo == 39) { // jobbra
172			var next = topnews_current + 1, 
173				distance = '-150%';
174
175			if (next < slides.length) {}
176			else {
177				var next = 0;
178				topnews_jumping_reorder_last();
179			}
180
181
182			topnews_indicator( topnews_current, next, topnews_autoplay_delay );
183
184
185			if ( /android|iphone|ipod|ipad|blackberry|webos|iemobile|opera mini/g.test( navigator.userAgent.toLowerCase() ) == false ) {
186				if ( $(window).width() > 960 ) {
187					$divs = new Array( '.tn-icons', '.tn-image', '.tn-info', '.tn-issue', '.tn-cover' );
188					divs_delay = 0;
189
190					for ( i = 0; i < $divs.length; i++ ) {
191						$( slides[next] ).find( $divs[i] ).css({ 'left': '150%' });
192
193						$( slides[topnews_current] ).find($divs[i]).delay(divs_delay).animate({ 'left': '-50%' }, topnews_speed_limit(), topnews_sliding_effect);
194						$( slides[next] ).find($divs[i]).delay(divs_delay).animate({ 'left': '50%' }, topnews_speed_limit(), topnews_sliding_effect);
195						divs_delay = divs_delay + 100;
196					}
197				}
198			}
199
200
201			$( slides[topnews_current] ).animate({ 'left': distance, opacity: 0 }, topnews_speed_limit(), topnews_sliding_effect);
202			$( slides[next] ).animate({ 'left': '50%', opacity: 1 }, topnews_speed_limit(), topnews_sliding_effect, function() {
203				topnews_jumping_reorder( next );
204				topnews_enable_buttons( next );
205
206				if (autoplay_val == 'on') {
207					topnews_timer( next, topnews_autoplay_delay );
208					topnews_autoplay();
209				}
210
211				return topnews_current = next;
212			});
213		}
214	} // if (foo == 37 || foo == 39)
215}
216
217
218
219function topnews_jumping( next, autoplay_val ) {
220	if (topnews_current != next) {
221		topnews_autoplay_stop();
222		topnews_disable_buttons();
223
224		var next = parseInt(next), 
225			slides = $('.topnews'), 
226			distance = '150%';
227
228
229		// kisebb
230		if (next < topnews_current) {
231			topnews_indicator( topnews_current, next, topnews_autoplay_delay );
232
233
234			if ( /android|iphone|ipod|ipad|blackberry|webos|iemobile|opera mini/g.test( navigator.userAgent.toLowerCase() ) == false ) {
235				if ( $(window).width() > 960 ) {
236					$divs = new Array( '.tn-icons', '.tn-image', '.tn-info', '.tn-issue', '.tn-cover' );
237					$divs.reverse();
238					divs_delay = 0;
239
240					for ( i = 0; i < $divs.length; i++ ) {
241						$( slides[next] ).find( $divs[i] ).css({ 'left': '-50%' });
242
243						$( slides[topnews_current] ).find($divs[i]).delay(divs_delay).animate({ 'left': '150%' }, topnews_speed_limit(), topnews_sliding_effect);
244						$( slides[next] ).find($divs[i]).delay(divs_delay).animate({ 'left': '50%' }, topnews_speed_limit(), topnews_sliding_effect);
245						divs_delay = divs_delay + 100;
246					}
247				}
248			}
249
250
251			$( slides[topnews_current] ).animate({ 'left': distance, opacity: 0 }, topnews_speed_limit(), topnews_sliding_effect);
252			$( slides[next] ).animate({ 'left': '50%', opacity: 1 }, topnews_speed_limit(), topnews_sliding_effect, function() {
253				topnews_jumping_reorder( next );
254				topnews_enable_buttons( next );
255
256				if (autoplay_val == 'on') {
257					topnews_timer( next, topnews_autoplay_delay );
258					topnews_autoplay();
259				}
260				
261				return topnews_current = next;
262			});
263		}
264
265
266		// nagyobb
267		else {
268			var distance = '-150%';
269
270			topnews_indicator( topnews_current, next, topnews_autoplay_delay );
271
272			
273			if ( /android|iphone|ipod|ipad|blackberry|webos|iemobile|opera mini/g.test( navigator.userAgent.toLowerCase() ) == false ) {
274				if ( $(window).width() > 960 ) {
275					$divs = new Array( '.tn-icons', '.tn-image', '.tn-info', '.tn-issue', '.tn-cover' );
276					divs_delay = 0;
277
278					for ( i = 0; i < $divs.length; i++ ) {
279						$( slides[next] ).find( $divs[i] ).css({ 'left': '150%' });
280
281						$( slides[topnews_current] ).find($divs[i]).delay(divs_delay).animate({ 'left': '-50%' }, topnews_speed_limit(), topnews_sliding_effect);
282						$( slides[next] ).find($divs[i]).delay(divs_delay).animate({ 'left': '50%' }, topnews_speed_limit(), topnews_sliding_effect);
283						divs_delay = divs_delay + 100;
284					}
285				}
286			}
287
288
289			$( slides[topnews_current] ).animate({ 'left': distance, opacity: 0 }, topnews_speed_limit(), topnews_sliding_effect);
290			$( slides[next] ).animate({ 'left': '50%', opacity: 1 }, topnews_speed_limit(), topnews_sliding_effect, function() {
291				topnews_jumping_reorder( next );
292				topnews_enable_buttons( next );
293
294				if (autoplay_val == 'on') {
295					topnews_timer( next, topnews_autoplay_delay );
296					topnews_autoplay();
297				}
298
299				return topnews_current = next;
300			});
301		}
302	}
303}
304
305
306
307function topnews_autoplay() {
308	topnews_timing = setTimeout(function() { topnews_sliding( '39', '', 'on' ) }, topnews_autoplay_delay);
309
310	$('.tn-btn-pause').show(0);
311	$('.tn-btn-play').hide(0);
312}
313
314function topnews_autoplay_stop() {
315	clearTimeout(topnews_timing);
316
317	$('.tn-btn-pause').hide(0);
318	$('.tn-btn-play').show(0);
319
320	$('.topnews-timer div').stop(true, false);
321}
322
323
324
325function topnews_disable_buttons() {
326	$(document).unbind('keyup');
327
328	document.getElementById('tn-btn-prev').onclick = function() { ''; }
329	document.getElementById('tn-btn-next').onclick = function() { ''; }
330
331	$('.topnews-pagination li').each(function() {
332		document.getElementById( $(this).attr('id') ).onclick = function() { ''; }
333	});
334}
335
336function topnews_enable_buttons() {
337	$(document).bind('keyup', function(e) { topnews_sliding( e, 'keyCode', 'off' ); });
338
339	document.getElementById('tn-btn-prev').onclick = function() { topnews_sliding( '37', '', 'off' ); }
340	document.getElementById('tn-btn-next').onclick = function() { topnews_sliding( '39', '', 'off' ); }
341
342	$('.topnews-pagination li').each(function() {
343		var id = $(this).attr('id').split('topnews-pagi-');
344		id = id[1];
345		document.getElementById( $(this).attr('id') ).onclick = function() { topnews_jumping( id, 'off' ); }
346	});
347}
348
349function topnews_indicator( current, next, duration ) {
350	var topnews_current_num = (next+1);
351	if (topnews_current_num < 10) { topnews_current_num = '0' + (next+1); }
352	$('.tn-btn-sum .current').html(topnews_current_num);
353
354	$( $('.topnews-pagination li')[current] ).removeClass('current');
355	$( $('.topnews-pagination li')[next] ).addClass('current');
356
357
358	var container = $( $('.topnews')[next] );
359	container.find('.topnews-timer-left').animate({ 'height': 0 }, 50, 'linear');
360	container.find('.topnews-timer-bottom').animate({ 'width': 0 }, 50, 'linear');
361	container.find('.topnews-timer-right').animate({ 'height': 0 }, 50, 'linear');
362	container.find('.topnews-timer-top').animate({ 'width': 0 }, 50, 'linear');
363}
364
365
366function topnews_jumping_reorder( next ) {
367	var slides = $('.topnews'), 
368		pos_left = '-150%', 
369		pos_right = '150%';
370
371	if ( $(window).width() <= 960 ) {
372		pos_left = '-300%';
373		pos_right = '300%';
374	}
375
376	for (i = 0; i <= next-1; i++) { $( slides[i] ).animate({ 'left': pos_left }, 0); }
377	for (i = next+1; i <= slides.length-1; i++) { $( slides[i] ).animate({ 'left': pos_right }, 0); }
378}
379
380function topnews_jumping_reorder_first() {
381	var slides = $('.topnews'), 
382		pos = '-150%';
383
384	if ( $(window).width() <= 960 ) { pos = '-300%'; }
385
386	for (i = 1; i <= slides.length-1; i++) { $( slides[i] ).animate({ 'left': pos }, 0); }
387}
388
389function topnews_jumping_reorder_last() {
390	var slides = $('.topnews'), 
391		pos = '150%';
392
393	if ( $(window).width() <= 960 ) { pos = '300%'; }
394
395	for (i = 0; i <= slides.length-2; i++) { $( slides[i] ).animate({ 'left': '150%' }, 0); }
396}
397
398
399
400function resize_topnews_controllers() {
401	$('.tn-btns-cont').css({
402		'width': ($(window).width() - 960) / 2
403	});
404}
405
406
407
408
409function topnews_timer( next, duration ) {
410	$('.topnews-timer div').stop(true, true);
411	var container = $( $('.topnews')[next] );
412	duration = duration - 200;
413
414	container.find('.topnews-timer-top').delay(0).animate({ 'width': 52 }, (duration / 4), 'linear', function() {
415		container.find('.topnews-timer-right').animate({ 'height': 52 }, (duration / 4), 'linear', function() {
416			container.find('.topnews-timer-bottom').animate({ 'width': 52 }, (duration / 4), 'linear', function() {
417				container.find('.topnews-timer-left').animate({ 'height': 52 }, (duration / 4), 'linear');
418			});
419		});
420	});
421}

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.