PageSourceSearch

https://tps.co.il/wp-content/themes/tps/js/main.js?ver=20180522

js tps.co.il collected 2026-10-02 05:06:49 UTC 14,454 bytes, 632 lines download raw bytes

1function sectionAnimation(element) {
2
3	var reveal_mas = [];
4	var count_anim = 20;
5	for (var i = 0; i < count_anim; i++) {
6		reveal_mas[i] = jQuery(element).find('.reveal-' + i);
7
8	}
9	function revealAnimaton(i, elem, interval) {
10		setTimeout(function () {
11			if (elem.length > 0) {
12				elem.removeAttr('style');
13				elem.addClass('animated');
14			}
15		}, i * interval)
16	}
17
18	var reveal_count = 0;
19	var reveal_delay = 200;
20
21	function revealLoop() {
22		setTimeout(function () {
23			if (reveal_mas[reveal_count].length != 0) {
24				var str = reveal_mas[reveal_count].attr('class');
25				var index_delay = str.indexOf('reveal_delay');
26				if (index_delay != -1) {
27					reveal_delay = parseInt(str.substring(index_delay + 13));
28
29
30				} else {
31
32					reveal_delay = 200;
33				}
34				revealAnimaton(reveal_count, reveal_mas[reveal_count], 0);
35			}
36			reveal_count++;
37			if (reveal_count < count_anim) {
38				revealLoop();
39			}
40		}, reveal_delay)
41	}
42
43	revealLoop();
44}
45function clearAnimation(section) {
46	setTimeout(
47		function () {
48			jQuery(section).find('.reveal').each(function () {
49				jQuery(this).css('visibility', 'hidden');
50				jQuery(this).css('-webkit-animation-name', 'none');
51			})
52
53		}, 0
54	);
55}
56
57jQuery(document).ready(function ($) {
58	clearAnimation('#content');
59	$('#header-toggle').click(function (e) {
60
61		e.preventDefault();
62
63		$('body').toggleClass('toggled');
64
65	});
66
67	$('.img-block, .related_img').each(function () {
68
69		$(this).css('background-image', 'url(' + $(this).find('img').attr('src') + ')');
70
71	});
72
73	$('.slide-block ul li').each(function () {
74
75		$(this).css('background-image', 'url(' + $(this).find('img').attr('src') + ')');
76
77	});
78
79	$('.search .input-group .input-group-addon .dropdown .dropdown-menu  a').click(function (e) {
80
81		e.preventDefault();
82
83		$('#dLabel').html($(this).html() + ' <span class=\"caret\"></span>');
84
85	});
86
87	$('.js-toggle-search .dropdown .dropdown-menu  a').click(function (e) {
88
89		e.preventDefault();
90
91		$('#dSearch').html($(this).html() + ' <span class=\"caret\"></span>');
92		$('.js-toggle-search').find('input').focus();
93
94	});
95
96	$('.search-box-input .form-control').focus(function () {
97
98		$('.search-box .dropdown').addClass('visible');
99
100		$('.search-box .form-control').addClass('visible');
101
102	});
103
104	$(".download_photo .dropdown-menu li a").click(function () {
105
106		var selText = $(this).text();
107
108		$(this).parents('.btn-group').find('.dropdown-toggle').html(selText + ' <span class="caret"></span>');
109
110	});
111
112	var breadcrumbTitle = $('.breadcrumbs .breadcrumbs-list > li:first-child > a').text();
113
114	/*
115	 if (breadcrumbTitle != "") {
116	 $('#main_search').val(breadcrumbTitle);
117	 }
118	 else {
119	 $('#main_search').val('Articles');
120	 }
121	 $('.search-box-input #dLabel span:first-child').text(breadcrumbTitle);
122	 */
123	if ($("body").hasClass("page-template-page-photos") || $("body").hasClass("attachment")) {
124		$("#main_search").val('Photos').change();
125		$("#dSearch:contains('Articles')").replaceWith('<a id="dSearch" data-target="#" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-label-placement="">Photos<span class="caret"></span></a>');
126	}
127	else if ($("body").hasClass("page-template-page-albums") || $("body").hasClass("single-albums")) {
128		$("#main_search").val('Albums').change();
129		$("#dSearch:contains('Articles')").replaceWith('<a id="dSearch" data-target="#" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-label-placement="">Albums<span class="caret"></span></a>');
130	}
131});
132
133jQuery(window).load(function () {
134	jQuery("#wrapper").fadeIn();
135	sectionAnimation('#content');
136});
137
138
139jQuery(document.body).on('click', '.dropdown-menu li', function (event) {
140
141	var $target = jQuery(event.currentTarget);
142
143	if ($target.hasClass('main_search')) {
144		jQuery('#main_search').val($target.find('a').text());
145		jQuery('#dLabel').html($target.find('a').text() + '<span class="caret"></span>');
146	}
147
148	if ($target.hasClass('ps')) {
149		jQuery('#photo-select').attr('href', $target.find('a').data('href'));
150
151	}
152
153});
154
155jQuery(document).ready(function ($) {
156	var count = 2,
157		$container = jQuery('.grid');
158
159	//[data-structure!="article"]
160	var $container = jQuery('.grid');
161	if ($container.length > 0) {
162
163		$container.masonry({
164			itemSelector: '.grid-item'
165		});
166
167	}
168
169	window.is_processing = false;
170	$(window).scroll(function () {
171
172		$container.masonry('layout').masonry('reloadItems');
173		//console.log($(document).height(), $(window).height(), $(window).scrollTop(), $(document).height() - $(window).height());
174		//if ($(window).scrollTop() == $(document).height() - $(window).height()) {
175		if ($(window).scrollTop() + $(window).height() >= $(document).height() - 800) {
176			if (!window.is_processing) {
177				loadArticle(count);
178				count++;
179			}
180
181		}
182	});
183
184	// $container.on('layoutComplete',
185	// 	function (event, laidOutItems) {
186	// 		console.log('Masonry layout completed on ' +
187	// 			laidOutItems.length + ' items');
188	// 	}
189	// );
190
191	function loadArticle(pageNumber) {
192
193		if (jQuery('body').find('.latest-stories').length > 0) {
194			return;
195		}
196
197		window.is_processing = true;
198		$('#ajax_loader').fadeTo(1000, 1);
199		var $container = jQuery('.grid');
200
201
202		$.ajax({
203			url: "/wp-admin/admin-ajax.php",
204			type: "post",
205			dataType: "json",
206			data: {
207				action: "infinite_scroll",
208				paged: pageNumber,
209				type: window.page_type,
210					cat_type: window.cat_type,
211				usage: window.usage,
212				start_date: window.start_date,
213				max_date: window.max_date,
214				date1: window.date1,
215				is_search: window.is_search,
216				search_type: window.search_type,
217				search_string: window.search_string,
218				is_tax: window.is_tax,
219				tax_term: window.tax_term,
220				is_category: window.is_category,
221				category_term: window.category_term,
222				tax: window.tax,
223				terms: window.terms,
224				id: window.id
225			},
226			success: function (html) {
227				$('#ajax_loader').fadeTo(1000, 0);
228				if (html != null) {
229					$container.append(html.data);
230					$container.masonry('layout').masonry('reloadItems');
231				}
232				window.is_processing = false;
233			},
234			complete: function (html) {
235				$container.masonry('layout').masonry('reloadItems');
236				setTimeout(function () {
237					//console.log('masonry');
238					$container.masonry('layout').masonry('reloadItems');
239				}, 500);
240
241			}
242
243		});
244
245		//$container.masonry('layout').masonry('reloadItems');
246
247	}
248
249	$(".js-search").click(function () {
250		$(this).parent().find('.js-toggle-search').toggleClass('visible');
251		$(this).parent().find('input').focus();
252	})
253
254});
255
256jQuery(document.body).on('click', '#photo-select', function (e) {
257
258	e.preventDefault();
259
260	var _this = jQuery(this),
261		clone = jQuery('#photo-select-clone'),
262		args = {
263			action: 'image_download',
264			image_id: _this.data('image-id'),
265			size: _this.attr('href'),
266			user_id: _this.data('user-id'),
267			_wpnonce: _this.data('nonce')
268		};
269
270
271	jQuery.post('/wp-admin/admin-ajax.php', args, function (response) {
272
273		if (response) {
274			if (response.success === true) {
275				ga('send', {
276					hitType: 'event',
277					eventCategory: 'Photo downloads',
278					eventAction: _this.data('user-id'),
279					eventLabel: _this.data('image-id'),
280					eventValue: 1
281				});
282				clone.attr('href', response.data.href);
283				clone[0].click();
284			}
285		} else {
286			alert('Error downloading image');
287		}
288
289	});
290
291});
292
293
294jQuery(document.body).on('click', '.show_more', function (e) {
295
296	e.preventDefault();
297
298	var _this = jQuery(this),
299		showmore = jQuery('.showmore')
300
301	if (showmore.hasClass('opened')) {
302		_this.find('a').html('Show more <i class="fa fa-plus-square-o"></i>');
303		showmore.slideUp('slow', function () {
304			showmore.removeClass('opened');
305		});
306	} else {
307		_this.find('a').html('Show less <i class="fa fa-minus-square-o"></i>');
308		showmore.slideDown('slow', function () {
309			showmore.addClass('opened');
310		});
311	}
312
313});
314
315
316jQuery(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange', function (e) {
317	if (jQuery('body').hasClass('fullscreen')) {
318		jQuery('body').removeClass('fullscreen')
319	} else {
320		jQuery('body').addClass('fullscreen')
321	}
322
323});
324
325
326var breaking_news = jQuery('#breaking_news_rotator');
327
328var set_delay = 7000,
329	rotate_news = function () {
330
331		breaking_news.removeClass('is-visible');
332		//console.log(breaking_news.data('id'));
333		jQuery.ajax({
334
335			url: '/wp-admin/admin-ajax.php',
336			type: 'post',
337			dataType: 'json',
338			data: {
339				action: 'update_news',
340				id: breaking_news.data('id'),
341				_wpnonce: breaking_news.data('nonce')
342			},
343		})
344
345			.done(function (response) {
346				if (parseInt(breaking_news.data('id')) > 9) {
347					breaking_news.data('id', 0);
348				}
349
350				if (response.data !== '') {
351					breaking_news
352						.addClass('is-visible');
353					breaking_news.data('id', parseInt(breaking_news.data('id')) + 1);
354					// update breaking news
355					breaking_news.html(response.data);
356				} else {
357					breaking_news.data('id', 0);
358					rotate_news();
359				}
360
361
362			})
363			.always(function (response) {
364				if (response.data !== '') {
365					setTimeout(rotate_news, set_delay);
366				}
367			});
368
369	};
370
371// initial call
372/*
373setTimeout(function () {
374	rotate_news();
375}, set_delay);
376*/
377
378
379var body = jQuery('body'),
380	content = jQuery('#content'),
381	quickview_links = '.quick_view',
382	loader = body.find('.loader'),
383	popup = '#popup',
384	close_btn = '.close-overlay',
385	prev_btn = '.gsc-link-prev-link',
386	next_btn = '.gsc-link-next-link',
387	aside_slider = '.aside-slider',
388	side_block = '.side-block',
389	no_scroll_class = 'noscroll',
390	overlay = '.shot-overlay';
391
392
393jQuery(document).on('click', quickview_links, function (e) {
394
395	e.preventDefault();
396	var id = jQuery(this).data('id'),
397		type = jQuery(this).data('type');
398
399	jQuery.post(ajaxurl, {
400			action: 'show_information', /* action ajax hook name */
401			id: id,
402			type: type,
403			slug: jQuery(this).data('slug'),
404			_wpnonce: jQuery(this).data('nonce')
405		}, function (result) {
406			if (result) {
407				jQuery(popup).remove();
408				content.append(result);
409				content.find('.aside-slider').bxSlider();
410				body.addClass(no_scroll_class);
411
412				if (type == 'photos') {
413					window.history.pushState('photos', 'photo', '/photos/' + id);
414				}
415
416                // selectpicker for ajax content
417                jQuery('.selectpicker').selectpicker('refresh');
418			}
419		}
420	);
421
422
423});
424
425jQuery(document).on('click', close_btn, function (e) {
426
427	e.preventDefault();
428	jQuery(popup).remove();
429	body.removeClass(no_scroll_class);
430
431	window.history.pushState('albums', 'albums', window.page_url);
432
433
434});
435
436function load_post(pid, ptype, pslug) {
437
438	jQuery.post(ajaxurl, {
439			action: 'show_information', /* action ajax hook name */
440			id: pid,
441			type: ptype,
442			slug: pslug,
443			_wpnonce: jQuery(this).data('nonce')
444		}, function (result) {
445			if (result) {
446
447				jQuery(popup).html(result);
448				content.find('.aside-slider').bxSlider();
449				body.addClass(no_scroll_class);
450				window.history.pushState('photos', 'photo', '/photos/' + pid);
451
452                // selectpicker for ajax content
453                jQuery('.selectpicker').selectpicker('refresh');
454			}
455		}
456	);
457
458}
459
460jQuery(document).on('click', prev_btn, function (e) {
461	e.preventDefault();
462	load_post(jQuery(this).data('id'), jQuery(this).data('type'), jQuery(this).data('slug'));
463});
464
465jQuery(document).on('click', next_btn, function (e) {
466	e.preventDefault();
467	load_post(jQuery(this).data('id'), jQuery(this).data('type'), jQuery(this).data('slug'));
468});
469
470jQuery(document).ajaxComplete(function () {
471	var more_photos = jQuery(aside_slider),
472		numberOfImages = more_photos.find('img').length;
473
474	if (numberOfImages > 1) {
475		more_photos.bxSlider();
476	}
477});
478
479jQuery(document).on('click', overlay, function (e) {
480	if (e.target !== this)
481		return;
482
483	e.preventDefault();
484	jQuery(popup).remove();
485	body.removeClass(no_scroll_class);
486
487	window.history.pushState('albums', 'albums', window.page_url);
488
489});
490
491jQuery(document).keyup(function (e) {
492	if (e.keyCode == 27) {
493		if (jQuery(popup).length > 0) {
494			jQuery(popup).remove();
495		}
496		body.removeClass(no_scroll_class);
497
498		window.history.pushState('albums', 'albums', window.page_url);
499
500	}
501
502	if (e.keyCode == 37) {
503		e.preventDefault();
504		var prev = jQuery('.gsc-link-prev-link');
505
506		if (prev.length > 0) {
507			load_post(prev.data('id'), prev.data('type'), prev.data('slug'));
508		}
509	}
510
511	if (e.keyCode == 39) {
512		e.preventDefault();
513		var next = jQuery('.gsc-link-next-link');
514		if (next.length > 0) {
515			load_post(next.data('id'), next.data('type'), next.data('slug'));
516		}
517	}
518
519});
520
521jQuery(document).on('click', '.load-more-articles', function (e) {
522
523	e.preventDefault();
524	jQuery(popup).remove();
525
526	var offset, _this = jQuery(this);
527
528	if (typeof(_this.data('offset')) != 'undefined') {
529		offset = _this.data('offset') + 15;
530	} else {
531		offset = 15;
532	}
533
534	
535
536	jQuery.ajax({
537		url: '/wp-admin/admin-ajax.php',
538		dataType: 'json',
539		data: {
540			action: "load_more_articles",
541			offset: offset,
542			type: window.page_type,
543			cat_type: window.cat_type,
544			usage: window.usage,
545			start_date: window.start_date,
546			max_date: window.max_date,
547			date1: window.date1,
548			is_search: window.is_search,
549			search_type: window.search_type,
550			search_string: window.search_string,
551			is_tax: window.is_tax,
552			tax_term: window.tax_term,
553			is_category: window.is_category,
554			category_term: window.category_term,
555			
556		},
557		success: function (html) {
558
559			jQuery('.info-blocks-container').append(html.data);
560			_this.data('offset', offset);
561		}
562
563	});
564});
565
566jQuery(document).ready(function ($) {
567	var reg_form = jQuery('#registerform'),
568		reg_form1 = jQuery('#registerform1');
569
570	if (reg_form.length > 0) {
571		reg_form.validate({
572			rules: {
573				user_login : {
574					required: true,
575					minlength: 4
576				},
577				user_email: {
578					required: true,
579					email: true
580				},
581				pass1: {
582					required: true,
583					minlength: 6
584				},
585				pass2: {
586					required: true,
587					equalTo: "#pass1"
588				},
589				select_role: {
590					required: true
591				}
592			}
593		});
594	}
595
596	if (reg_form1.length > 0) {
597		reg_form1.validate({
598			rules: {
599				user_login : {
600					required: true,
601					minlength: 4
602				},
603				user_email1: {
604					required: true,
605					email: true
606				},
607				pass1: {
608					required: true,
609					minlength: 6
610				},
611				pass2: {
612					required: true,
613					equalTo: "#pass1"
614				},
615				user_phone1 : {
616					required: true
617				},
618				select_role: {
619					required: true
620				}
621			},
622			errorPlacement: function (error, element) {
623				var placement = $(element).data('error');
624				if (placement) {
625					$(placement).append(error)
626				} else {
627					error.insertAfter(element);
628				}
629			}
630		});
631	}
632});

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.