PageSourceSearch

https://www.riminiduepuntozero.it/wordpress/wp-content/themes/magone/assets/js/main.js?ver=3.8

js riminiduepuntozero.it collected 2026-10-02 12:58:19 UTC 37,539 bytes, 1,177 lines download raw bytes

1(function ($) {
2	/* replace logo */
3	if (Magone_Is_Retina) {
4		$('img[data-retina!=""]').each(function(){
5			$(this).attr('src', $(this).attr('data-retina'));
6		});
7	}
8	
9	/*modify facebook fanpage div*/
10	$('.fb-page-raw').each(function(){
11		if ($(this).attr('data-adapt-container-width') == 'true') {
12			var par_w = $(this).parent().width();
13					$(this).attr('data-width', par_w);
14		}
15		
16		$(this).removeClass('fb-page-raw').addClass('fb-page');
17	});
18	
19	/*move post break links after more tags*/
20	$('.break-link-after-more-tag').appendTo('.post-body-inner span[id*="more-"]').removeClass('hide');
21
22	// fill the js_get
23	var js_get = new Object();
24	var uri = window.location.search;
25	if (uri) {
26		uri = uri.substring(1);// remove ?
27		var list = uri.split('&');
28		for (var i = 0; i < list.length; i++) {
29			var l = list[i].split('=');
30			if (l.length > 1) {
31				js_get[l[0]] = l[1];
32			}
33			
34		}
35	}
36
37	if (!magone.is_gpsi) {
38		$('body').prepend('<div id="fb-root"></div>');
39		// INIT FACEBOOK SDK
40		(function(d, s, id) {
41		  var js, fjs = d.getElementsByTagName(s)[0];
42		  if (d.getElementById(id)) return;
43		  js = d.createElement(s); js.id = id;
44		  js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.5&appId="+magone.facebook_app_id;
45		  fjs.parentNode.insertBefore(js, fjs);
46		}(document, 'script', 'facebook-jssdk'));
47	}
48	
49	/*TOP MENU && MAIN MENU*/
50	// modify menu structure
51	// for child menu
52	$('.top-menu > .menu > li, .main-menu > .menu > li').each(function (h) {
53		if ($(this).is('.menu-item-has-children')) {
54			$(this).find('.sub-menu').wrap('<div class="menu-item-inner"></div>');
55		} else if ($(this).is('.menu-item-mega')){
56			$(this).append('<div class="menu-item-inner"></div>');
57		}
58	});
59	$('.top-menu > .menu .menu-item-inner, .main-menu > .menu .menu-item-inner').append('<div class="clear"></div>');
60	$('.top-menu > .menu .menu-item-has-children > a, .main-menu > .menu .menu-item-has-children > a').append('<span class="arrow"></span>');
61	
62	// for mega menu
63	$('.main-menu > .menu .menu-item-mega > .menu-item-inner').prepend('<div class="menu-mega-content"></div>');	
64	$('.main-menu > .menu .menu-item-mega-label .menu-mega-content').append('<div class="loader">Loading...</div>');
65	$('.menu .menu-item-mega-label > a').each(function () {		
66		$(this).parent().attr('data-id', $(this).attr('data-id'));
67	});
68
69	// clone menu for mobile
70	$('<div class="main-mobile-menu mobile-menu mobile">'+$('.main-menu').html()+'</div>').insertAfter($('.main-menu'));
71	$('.top-bar.has-menu').append($('<div class="top-mobile-menu mobile-menu mobile">'+$('.top-menu').html()+'</div>'));
72	$('.mobile-menu .menu-item-mega-label').addClass('loaded');
73	$('.mobile-menu .menu-mega-content').remove();
74	$('.mobile-menu .sticky-menu-logo').remove();
75	
76
77	// fill data for mega label menu
78	$('.menu .menu-item-mega-label').hover(function () {
79		// load feed if this is not load
80		if (!$(this).is('.loaded')) {
81			var lister = $(this);
82			lister.addClass('loaded');
83
84			$.post(magone.ajax_url, { 
85				action: 'magone_mega_menu_content', 
86				id: $(this).attr('data-id')
87			}).done(function( data ) {								
88				if (magone_ajax_error(data)) {
89					lister.find('.menu-mega-content').html(magone.text['Not found any posts']);
90					lister.addClass('finished');
91					return;
92				}
93				
94				lister.find('.menu-mega-content').html(data);
95				lister.addClass('finished');
96				magone_optimize_thumbnail(lister.find('.menu-mega-content').find('img'));
97			});
98		}
99	});
100	
101	// show menu icon
102	$('.top-menu .menu-item > a, .main-menu .menu-item > a').each(function() {
103		var icon = $(this).attr('data-icon');
104		if (typeof(icon) != 'undefined' && icon) {			
105			if (icon.indexOf('fa-') == -1) {
106				icon = 'fa-'+icon;
107			}
108			$(this).prepend('<i class="fa '+icon+'"></i> ');
109		}
110	});
111	
112	// apply menu color
113
114	// toggle show / hide menu when click
115	$('#main-menu-toggle').click(function () {
116		if ($(this).is('.active')) {
117			$(this).removeClass('active');
118			$('#header .main-menu').stop().slideUp(300);
119		} else {
120			$(this).addClass('active');
121			$('#header .main-menu').stop().slideDown(300);
122		}
123	});
124	$('#main-menu-toggle-mobile').click(function () {
125		if ($(this).is('.active')) {
126			$(this).removeClass('active');
127			$('#header .main-mobile-menu .menu').stop().slideUp(300);
128		} else {
129			$(this).addClass('active');
130			$('#header .main-mobile-menu .menu').stop().slideDown(300);
131		}
132	});
133	$('#top-menu-toggle-mobile').click(function () {
134		if ($(this).is('.active')) {
135			$(this).removeClass('active');
136			$('#header .top-mobile-menu .menu').stop().slideUp(300);
137		} else {
138			$(this).addClass('active');
139			$('#header .top-mobile-menu .menu').stop().slideDown(300);
140		}
141	});
142	
143	
144	/*STICKY MENU*/
145	var MagOne_Last_Window_Scroll_Top = 0;
146	
147	function magone_sticky_menu_enable() {
148		// process the axis
149		var pattern_width = $('#header').width();
150		if ($('#header .m1-wrapper .wide').length) {
151			pattern_width = $('#header .m1-wrapper .wide').width();
152		}
153		var menu_height = $('.main-menu').height();
154		$('.main-menu').addClass('sticky-menu');
155		$('.main-menu').find('ul.menu').css('width', pattern_width+'px').css('height', menu_height+'px');
156		if ($('.main-menu-placeholder').length == 0) {
157			$('<div class="main-menu-placeholder" style="height:'+menu_height+'px"></div>').insertAfter($('.main-menu'));
158		}
159	}
160	function magone_sticky_menu_disable() {	
161		$('.main-menu').removeClass('sticky-menu');
162		$('.main-menu').find('ul.menu').css('width', '').css('height', '');
163		$('.main-menu-placeholder').remove();
164	}
165	if (magone.sticky_menu != 'disable' && $(window).width() >= 1010) {
166		$('.main-menu > ul.menu').prepend('<li class="menu-item sticky-menu-logo-item"></li>');
167		
168		
169		$('.sticky-menu-logo').appendTo($('.sticky-menu-logo-item'));
170
171		$(window).scroll(function() {    	
172			var content_top = $('#header').offset().top + $('#header').height() + 30; 
173			
174			var window_top = $(window).scrollTop();
175			if (window_top > content_top) {
176				switch (magone.sticky_menu) {
177				case 'up':
178					if (window_top < MagOne_Last_Window_Scroll_Top) {
179						magone_sticky_menu_enable();
180					} else {
181						magone_sticky_menu_disable();		
182					}
183					break;
184
185				case 'down':
186					if (window_top > MagOne_Last_Window_Scroll_Top) {
187						magone_sticky_menu_enable();
188					} else {
189						magone_sticky_menu_disable();		
190					}
191					break;
192
193				default: /*Always*/
194					magone_sticky_menu_enable();
195					break;
196				}	    	
197			} else {
198				magone_sticky_menu_disable();
199			}    	
200			MagOne_Last_Window_Scroll_Top = window_top;
201		});
202	}
203
204	
205	/*REMOVE THUMBNAL FOR STICKY SMALL ITEMS*/
206	$('.widget.sticky .item-1 .item-thumbnail, .widget.sticky .item-2 .item-thumbnail, .widget.sticky .item-3 .item-thumbnail').removeAttr('style');
207	magone_optimize_thumbnail($('.widget .item-thumbnail img'));
208
209	/*ADD EFFECTS FOR SLIDER, TICKER, CAROUSEL*/
210	var Owl_Widgets = new Object();
211	function magone_enable_owl(widget) {		
212		var number_items = 1;
213		if (widget.is('.slider')) {
214			number_items = widget.find('.widget-content .slider-item').length;
215		} else if (widget.is('.ticker')) {
216			number_items = widget.find('.widget-content .ticker-item').length;
217		} else if (widget.is('.carousel') ){
218			number_items = widget.find('.widget-content .carousel-item').length;
219		}
220		
221		if (1 == number_items) {
222			return;/*we don't need slider if we have only 1 item*/
223		}
224		
225		
226		var data_holder = widget.find('.widget-data');
227		if (data_holder.length == 0) {
228			return;
229		}
230		
231		
232		var widget_id = widget.attr('id');
233		var widget_type = data_holder.attr('data-type');
234		var options = new Object();
235		options['responsive'] = new Object();
236		options['responsive'][0] = new Object();
237		options['responsive'][499] = new Object();
238		options['responsive'][699] = new Object();
239		options['responsive'][899] = new Object();
240
241		var items = (widget.is('.slider') ? 1 : 2);
242		options['loop'] = true;
243		options['nav'] = (data_holder.find('.data-show_nav').length > 0);
244		options['dots'] = (widget.is('.ticker') ? false : (data_holder.find('.data-show_dots').length > 0));
245		options['autoplay'] = true;
246		options['autoplayHoverPause'] = true;
247		options['onInitialized'] = function () {
248			magone_optimize_thumbnail($('#widget-content-'+widget_id+' .item-thumbnail img'));
249		};
250		options['navText'] = [			
251			'<a class="'+widget_type+'-button '+widget_type+'-button-left" href="javascript:void(0)"><i class="fa fa-angle-left"></i></a>',
252			'<a class="'+widget_type+'-button '+widget_type+'-button-right" href="javascript:void(0)"><i class="fa fa-angle-right"></i></a>'
253		];
254
255		if (magone.is_rtl) {					
256			// set mode to RTL
257			options['rtl'] = true;
258		}
259
260		if (data_holder.find('.data-column').length && magone_is_number(data_holder.find('.data-column').text())) {
261			var columns = Number(data_holder.find('.data-column').text());
262			if (columns >= 1) {
263				items = columns;
264			}
265		}
266
267		// animation speed
268		if (widget.is('.ticker')) {
269			options['slideBy'] = widget.find('.widget-content .ticker-item').length;			
270		}
271		if (data_holder.find('.data-speed').length && magone_is_number(data_holder.find('.data-speed').text())) {			
272			options['autoplayTimeout'] = Number(data_holder.find('.data-speed').text());
273			options['autoplaySpeed'] = Math.floor(options['autoplayTimeout'] / 10);
274		}
275
276		// init responsive option	
277		options['items'] = items;
278		options['responsive'][899]['items'] = items;
279		options['responsive'][699]['items'] = (items > 3? 3 : items);
280		options['responsive'][499]['items'] = (items > 2? 2 : items);
281		options['responsive'][0]['items'] = 1;
282					
283		if (typeof(Owl_Widgets[widget_id]) != 'undefined') {
284			widget.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded');
285			widget.find('.owl-stage-outer').children().unwrap();
286			Owl_Widgets[widget_id].destroy();
287		}
288		var widget_content = $('#widget-content-'+widget_id);		
289		widget_content.owlCarousel(options);
290		Owl_Widgets[widget_id] = widget_content.data('owlCarousel');
291	}
292	$('.widget.slider, .widget.carousel, .widget.ticker').each(function () {
293		magone_enable_owl($(this));
294	});
295
296	// widget social counter
297	$('.widget.social_counter').each(function () {		
298		if ($(this).find('.data .value').length) {
299			var widget = $(this);
300			var ajax_options = new Object();	
301			ajax_options['action'] = 'magone_widget_social_counter';
302			ajax_options['block_id'] = widget.attr('id');
303			
304			$(this).find('.data .value').each(function () {
305				ajax_options[$(this).attr('data-key')] = $(this).attr('data-url');				
306			});
307
308			$.post(magone.ajax_url, ajax_options).done(function( data ) {								
309				if (magone_ajax_error(data)) {
310					widget.remove();
311					return;
312				}
313				
314				widget.find('.widget-content').html(data);				
315			});
316		}
317		
318	});
319
320	// tab widgets
321	function magone_tab_list_show(tab_list) {
322		// style for tab link width (tab titles)
323		var style = '';
324		if (tab_list.length) {
325			style = ' sty'+'le="width:'+(100/tab_list.length - 0.01)+'%"';
326		}
327		
328		for (var i = 0; i < tab_list.length; i++) {
329			if (i == 0) {
330				tab_list[0].show();
331//				magone_optimize_thumbnail($('#'+tab_list[0].id+' .thumbnail img'));
332			} else {
333				tab_list[i].hide();
334			}
335			
336			// remake title
337			$('#'+tab_list[i].id+' > h2').remove();
338			$('#'+tab_list[i].id+' h2.widget-title').remove();
339			$('#'+tab_list[i].id+' .feed-widget-header').remove();
340			
341			var title_code = '';
342			for (var j = 0; j < tab_list.length; j++) {
343				var tab_link_class = ' class="tab-link';
344				if (j == i) {
345					tab_link_class += ' active';
346				}
347				tab_link_class += '"';
348				// show / hide tab widget
349				var tab_on_click = ' onclick="';
350				for (var k = 0; k < tab_list.length; k++) {
351					if (k != j) {
352						tab_on_click += 'jQuery(\'#'+tab_list[k].id+'\').hide();';
353					} else {
354						tab_on_click += 'jQuery(\'#'+tab_list[k].id+'\').show();';
355					}
356				}
357				tab_on_click+='"';
358
359				// append title
360				title_code += '<a href="#'+tab_list[j].id+'-link"'+tab_link_class+tab_on_click+style+'>\
361					<span class="tab-link-inner">'+tab_list[j].title+'\
362						<span class="tab-link-arrow"></span>\
363					</span>\
364				</a>';
365			}
366			$('#'+tab_list[i].id).prepend('<h2 class="tab-title">'+title_code+'<div class="clear"></div></h2><div class="clear"></div>');
367		}
368	}
369
370	// collect all tab widgets and apply tab list
371	var is_tab = false;
372	var tab_index = -1;
373	var tab_list = new Array();
374	$('.widget').each(function () {
375		if ($(this).is('.tab')) {
376			if (!is_tab) {
377				tab_index++;
378				tab_list[tab_index] = new Array();
379				is_tab = true;
380			}
381			widget = $(this);
382			widget.id = $(this).attr('id');
383			widget.title = '';
384			if ($(this).find('.widget-title').length) {
385				$(this).find('.widget-title').each(function () {
386					if ($(this).find('a').length) {
387						widget.title = $(this).find('a').html();
388					}
389					else {
390						widget.title = $(this).html();
391					}
392				});	
393			}
394			if (widget.title == '') {
395				widget.title = magone.text['Tab'];
396			}
397
398			tab_list[tab_index].push(widget);
399		} else {
400			if (is_tab) {
401				is_tab = false;
402			}
403		}
404	});
405	
406	for (var i = 0; i < tab_list.length; i++) {
407		magone_tab_list_show(tab_list[i]);
408	}
409
410	$('.tab-link').click(function () {
411		var wid_id = $(this).attr('href').replace('-link', '');
412		magone_optimize_thumbnail($(wid_id+' .thumbnail img'));
413	});
414
415	// related post widget
416	function magone_show_related_post(count, id) {
417		$.post(magone.ajax_url, {
418			action: 'magone_related', 
419			id: id,
420			count: count
421		}).done(function( data ) {								
422			if (magone_ajax_error(data)) {				
423				return;
424			}
425			$('.post-related-content').html(data+'<div class="clear"></div>');
426			magone_optimize_thumbnail($('.post-related-content .item-thumbnail img'));
427		});
428	}
429	$('.post-related').each(function () {
430		var count = $(this).attr('data-count');
431		var id = $(this).attr('data-id');
432		magone_show_related_post(count, id);
433	});
434	$('.post-related-random-button').click(function (e) {
435		e.preventDefault();
436		$('.post-related-content').html('<div class="loader"></div>');
437		var count = $(this).attr('data-count');
438		var id = $(this).attr('data-id');
439		magone_show_related_post(count, id);
440	});
441
442
443	/*comment */
444	if (!$('body').is('.woocommerce')) {
445		// show comment count under post title for primary comment system	
446		$('.'+magone.primary_comment_system+'-comment-counter').show();
447
448		var showing_comment_system = magone.primary_comment_system;
449
450		if ('fb_comment_id' in js_get) {
451			showing_comment_system = 'facebook';		
452		} else if ('#comment-' in js_get) {
453			showing_comment_system = 'disqus';
454		}
455
456		// animate effects for comment
457		$('#comments').each(function () {
458			if ($('.comments').length == 0) {
459				$(this).remove();
460				return;
461			}
462			// show primary comment system, also allow switch tabs
463			if ($('.'+magone.primary_comment_system+'-comments').length == 0) {
464				$('.comments').first().addClass('active');		
465			} else {
466				$('.'+magone.primary_comment_system+'-comments').addClass('active');
467			}
468
469			// create comment tabs
470			$('.comments.active .comments-title').addClass('active').appendTo($('#comments-title-tabs'));
471			$('.comments .comments-title').appendTo($('#comments-title-tabs'));
472			$('#comments-title-tabs .comments-title').addClass('comments-title-tab');
473			if (showing_comment_system != magone.primary_comment_system) {
474				$('#comments-title-tabs a.active').removeClass('active');
475				$('.comments.active').removeClass('active');
476				$('#comments-title-tabs a.'+showing_comment_system+'-comments-title').addClass('active');
477				$('.'+showing_comment_system+'-comments').addClass('active');
478			}
479
480			// switch tabs
481			$('#comments-title-tabs a').click(function () {
482				if ($(this).is('.active')) {
483					return;
484				}
485				$('#comments-title-tabs a.active, .comments.active').removeClass('active');
486				$(this).addClass('active');
487				$($(this).attr('data-target')).addClass('active');
488			});	
489		});
490
491		// save ajax comment count to database
492		if ($('.ajax-comment-count').length) {
493			var ajax_comment_count_counter = setInterval(function() {
494				if ($('.ajax-comment-count').length == 0) {
495					clearInterval(ajax_comment_count_counter);
496					return;
497				}
498				$('.ajax-comment-count').each(function () {
499					var count = $(this).text();
500					if (count == '' || count === null) {
501						return;
502					}
503					if (isNaN(count)) {
504						count = count.split(' ')[0];					
505					}
506					if (isNaN(count)) {
507						return;	
508					}
509					count = Number(count);
510					var system = $(this).attr('data-system');
511					var id = $(this).attr('data-id');
512					$(this).remove();
513					$.post(magone.ajax_url, {
514						action: 'magone_save_comment_count', 
515						id: id,
516						count: count,
517						system: system
518					});
519				});
520			}, 100);
521		}
522	}
523
524	// select all for footer share buttons
525	$('.post-share-buttons-url').on('focus', function () {
526		magone_select_all($(this));
527	});
528
529	// blockquote
530	$('.content-template blockquote').each(function () {		
531		$(this).html('<div class="blockquote-icon"><i class="fa fa-quote-left"></i></div><div class="blockquote-content">'+$(this).html()+'</div>');
532	});
533
534	// pre - code box
535	var pre_index = 0;
536	$('.content-template pre').addClass('code-box');
537	$('.content-template .code-box').each(function(){
538		$(this).attr('id', 'pre-'+pre_index);
539		var pre_header_html = '<div class="clear"></div><div class="pre-header rel">';
540		
541		if ('execCommand' in document) {
542			pre_header_html += '<a href="javascript:void(0)" class="bg copy-all" data-id="'+pre_index+'">'+magone.text['Copy All Code']+'</a> ';
543		} else if ('getSelection' in window || 'createTextRange' in document.body) {
544			pre_header_html += '<a href="javascript:void(0)" class="bg select-all" data-id="'+pre_index+'">'+magone.text['Select All Code']+'</a> ';		
545		}
546		pre_header_html += '<div class="clear"></div></div>';
547		$(pre_header_html).insertBefore($('#pre-'+pre_index));
548		pre_index++;
549	});
550
551	$('.pre-header .select-all').click(function(){
552		var data_id = $(this).attr('data-id');
553		magone_selectText('pre-'+data_id);
554	});
555	$('.pre-header .copy-all').click(function(){
556		$(this).parent().find('.copy-all-message').stop().remove();
557		var data_id = $(this).attr('data-id');
558		magone_selectText('pre-'+data_id);
559		var msg_html = '';	
560		var msg_class = '';
561		if (document.execCommand("Copy")) {
562			msg_html += magone.text['All codes were copied to your clipboard'];
563			msg_class = 'success';
564		} else {
565			msg_html += magone.text['Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy'];
566			msg_class = 'error';
567		}
568		msg_html = '<div class="copy-all-message abs '+msg_class+'">'+msg_html+ '</div>';
569		$(msg_html).insertAfter($(this));
570		var control = $($(this).parent().find('.copy-all-message'));
571		setTimeout(function() {
572			if (control.is('.success')) {
573				control.fadeOut(2000);
574			}
575		}, 1000);		
576	});
577
578	// gallery
579	// gallery tooltip
580	$('.post-body .gallery-item').each(function () {
581		if ($(this).find('.gallery-caption').length) {
582			$(this).attr('title', $.trim($(this).find('.gallery-caption').text()));
583		}
584	});
585	
586	// gallery columns
587	$('.post-body .gallery').each(function () {
588		var gclass = $(this).attr('class');
589		if (typeof(gclass) == 'undefined') {
590			return;
591		}
592		var gallery_id = $(this).attr('id');
593		if (typeof(gallery_id) == 'undefined')  {
594			return;
595		}
596		gclass = gclass.split(' ');
597		var column_number = 1;
598		for (var i = 0; i < gclass.length; i++) {
599			if (gclass[i].indexOf('gallery-columns-') != -1) {
600				column_number = gclass[i].replace('gallery-columns-', '');
601				if (isNaN(column_number)) {
602					return;
603				}
604				column_number = Number(column_number);
605				break;
606			}
607		}
608		if (column_number <= 1) {
609			return;
610		}
611		gallery_id = gallery_id+'-actived-column';
612		var width = 100 / column_number;
613		var html = '<div id="'+gallery_id+'" class="'+gclass.join(' ')+'">';
614		for (var i = 0; i < column_number; i++) {
615			html += '<div class="gallery-column gallery-column-'+i+'" st'+'yle="width: '+width+'%"></div>';
616		}
617		html += '<div class="clear"></div></div>';
618		$(html).insertAfter($(this));
619
620		var gallery_item_index = 0;
621		$(this).find('.gallery-item').each(function () {
622			$(this).clone().appendTo($('#'+gallery_id+' .gallery-column-'+(gallery_item_index % column_number)));
623			gallery_item_index++;
624		});
625		$(this).remove();
626	});
627
628	/* modifica lorenzo
629	// gallery thickbox
630	$('.post-body .gallery').each(function () {
631		if ($(this).find('.gallery-item a').length == 0) {
632			return;
633		}
634		var gallery_id = $(this).attr('id');
635		if (typeof(gallery_id) == 'undefined')  {
636			return;
637		}
638		
639		// add item caption
640		$(this).find('.gallery-item a').each(function () {
641			var href = $(this).attr('href');
642			if (typeof(href) == 'undefined' || !magone_is_image_src(href)) {
643				return;
644			}
645			var caption = '';
646			if ($(this).parents('.gallery-item').find('.gallery-caption').length) {
647				$(this).attr('title', $(this).parents('.gallery-item').find('.gallery-caption').text());
648			}
649			
650			$(this).addClass('thickbox').attr('rel', gallery_id);
651		});
652	});
653
654	// image thickbox
655
656	$('.post-body img').each(function () {
657		var parent = $(this).parent();
658		if (parent.length && parent.is('a') && !parent.is('.thickbox')) {
659			var href = parent.attr('href');
660			if (typeof(href) == 'undefined' || !magone_is_image_src(href)) {
661				return;
662			}
663
664			parent.addClass('thickbox');
665
666			if (parent.parent().is('.wp-caption')) {
667				var caption = parent.parent().find('.wp-caption-text');
668				if (caption.length) {
669					$(parent).attr('title', caption.text());
670				}
671			}
672		}
673	});
674	*/
675
676
677	// animation to show hide search
678	$('.search-form-wrapper .search-text').removeAttr('placeholder');
679	$('#search-toggle').click(function () {
680		if ($(this).is('.active')) {
681			$(this).removeClass('active');			
682			$('.search-form-wrapper').stop().fadeOut(100);
683		} else {
684			$(this).addClass('active');
685			$('.search-form-wrapper').stop().fadeIn(100, function () {
686				$('.search-form-wrapper .search-text').focus();
687			});
688		}
689	});
690	$('.search-form-wrapper .search-form-overlay, .search-form-wrapper .search-form-label').click(function () {
691		$('#search-toggle').removeClass('active');
692		$('.search-form-wrapper').stop().fadeOut(100);
693	});
694
695	// scroll up / jump top button
696	$('.scroll-up').click(function(){
697		$("html, body").animate({ scrollTop: 0 }, 600);
698		return false;
699	});
700
701	// article box pagination
702	// build pagination buttons
703	function magone_feed_widget_pagination_builder(posts_per_page, found_posts, current_page, max_num_pages, button_type) {
704		var html = '';		
705		posts_per_page = Number(posts_per_page);
706		found_posts = Number(found_posts);
707		current_page = Number(current_page);
708		max_num_pages = Number(max_num_pages);
709		var listed = posts_per_page * current_page;
710		if (listed > found_posts) {
711			listed = found_posts;
712		}
713		var post_count_text = magone.text.widget_pagination_post_count.replace('%1$s', listed).replace('%2$s', found_posts);
714		var post_count_class = '';
715		if (current_page == 1) {
716			post_count_class = ' text-align-left';
717		} else if (current_page == max_num_pages) {
718			post_count_class = ' text-align-right';
719		}
720		post_count_text = '<span class="feed-widget-pagination-info'+post_count_class+'">'+post_count_text+'</span>';
721		if (button_type == 'loadmore') {
722			if (current_page < max_num_pages) {
723				html += '<a href="javascript:void(0)" class="shad white feed-widget-pagination-button feed-widget-pagination-load-more-button" data-paged="'+(current_page+1)+'">'+magone.text['LOAD MORE']+'</a>';
724			} else {
725				html += post_count_text;
726			}
727		} else if (button_type == 'nextprev') {
728			if (current_page != 1) {
729				html += '<a href="javascript:void(0)" class="shad white feed-widget-pagination-button feed-widget-pagination-newer-button" data-paged="'+(current_page-1)+'">'+magone.text['NEWER']+'</a>';	
730			}
731			html+=post_count_text;
732			if (current_page != max_num_pages) {
733				html += '<a href="javascript:void(0)" class="shad white feed-widget-pagination-button feed-widget-pagination-older-button" data-paged="'+(current_page+1)+'">'+magone.text['OLDER']+'</a>';	
734			}
735
736		} else {			
737			for (var i = 1; i <= max_num_pages; i++) {
738				var active = '';
739				if (i == current_page) {
740					active = ' active';
741				}
742				if (i != 1 && i != max_num_pages && i != current_page &&
743					i != current_page - 1 && i != current_page - 2 &&
744					i != current_page + 1 && i != current_page + 2) {
745					continue;
746				}
747				html += '<a href="javascript:void(0)" class="shad feed-widget-pagination-button'+active+'" data-paged="'+i+'">'+i+'</a>';
748
749				if (i == 1 && current_page - 3 > 1 ||
750					i == current_page + 2 && current_page + 3 < max_num_pages) {
751					html += '<span class="feed-widget-pagination-separator feed-widget-pagination-separator-1">...</span>';
752				}
753			}
754			html += post_count_text;
755		}
756		
757		return html;
758	}
759
760	// init widget pagination for first show
761	$('.feed-widget-pagination').each(function () {		
762		var widget_id = $(this).attr('data-widget_id');
763		var widget_atts = window['Atts_'+widget_id];
764		$(this).html(magone_feed_widget_pagination_builder(
765			widget_atts.count,
766			widget_atts.found_posts, 
767			1, 
768			widget_atts.max_num_pages, 
769			widget_atts.pagination
770		));
771	});
772
773	// take action when click pagination button
774	function magone_get_item_class(i) {		
775		var item_class = 'shad item item-'+i;
776		if (i % 2 == 0) {
777			item_class += ' item-two';
778		}
779		if (i % 3 == 0) {
780			item_class += ' item-three';
781		}
782		if (i % 4 == 0) {
783			item_class += ' item-four';	
784		}
785		for (var j = 1; j <= i; j++) {
786			item_class += ' than-'+(j-1);
787		}
788	
789		return item_class;
790	}
791	$(document).on('click', '.feed-widget-pagination-button', function () {
792		if ($(this).is('.active')) {
793			return;
794		}
795		var target_paged = $(this).attr('data-paged');
796		var button_parent = $(this).parent();
797		var widget_id = button_parent.attr('data-widget_id');		
798		var widget_atts = window['Atts_'+widget_id];
799		var widget_type = button_parent.attr('data-type');
800		var widget_content_holder = $('#'+widget_id+' .widget-content');		
801		button_parent.html('<i class="fa fa-spinner fa-spin"></i>').addClass('feed-widget-pagination-loading');
802		
803		$.post(magone.ajax_url, { 
804			action: 'magone_article_box_pagination', 
805			atts: widget_atts,
806			type: widget_type,
807			paged: target_paged
808		}).done(function( data ) {
809			if (!button_parent.is('.feed-widget-pagination-loadmore')) {
810				widget_content_holder.html(data);
811				magone_scroll_to($('#'+widget_id), 300);
812			} else {
813				widget_content_holder.append(data);
814			}
815			
816			$(button_parent).html(magone_feed_widget_pagination_builder(
817				widget_atts.count,
818				widget_atts.found_posts, 
819				target_paged,
820				widget_atts.max_num_pages, 
821				widget_atts.pagination
822			)).removeClass('feed-widget-pagination-loading');
823
824			// remake content
825			// reindex for all items from two and three
826			var index = 0;
827			widget_content_holder.find('> .item, > .'+widget_type+'-col .item').each(function () {
828				$(this).attr('class', magone_get_item_class(index) + (widget_type == 'list'? ' table': ''));
829				index++;
830			});
831
832			// columnize for two / three when loading more
833			if (button_parent.is('.feed-widget-pagination-loadmore') && (widget_type == 'two' || widget_type == 'three') && $('#'+widget_id).is('.auto-height')) {
834				//re-index column
835				index = 1;
836				widget_content_holder.find('> .'+widget_type+'-col').removeClass('col-1').removeClass('col-2').removeClass('col-3').each(function () {
837					$(this).addClass('col-'+index);
838					index++;
839				});
840				// count start point
841				var total_col = index;
842				var total_item = widget_content_holder.find('> .'+widget_type+'-col .item').length;
843				var num_in_col_1 = widget_content_holder.find('> .col-1 .item').length;
844				var num_in_col_2 = widget_content_holder.find('> .col-2 .item').length;
845				var num_in_col_3 = widget_content_holder.find('> .col-3 .item').length;
846				var multiplier = 2;
847				var index = multiplier;
848				start_adjust = num_in_col_1 + num_in_col_2;				
849				if (widget_type == 'three') {
850					start_adjust += num_in_col_3;
851					multiplier = 3;
852					index = multiplier;
853					if (num_in_col_3 == num_in_col_1) {
854						index = 1;
855					}
856				} else if (widget_type == 'two') {
857					if (num_in_col_2 == num_in_col_1) {
858						index = 1;
859					}
860				}
861
862				// start append
863				for (var i = start_adjust; i < total_item; i++) {
864					widget_content_holder.find('.item-'+i).appendTo(widget_content_holder.find('.col-'+index));
865					index++;
866					if (index > multiplier) {
867						index = 1;
868					}
869				}
870
871				// remove waste columns
872				for (var i = multiplier+1; i <= total_col; i++) {
873					widget_content_holder.find('.col-'+i).remove();
874				}
875			}
876
877			// optimize thumbnail
878			magone_optimize_thumbnail(widget_content_holder.find('.thumbnail img'));
879		});
880	});
881
882	// quote widget
883	magone_optimize_thumbnail($('.widget.quote .item-thumbnail img'));	
884	
885	// tab shortcode
886	$('.shortcode-tab').tabs();
887	$('.shortcode-vtab').tabs();
888
889	// accordion shortcode
890	$('.shortcode-accordion').each(function(){
891		var multiple_open = $(this).attr('data-multiple_open');
892		var close_all = $(this).attr('data-close_all');
893		
894		if (typeof(multiple_open) != 'undefined' && null != multiple_open) {
895			var options = new Object();
896			options.heightStyle = 'content';
897			options.collapsible = true;
898			
899			if ('on' == multiple_open) {
900				options.beforeActivate = function(event, ui) {
901					// The accordion believes a panel is being opened
902					if (ui.newHeader[0]) {
903					   var currHeader  = ui.newHeader;
904					   var currContent = currHeader.next('.ui-accordion-content');
905					// The accordion believes a panel is being closed
906					} else {
907					   var currHeader  = ui.oldHeader;
908					   var currContent = currHeader.next('.ui-accordion-content');
909					}
910					// Since we've changed the default behavior, this detects the actual status
911					var isPanelSelected = currHeader.attr('aria-selected') == 'true';
912
913					// Toggle the panel's header
914					currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString()));
915
916					// Toggle the panel's content
917					currContent.toggleClass('accordion-content-active',!isPanelSelected);
918					if (isPanelSelected) {
919						currContent.slideUp(); 
920					}  else {
921						currContent.slideDown();
922					}
923
924					return false; // Cancels the default action
925				};
926			}
927			
928			if ('on' == close_all) {
929				options.active = false;
930			}
931			
932			$(this).accordion(options);
933		}
934		
935	});
936
937
938	// LOCK SHORTCODE
939	function magone_unlock_content_handle(e) {
940		if (typeof(e) == 'undefined') {
941			return;
942		}
943		var current_link = window.location.href;
944		var share_url = e.url;
945		if (share_url && (share_url.indexOf(current_link) != -1 || current_link.indexOf(share_url) != -1)) {
946			$('.locked-content').remove();
947			$('.locked-content-data').show();
948			magone_update_option('unlocked-'+magone_url_to_slug(window.location.hostname + window.location.pathname), 'unlocked');
949		}
950	}
951	if ($('.locked-content').length) {
952		// effect for unlock content
953		if (magone_get_option('unlocked-'+magone_url_to_slug(window.location.hostname + window.location.pathname)) == 'unlocked') {		
954			$('.locked-content').remove();
955			$('.locked-content-data').show();
956		} else if (!magone.is_gpsi) {
957			/* Facebook */
958			/***/		
959			$(document).ready(function() {
960				$.ajaxSetup({ cache: true });
961					$.getScript('//connect.facebook.net/'+magone.locale+'/sdk.js', function(){
962					FB.init({
963						appId : magone.facebook_app_id,
964						status : true,
965						xfbml : true,
966						cookie : false,
967						version  : 'v2.5'
968					});     
969					FB.Event.subscribe('edge.create', function(href, widget) {								
970						$.event.trigger({
971							type: "unlock_content",
972							url: href
973						});
974					});
975					FB.Event.subscribe('comment.create', function(href, widget) {								
976						$.event.trigger({
977							type: "unlock_content",
978							url: href
979						});
980					});
981					FB.Event.subscribe('message.send', function(href, widget) {								
982						$.event.trigger({
983							type: "unlock_content",
984							url: href
985						});
986					});			
987				});
988			});
989
990			/***/
991
992			/* Twitter */		
993			window.twttr = (function (d,s,id) {
994				var t, js, fjs = d.getElementsByTagName(s)[0];
995				if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
996				js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
997				return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
998			}(document, "script", "twitter-wjs"));
999			if (typeof(twttr) != 'undefined') {
1000				twttr.ready(function (twttr) {
1001					twttr.events.bind('tweet', function (event) {
1002						$.event.trigger({
1003							type: "unlock_content",
1004							url: event.target.baseURI					
1005						});
1006					});
1007					twttr.events.bind('like', function (event) {
1008						$.event.trigger({
1009							type: "unlock_content",
1010							url: event.target.baseURI					
1011						});
1012					});
1013					twttr.events.bind('follow', function (event) {
1014						$.event.trigger({
1015							type: "unlock_content",
1016							url: event.target.baseURI					
1017						});
1018					});
1019				});
1020			}
1021		}
1022		/* Listen for the pageShared event */	
1023		$(document).on('unlock_content', function (e) {		
1024			magone_unlock_content_handle(e);
1025		});
1026	} // end lock content efffect
1027	
1028	/*comment media replacer*/
1029	if (!magone.disable_wordpress_comment_media) {
1030		$('#comments .comment-body a').each(function () {
1031			var url = $(this).attr('href');
1032			if (typeof(url) != 'undefined' && url) {
1033				// replace for youtube
1034				if (url.indexOf('youtube') != -1 || url.indexOf('youtu.be') != -1) {
1035					// replace as youtube iframe
1036					var vid = magone_get_youtube_video_id(url);
1037					var lid = magone_get_youtube_list_id(url);
1038					if (vid) {
1039						var rep_code = '<iframe class="comment-media video youtube" width="640" height="360" src="https://www.youtube.com/embed/'+vid+'?';
1040						if (lid) {
1041							rep_code += 'list='+lid;
1042						} else {
1043							rep_code += 'rel=0';
1044						}
1045						rep_code += '" frameborder="0" allowfullscreen></iframe>';
1046						$(this).replaceWith(rep_code);
1047						return;				
1048					}
1049				}
1050
1051				// replace for vimeo
1052				if (url.indexOf('vimeo') != -1) {
1053					var vid = magone_et_vimeo_video_id(url);
1054					if (vid) {
1055						$(this).replaceWith('<iframe class="comment-media video vimeo" src="https://player.vimeo.com/video/'+vid+'" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');
1056						return;
1057					}
1058				}
1059
1060				// replace for images
1061				if (magone_is_image_src(url)) {
1062					$(this).replaceWith('<img class="comment-media image" src="'+url+'" alt="comment-image"/>');
1063					return;
1064				}
1065			}
1066		});	
1067	}
1068	
1069	/*STICKY SIDEBAR*/
1070	$('.sticky-inside').prepend('<div class="sticky-inside-pad"></div>');
1071	$(window).scroll(function() {
1072		if ($('.sticky-inside-pad').length == 0 || $('#content').length == 0) {
1073			return;
1074		}
1075		
1076		// window info
1077		var w_top = $(window).scrollTop();
1078		var w_hei = $(window).height();
1079		var w_bot = w_top + w_hei;
1080		
1081		$('.sticky-inside-pad').each(function() {
1082			var s_par = $(this).parent();
1083			if (!s_par.is('.sticky-inside')) {	
1084				$(this).stop().css('height', 0);
1085				return;
1086			}
1087			var s_ppa = s_par.parent();
1088			var s_par_top = s_par.offset().top;
1089			var s_con = $('#content');
1090			if (s_par.is('.column')) {
1091				s_con = 0; // reset
1092							
1093				// finding which will be the model for stick to
1094				s_ppa.find('.column.no-sticky').each(function(){
1095					if (s_par_top == $(this).offset().top) {
1096						// we will find all column on same level and has a same top
1097						if (s_con == 0 || s_con.height() < $(this).height()) {
1098							// also find the max-height one
1099							s_con = $(this);
1100						}						
1101					}
1102				});	
1103			}
1104			
1105			if (s_con == 0 || s_con.length == 0) {
1106				$(this).stop().css('height', 0);
1107				return;
1108			}
1109			
1110			// content info
1111			var c_top = s_con.offset().top;
1112			var c_hei = s_con.height();
1113			var c_bot = c_top + c_hei;
1114			
1115			
1116			// sidebar information
1117			var s_pad = $(this).height(); // current paddder hei
1118			var s_top = $(this).offset().top + s_pad;
1119			var s_hei = s_par.height() - s_pad;
1120			var s_bot = s_top + s_hei;	
1121			
1122			
1123			if (s_hei >= c_hei || s_ppa.width() <= s_par.width()) { 
1124				// don't need stick if side hei <= content hei				
1125				$(this).stop().css('height', 0);
1126				return;
1127			}
1128			
1129			if (s_hei + s_pad >= c_hei && w_top > s_top) {
1130				// prevent bounce of first load
1131				// when height is still not stable
1132				// because image or iframe loading
1133				$(this).stop().css('height', (c_hei - s_hei)+'px');
1134				return;
1135			}
1136			
1137			// couting new height of padder
1138			var new_pad = s_pad;
1139			if (w_top <= c_top) {
1140				// scrolled over top of content
1141				new_pad = 0; 
1142			} else if (w_bot >= c_bot ) {
1143				// scrolled over bot of content
1144				new_pad = s_pad + c_bot - s_bot; 
1145			} else if (w_top < s_top) {
1146				// scrolled over top of sidebar
1147				new_pad = w_top - c_top;
1148			} else if (w_bot > s_bot) {
1149				// scrolled over bot of sidebar
1150				new_pad = s_pad + w_bot - s_bot - 30; /*30px is padding from bottom*/
1151			}
1152			
1153			// never scroll out of content hei
1154			if (new_pad + s_hei > c_hei) {
1155				new_pad = c_hei - s_hei;
1156			}
1157			
1158			// animate the height
1159			if (new_pad != s_pad) {			
1160				$(this).stop().animate({
1161					height: new_pad + 'px'
1162				}, Number(magone.sticky_sidebar_delay));
1163			}
1164		});
1165	});
1166	
1167	
1168	// optimize post feature video iframe height
1169	$('.post-feature-media-wrapper iframe').each(function() {
1170		$(this).css('height', ($(this).width() / 1.8) + 'px');
1171	});
1172	$(window).resize(function(){
1173		$('.post-feature-media-wrapper iframe').each(function() {
1174			$(this).css('height', ($(this).width() / 1.8) + 'px');
1175		});
1176	});
1177}) (jQuery);

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.