PageSourceSearch

https://www.emri.in/wp-content/themes/emri/js/_front.js?ver=1.0.0

js emri.in collected 2026-10-02 06:35:45 UTC 14,388 bytes, 409 lines download raw bytes

1/* global jQuery:false */
2var error_msg_box = null;
3
4jQuery(document).ready(function() {
5	"use strict";
6
7	// Disable select text on dbl click
8	/*
9	jQuery('.registration-popup-link').mousedown(function(e){
10		e.preventDefault();
11		return false;
12	})
13	jQuery('.registration-popup-link').select(function(e){
14		e.preventDefault();
15		return false;
16	})
17	*/
18
19	// Main menu substitute
20	jQuery('#mainmenu').mobileMenu();
21
22	// toTop link setup
23	jQuery(window).scroll(function() {
24		var s = jQuery(this).scrollTop();
25		if (s >= 110) {
26			jQuery('#toTop').show();
27		} else {
28			jQuery('#toTop').hide();	
29		}
30	});
31	jQuery('#toTop').click(function(e) {
32		jQuery('body,html').animate({scrollTop:0}, 800);
33		e.preventDefault();
34		return false;
35	});
36
37	// Search link
38	var linkWidth = 0;
39	jQuery('.search_link').click(function(e) {
40		if (jQuery('.search_link').width() < 50) {
41			linkWidth = jQuery('.search_link').width();
42			//jQuery('.header_icons').width(400);
43			//jQuery('.header_icons [class*="social"]').hide();
44			jQuery('.search_link').animate({width:'250px'}, 200);
45			jQuery('.search_over').animate({width:'250px'}, 200);
46			jQuery('#header_top_inner .header_icons .searchform').show();
47		} else if (jQuery('#header_top_inner .header_icons .field_search').val()!=='') {
48			jQuery('#header_top_inner .header_icons .searchform').get(0).submit();
49		} else {
50			jQuery('#header_top_inner .header_icons .searchform').hide();
51			jQuery('.search_link').animate({width:linkWidth+'px'}, 200);
52			jQuery('.search_over').animate({width:linkWidth+'px'}, 200);
53			//jQuery('.header_icons').animate({width:'280px'}, 200);
54			//jQuery('.header_icons [class*="social"]').show();
55		}
56		e.preventDefault();
57		return false;
58	});
59	// Search link
60	jQuery('.search_form_link').click(function(e) {
61		if (jQuery(this).parents('form').find('.field_search').val()!=='') {
62			jQuery(this).parents('form').get(0).submit();
63		}
64		e.preventDefault();
65		return false;
66	});
67	
68	// Login & registration link
69	jQuery('.link_login,.link_register,.popup_form .popup_title .popup_close').click(function(e) {
70		var obj = jQuery(this);
71		var popup = obj.hasClass('link_login') ? jQuery('#popup_login') : (obj.hasClass('link_register') ? jQuery('#popup_register') : jQuery(this).parents('.popup_form'));
72		if (popup.length === 1) {
73			if (popup.hasClass('visible')) {
74				popup.removeClass('visible').slideUp();
75			} else {
76				jQuery('.popup_form').removeClass('visible').fadeOut();
77				if (parseInt(popup.css('left'), 10) === 0) {
78					var offset = jQuery(this).offset();
79					popup.css({
80						left: offset.left-10,
81						top: offset.top+jQuery(this).height()+4
82					});
83				}
84				popup.addClass('visible').slideDown();
85			}
86		}
87		e.preventDefault();
88		return false;
89	});
90	jQuery('.popup_form form').keypress(function(e){
91		if (e.keyCode === 27) {
92			jQuery(this).parents('.popup_form').find('.popup_title .popup_close').trigger('click');
93			e.preventDefault();
94			return false;
95		} else if (e.keyCode === 13) {
96			jQuery(this).parents('.popup_form').find('.popup_button a').trigger('click');
97			e.preventDefault();
98			return false;
99		}
100	});
101	jQuery('#popup_login .popup_button a').click(function(e){
102		jQuery('#popup_login form input').removeClass('error_fields_class');
103		var error = formValidate(jQuery('#popup_login form'), {
104			error_message_show: true,
105			error_message_time: 4000,
106			error_message_class: 'sc_infobox sc_infobox_style_error',
107			error_fields_class: 'error_fields_class',
108			exit_after_first_error: true,
109			rules: [
110				{
111					field: "log",
112					min_length: { value: 1, message: LOGIN_EMPTY},
113					max_length: { value: 60, message: LOGIN_LONG}
114				},
115				{
116					field: "pwd",
117					min_length: { value: 4, message: PASSWORD_EMPTY},
118					max_length: { value: 20, message: PASSWORD_LONG}
119				}
120			]
121		});
122		if (!error) {
123			document.forms.login_form.submit();
124		}
125		e.preventDefault();
126		return false;
127	});
128	jQuery('#popup_register .popup_button a').click(function(e){
129		jQuery('#popup_register form input').removeClass('error_fields_class');
130		var error = formValidate(jQuery("#popup_register form"), {
131			error_message_show: true,
132			error_message_time: 4000,
133			error_message_class: "sc_infobox sc_infobox_style_error",
134			error_fields_class: "error_fields_class",
135			exit_after_first_error: true,
136			rules: [
137				{
138					field: "registration_username",
139					min_length: { value: 1, message: LOGIN_EMPTY },
140					max_length: { value: 60, message: LOGIN_LONG }
141				},
142				{
143					field: "registration_email",
144					min_length: { value: 7, message: EMAIL_EMPTY },
145					max_length: { value: 60, message: EMAIL_LONG },
146					mask: { value: "^([a-z0-9_\\-]+\\.)*[a-z0-9_\\-]+@[a-z0-9_\\-]+(\\.[a-z0-9_\\-]+)*\\.[a-z]{2,6}$", message: EMAIL_NOT_VALID }
147				},
148				{
149					field: "registration_pwd",
150					min_length: { value: 4, message: PASSWORD_EMPTY },
151					max_length: { value: 20, message: PASSWORD_LONG }
152				},
153				{
154					field: "registration_pwd2",
155					equal_to: { value: 'registration_pwd', message: PASSWORD_NOT_EQUAL }
156				}
157			]
158		});
159		if (!error) {
160			jQuery.post(ajax_url, {
161				action: 'registration_user',
162				nonce: ajax_nonce,
163				user_name: jQuery('#popup_register #registration_username').val(),
164				user_email: jQuery('#popup_register #registration_email').val(),
165				user_pwd: jQuery('#popup_register #registration_pwd').val()
166			}).done(function(response) {
167				var rez = JSON.parse(response);
168				var result_box = jQuery('#popup_register .result');
169				result_box.toggleClass('sc_infobox_style_error', false).toggleClass('sc_infobox_style_success', false);
170				if (rez.error === '') {
171					result_box.addClass('sc_infobox_style_success').html(REGISTRATION_SUCCESS);
172					setTimeout(function() { jQuery('#popup_register .popup_close').trigger('click'); jQuery('.link_login').trigger('click'); }, 2000);
173				} else {
174					result_box.addClass('sc_infobox_style_error').html(REGISTRATION_FAILED + ' ' + rez.error);
175				}
176				result_box.fadeIn();
177				setTimeout(function() { jQuery('#popup_register .result').fadeOut(); }, 5000);
178			});
179		}
180		e.preventDefault();
181		return false;
182	});
183
184	// Mainmenu
185	jQuery('#mainmenu').superfish({
186		autoArrows: false,
187		speed: 'fast',
188		speedOut: 'fast',
189		animation: {height:'show'},
190		animationOut: {opacity: 'hide'},
191		useClick: false,
192		delay: 100,
193		disableHI: true
194	});
195
196	// Video and Audio tag wrapper
197	jQuery('video,audio').mediaelementplayer(/* Options */);
198
199	// Pretty photo
200	jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").toggleClass('prettyPhoto', true);
201	jQuery("a[class*='prettyPhoto']").click(function(e) {
202		if (jQuery(window).width()<480)	{
203			e.stopImmediatePropagation();
204			window.location = jQuery(this).attr('href');
205		}
206		e.preventDefault();
207		return false;
208	});
209	jQuery("a[class*='prettyPhoto']").prettyPhoto({
210		social_tools: '',
211		theme: 'light_rounded'
212	});
213
214	// Galleries Slider
215	jQuery('.sc_slider_flex').flexslider({
216		directionNav: true,
217		controlNav: true,
218		animation: 'fade',
219		animationLoop: true,
220		slideshow: true,
221		slideshowSpeed: 7000,
222		animationSpeed: 600,
223		pauseOnAction: true,
224		pauseOnHover: false,
225		useCSS: false,
226		manualControls: '',
227		/*
228		start: function(slider){},
229		before: function(slider){},
230		after: function(slider){},
231		end: function(slider){},              
232		added: function(){},            
233		removed: function(){} 
234		*/
235	});
236	
237	// Elastislider links fix
238	jQuery(".sc_blogger_slider a").click(function(e) {
239		if (!jQuery(this).hasClass('image_zoom')) {
240			window.location.href = jQuery(this).attr("href");
241		}
242		e.preventDefault();
243		return false;
244	});
245	
246
247	// ----------------------- Shortcodes setup -------------------
248	jQuery('div.sc_infobox_closeable').click(function() {
249		jQuery(this).fadeOut();
250	});
251
252	jQuery('.sc_tooltip_parent').hover(function(){
253		var obj = jQuery(this);
254		obj.find('.sc_tooltip').stop().animate({'marginTop': '5'}, 100).show();
255	},
256	function(){
257		var obj = jQuery(this);
258		obj.find('.sc_tooltip').stop().animate({'marginTop': '0'}, 100).hide();
259	});
260	
261
262	// ----------------------- Comment form submit ----------------
263	jQuery("form#commentform").submit(function(e) {
264		var error = formValidate(jQuery(this), {
265			error_message_text: GLOBAL_ERROR_TEXT,	// Global error message text (if don't write in checked field)
266			error_message_show: true,				// Display or not error message
267			error_message_time: 5000,				// Error message display time
268			error_message_class: 'sc_infobox sc_infobox_style_error',	// Class appended to error message block
269			error_fields_class: 'error_fields_class',					// Class appended to error fields
270			exit_after_first_error: false,								// Cancel validation and exit after first error
271			rules: [
272				{
273					field: 'author',
274					min_length: { value: 1, message: NAME_EMPTY},
275					max_length: { value: 60, message: NAME_LONG}
276				},
277				{
278					field: 'email',
279					min_length: { value: 7, message: EMAIL_EMPTY},
280					max_length: { value: 60, message: EMAIL_LONG},
281					mask: { value: '^([a-z0-9_\\-]+\\.)*[a-z0-9_\\-]+@[a-z0-9_\\-]+(\\.[a-z0-9_\\-]+)*\\.[a-z]{2,6}$', message: EMAIL_NOT_VALID}
282				},
283				{
284					field: 'comment',
285					min_length: { value: 1, message: MESSAGE_EMPTY },
286					max_length: { value: 400, message: MESSAGE_LONG}
287				}
288			]
289		});
290		if (error) { e.preventDefault(); }
291		return !error;
292	});
293
294	/* ================== Customize site ========================= */
295	if (jQuery("#custom_options").length===1) {
296		jQuery('#co_toggle').click(function(e) {
297			var co = jQuery('#custom_options').eq(0);
298			if (co.hasClass('opened')) {
299				co.removeClass('opened').animate({marginRight:-237}, 300);
300			} else {
301				co.addClass('opened').animate({marginRight:-15}, 300);
302			}
303			e.preventDefault();
304			return false;
305		});
306		// Body style
307		jQuery("#custom_options .switcher a" ).draggable({
308			axis: 'x',
309			containment: 'parent',
310			stop: function() {
311				var left = parseInt(jQuery(this).css('left'), 10);
312				var curStyle = left < 25 ? 'wide' : 'boxed';
313				switchBox(jQuery(this).parent(), curStyle, true);
314			}
315		});
316		jQuery("#custom_options .switcher" ).click(function(e) {
317			switchBox(jQuery(this));
318			e.preventDefault();
319			return false;
320		});
321		jQuery("#custom_options .co_switch_box .boxed" ).click(function(e) {
322			switchBox(jQuery('#custom_options .switcher'), 'boxed');
323			e.preventDefault();
324			return false;
325		});
326		jQuery("#custom_options .co_switch_box .stretched" ).click(function(e) {
327			switchBox(jQuery('#custom_options .switcher'), 'wide');
328			e.preventDefault();
329			return false;
330		});
331		// Main theme color and Background color
332		var clickedObj = null;
333		jQuery('#custom_options .colorSelector').ColorPicker({
334			onBeforeShow: function () {
335				clickedObj = jQuery(this);
336				jQuery(this).ColorPickerSetColor(jQuery(this).siblings('input').attr('value'));
337			},
338			onShow: function (colpkr) {
339				jQuery(colpkr).fadeIn(500);
340				return false;
341			},
342			onHide: function (colpkr) {
343				jQuery(colpkr).fadeOut(500);
344				return false;
345			},
346			onSubmit: function (hsb, hex, rgb) {
347				jQuery(clickedObj).find('div').css('backgroundColor', '#' + hex);
348				jQuery(clickedObj).siblings('input').attr('value','#' + hex);
349				if (clickedObj.attr('id')==='co_theme_color') {
350					jQuery.cookie('theme_color', '#' + hex, {expires: 365, path: '/'});
351					window.location = jQuery("#custom_options #co_site_url").val();
352				} else {
353					jQuery("#custom_options .co_switch_box .boxed").trigger('click');
354					jQuery('#custom_options #co_bg_pattern_list .co_pattern_wrapper,#custom_options #co_bg_images_list .co_image_wrapper').removeClass('current');
355					jQuery.cookie('bg_image', null, {expires: -1, path: '/'});
356					jQuery.cookie('bg_pattern', null, {expires: -1, path: '/'});
357					jQuery.cookie('bg_color', '#' + hex, {expires: 365, path: '/'});
358					jQuery(document).find('body').removeClass('bg_pattern_1 bg_pattern_2 bg_pattern_3 bg_pattern_4 bg_pattern_5 bg_image_1 bg_image_2 bg_image_3').css('backgroundColor', '#'+hex);
359				}
360			}
361		});
362		// Background patterns
363		jQuery('#custom_options #co_bg_pattern_list a').click(function(e) {
364			jQuery("#custom_options .co_switch_box .boxed").trigger('click');
365			jQuery('#custom_options #co_bg_pattern_list .co_pattern_wrapper,#custom_options #co_bg_images_list .co_image_wrapper').removeClass('current');
366			var obj = jQuery(this).addClass('current');
367			var val = obj.attr('id').substr(-1);
368			jQuery.cookie('bg_color', null, {expires: -1, path: '/'});
369			jQuery.cookie('bg_image', null, {expires: -1, path: '/'});
370			jQuery.cookie('bg_pattern', val, {expires: 365, path: '/'});
371			jQuery(document).find('body').removeClass('bg_pattern_1 bg_pattern_2 bg_pattern_3 bg_pattern_4 bg_pattern_5 bg_image_1 bg_image_2 bg_image_3').addClass('bg_pattern_' + val);
372			e.preventDefault();
373			return false;
374		});
375		// Background images
376		jQuery('#custom_options #co_bg_images_list a').click(function(e) {
377			jQuery("#custom_options .co_switch_box .boxed").trigger('click');
378			jQuery('#custom_options #co_bg_images_list .co_image_wrapper,#custom_options #co_bg_pattern_list .co_pattern_wrapper').removeClass('current');
379			var obj = jQuery(this).addClass('current');
380			var val = obj.attr('id').substr(-1);
381			jQuery.cookie('bg_color', null, {expires: -1, path: '/'});
382			jQuery.cookie('bg_pattern', null, {expires: -1, path: '/'});
383			jQuery.cookie('bg_image', val, {expires: 365, path: '/'});
384			jQuery(document).find('body').removeClass('bg_pattern_1 bg_pattern_2 bg_pattern_3 bg_pattern_4 bg_pattern_5 bg_image_1 bg_image_2 bg_image_3').addClass('bg_image_' + val);
385			e.preventDefault();
386			return false;
387		});
388	}
389	/* ================== /Customize site ========================= */
390});
391
392function switchBox(box) {
393	"use strict";
394	var toStyle = arguments[1] ? arguments[1] : '';
395	var important = arguments[2] ? arguments[2] : false;
396	var switcher = box.find('a').eq(0);
397	var left = parseInt(switcher.css('left'), 10);
398	var newStyle = left < 5 ? 'boxed' : 'wide';
399	if (toStyle==='' || important || newStyle === toStyle) {
400		if (toStyle==='') {toStyle = newStyle;}
401		var right = box.width() - switcher.width() + 2;
402		if (toStyle === 'wide') {switcher.animate({left: -2}, 200);}
403		else {switcher.animate({left: right}, 200);}
404		jQuery.cookie('body_style', toStyle, {expires: 365, path: '/'});
405		jQuery(document).find('body').removeClass(toStyle==='boxed' ? 'wide' : 'boxed').addClass(toStyle);
406		jQuery(document).trigger('resize');
407	}
408	return newStyle;
409}

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.