PageSourceSearch

https://ppinkydolls.com/wp-content/themes/melania/js/_init.js

js ppinkydolls.com collected 2026-09-28 01:38:49 UTC 43,409 bytes, 1,230 lines download raw bytes

1/* global jQuery:false */
2/* global MARIANA_HANDMADE_STORAGE:false */
3
4
5// Disable init VC prettyPhoto on the gallery images
6window.vc_prettyPhoto = function() {};
7
8
9jQuery(document).ready(function() {
10	"use strict";
11	MARIANA_HANDMADE_STORAGE['theme_init_counter'] = 0;
12	mariana_handmade_init_actions();
13});
14
15jQuery(window).on('beforeunload', function() {
16	"use strict";
17	// Show preloader
18	jQuery('#page_preloader').css({display: 'block', opacity: 0}).animate({opacity:0.8}, 300);
19});
20
21
22// Theme init actions
23function mariana_handmade_init_actions() {
24	"use strict";
25
26	if (MARIANA_HANDMADE_STORAGE['vc_edit_mode'] && jQuery('.vc_empty-placeholder').length==0 && MARIANA_HANDMADE_STORAGE['theme_init_counter']++ < 30) {
27		setTimeout(mariana_handmade_init_actions, 200);
28		return;
29	}
30
31    jQuery('.content article.post_item .post_content a.more-link').each(function() {
32        "use strict";
33        var icon = '<span class="more-icon"></span>';
34        jQuery(this).before(icon);
35    });
36
37    if (MARIANA_HANDMADE_STORAGE['use_ajax_views_counter']) {
38        jQuery(document).ready(function() {
39            setTimeout(function(){
40                jQuery.post(MARIANA_HANDMADE_STORAGE['ajax_url'], {
41                    action: 'post_counter',
42                    nonce: MARIANA_HANDMADE_STORAGE['ajax_nonce'],
43                    post_id: MARIANA_HANDMADE_STORAGE['post_id'],
44                    views: MARIANA_HANDMADE_STORAGE['views']
45                });
46            }, 10);
47        });
48    }
49
50    hot_spot_hover();
51
52	(function(html){
53		html.className = html.className.replace(/\bno-js\b/,"js")
54	})(document.documentElement);
55
56    function hot_spot_hover() {
57        jQuery('.hot_spot_hover').hover(function() {
58                var klass = jQuery(this).attr('data-class');
59                jQuery('[data-class=' + klass + ']').addClass('hovered');
60                jQuery(this).addClass('hovered');
61            },
62            function() {
63                var klass = jQuery(this).attr('data-class');
64                jQuery('[data-class=' + klass + ']').removeClass('hovered');
65                jQuery(this).removeClass('hovered');
66            }
67        );
68    }
69
70
71	// Hide preloader
72	jQuery('#page_preloader').animate({opacity:0}
72, 300).css({display: 'none'});
73
74	// Check for Retina display
75	if (mariana_handmade_is_retina()) {
76		mariana_handmade_set_cookie('mariana_handmade_retina', 1, 365);
77	}
78
79	mariana_handmade_ready_actions();
80	mariana_handmade_resize_actions();
81	mariana_handmade_scroll_actions();
82
83	// Resize handlers
84	jQuery(window).resize(function() {
85		"use strict";
86		mariana_handmade_resize_actions();
87	});
88
89	// Scroll handlers
90	jQuery(window).scroll(function() {
91		"use strict";
92		mariana_handmade_scroll_actions();
93	});
94}
95
96
97
98// Theme first load actions
99//==============================================
100function mariana_handmade_ready_actions() {
101	"use strict";
102
103
104	// Menu
105    //----------------------------------------------
106
107	// Clone side menu for responsive
108	if (jQuery('ul#menu_side').length > 0) {
109		jQuery('ul#menu_side').clone().removeAttr('id').removeClass('menu_side_nav').addClass('menu_side_responsive').insertAfter('ul#menu_side');
110		mariana_handmade_show_current_menu_item(jQuery('.menu_side_responsive'), jQuery('.sidebar_outer_menu_responsive_button'));
111	}
112
113	// Clone main menu for responsive
114	if (jQuery('ul#menu_main').length > 0) {
115		var menu_responsive = jQuery('ul#menu_main').clone().removeAttr('id').removeClass('menu_main_nav').addClass('menu_main_responsive');	//.insertAfter('ul#menu_main');
116		jQuery('ul#menu_main').parent().parent().append(menu_responsive);
117		mariana_handmade_show_current_menu_item(jQuery('.menu_main_responsive'), jQuery('.menu_main_responsive_button'));
118	}
119	
120	// Responsive menu button
121	jQuery('.menu_main_responsive_button, .sidebar_outer_menu_responsive_button').on('click', function(e){
122		"use strict";
123		jQuery(this).toggleClass('opened');
124		if (jQuery(this).hasClass('menu_main_responsive_button'))
125			jQuery('.menu_main_responsive').slideToggle();
126		else {
127			jQuery(this).toggleClass('icon-down').toggleClass('icon-up');
128			jQuery('.menu_side_responsive').slideToggle();
129		}
130		e.preventDefault();
131		return false;
132	});
133	
134	// Side menu widgets button
135	jQuery('.sidebar_outer_widgets_button').on('click', function(e){
136		"use strict";
137		jQuery('.sidebar_outer_widgets').slideToggle();
138		e.preventDefault();
139		return false;
140	});
141
142	// Submenu click handler for the responsive menu
143	jQuery('.menu_main_responsive, .menu_side_responsive').on('click', 'li a', function(e) {
144		"use strict";
145		var is_menu_main = jQuery(this).parents('.menu_main_responsive').length > 0;
146		if ((!is_menu_main || jQuery('body').hasClass('menu_mode_responsive')) && jQuery(this).parent().hasClass('menu-item-has-children')) {
147			if (jQuery(this).siblings('ul:visible').length > 0)
148				jQuery(this).siblings('ul').slideUp().parent().removeClass('opened');
149			else
150				jQuery(this).siblings('ul').slideDown().parent().addClass('opened');
151		}
152		if (jQuery(this).attr('href')=='#' || ((!is_menu_main || jQuery('body').hasClass('menu_mode_responsive')) && jQuery(this).parent().hasClass('menu-item-has-children'))) {
153			e.preventDefault();
154			return false;
155		}
156	});
157	
158	// Init superfish menus
159	mariana_handmade_init_sfmenu('ul#menu_main, ul#menu_side');
160	
161	// Store height of the top panel
162	MARIANA_HANDMADE_STORAGE['top_panel_height'] = 0;
163
164
165
166	// Search form
167    //----------------------------------------------
168	if (jQuery('.search_wrap:not(.inited)').length > 0) {
169		jQuery('.search_wrap:not(.inited)').each(function() {
170			"use strict";
171			jQuery(this).addClass('inited');
172			// Focus/Blur in search field
173			jQuery(this).find('.search_field').focus(function(e) {
174				"use strict";
175				jQuery(this).attr('data-width', jQuery(this).outerWidth()).parents('.search_wrap').find('.search_field').animate({'width':'16em'}, 300, 'linear');
176			});
177			jQuery(this).find('.search_field').focusout(function(e) {
178				"use strict";
179				jQuery(this).animate({'width':jQuery(this).data('width')}, 300, 'linear');
180			});
181			// Click "Search submit"
182			jQuery(this).find('.search_submit').on('click', function(e) {
183				"use strict";
184				var search_wrap = jQuery(this).parents('.search_wrap');
185				if (search_wrap.find('.search_field').val() != '')
186					search_wrap.find('form').get(0).submit();
187				e.preventDefault();
188				return false;
189			});
190			// Click "Close search results"
191			jQuery(this).find('.search_results_close').on('click', function(e) {
192				"use strict";
193				jQuery(this).parent().fadeOut();
194				e.preventDefault();
195				return false;
196			});
197			// Click "More results"
198			jQuery(this).on('click', '.search_more', function(e) {
199				"use strict";
200				if (jQuery(this).parents('.search_wrap').find('.search_field').val() != '')
201					jQuery(this).parents('.search_wrap').find('form').get(0).submit();
202				e.preventDefault();
203				return false;
204			});
205			// AJAX search
206			if (jQuery(this).hasClass('search_ajax')) {
207				var ajax_timer = null;
208				jQuery(this).find('.search_field').keyup(function(e) {
209					"use strict";
210					var search_field = jQuery(this);
211					var s = search_field.val();
212					if (ajax_timer) {
213						clearTimeout(ajax_timer);
214						ajax_timer = null;
215					}
216					if (s.length >= 4) {
217						ajax_timer = setTimeout(function() {
218							jQuery.post(MARIANA_HANDMADE_STORAGE['ajax_url'], {
219								action: 'ajax_search',
220								nonce: MARIANA_HANDMADE_STORAGE['ajax_nonce'],
221								text: s
222							}).done(function(response) {
223								"use strict";
224								clearTimeout(ajax_timer);
225								ajax_timer = null;
226								var rez = {};
227								try {
228									rez = JSON.parse(response);
229								} catch (e) {
230									rez = { error: MARIANA_HANDMADE_STORAGE['search_error'] };
231									console.log(response);
232								}
233								var msg = rez.error === '' ? rez.data : rez.error;
234								search_field.parents('.search_ajax').find('.search_results_content').empty().append(rez.data);
235								search_field.parents('.search_ajax').find('.search_results').fadeIn();
236							});
237						}, 500);
238					}
239				});
240			}
241		});
242	}
243	
244
245
246	// Widgets decoration
247    //----------------------------------------------
248
249	// Decorate nested lists in widgets and side panels
250	jQuery('.widget ul > li').each(function() {
251		"use strict";
252		if (jQuery(this).find('ul').length > 0) {
253			jQuery(this).addClass('has_children');
254		}
255	});
256
257	// Archive widget decoration
258	jQuery('.widget_archive a').each(function() {
259		"use strict";
260		var val = jQuery(this).html().split(' ');
261		if (val.length > 1) {
262			val[val.length-1] = '<span>' + val[val.length-1] + '</span>';
263			jQuery(this).html(val.join(' '))
264		}
265	});
266
267	// Calendar widget decoration
268	jQuery('.widget_calendar .wp-calendar-nav-prev a, .wp-block-calendar .wp-calendar-nav-prev a').each(function() {
269		"use strict";
270		var val = jQuery(this).html().split(' ');
271		if (val.length > 1) {
272			val[0] = '<span class="icon-left"></span>';
273			jQuery(this).html(val.join(''))
274		}
275	});
276	jQuery('.widget_calendar .wp-calendar-nav-next a, .wp-block-calendar .wp-calendar-nav-next a').each(function() {
277		"use strict";
278		var val = jQuery(this).html().split(' ');
279		if (val.length > 1) {
280			val[val.length-1] = '<span class="icon-right"></span>';
281			jQuery(this).html(val.join(''))
282		}
283	});
284
285
286	// Forms validation
287    //----------------------------------------------
288
289	jQuery("select:visible").wrap('<div class="select_container"></div>');
290
291	// Bubble submit() up for widget "Categories"
292	if ( jQuery("select:visible").parents( '.widget_categories' ).length > 0 ) {
293		jQuery("select:visible").parent().each( function (ind, item) { jQuery(item).get(0).submit = function() {
294			jQuery(item).closest('form').submit();
295		}; }); }
296
297	// Comment form
298	jQuery("form#commentform").submit(function(e) {
299		"use strict";
300		var rez = mariana_handmade_comments_validate(jQuery(this));
301		if (!rez)
302			e.preventDefault();
303		return rez;
304	});
305
306	// Contact form
307	if (jQuery('.sc_contact_form:not(.inited)').length > 0) {
308		jQuery(".sc_contact_form:not(.inited)")
309			.addClass('inited')
310			.find('form')
311			.submit(function(e) {
312				"use strict";
313				mariana_handmade_contact_form_validate(jQuery(this));
314				e.preventDefault();
315				return false;
316			});
317	}
318
319
320
321	// Socials share
322    //----------------------------------------------
323	if (jQuery('.post_counters_item .socials_caption:not(.inited)').length > 0) {
324		jQuery('.post_counters_item .socials_caption:not(.inited)').each(function() {
325			"use strict";
326			jQuery(this).addClass('inited').on('click', function(e) {
327				"use strict";
328				jQuery(this).siblings('.social_items').fadeToggle();
329				e.preventDefault();
330				return false;
331			});
332		});
333	}
334	if (jQuery('.post_counters_item .social_items:not(.inited)').length > 0) {
335		jQuery('.post_counters_item .social_items:not(.inited)').each(function() {
336			"use strict";
337			jQuery(this).addClass('inited').on('click', '.social_item_popup > a.social_icons', function(e) {
338				"use strict";
339				var url = jQuery(this).data('link');
340				window.open(url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=480, height=400, toolbar=0, status=0');
341				e.preventDefault();
342				return false;
343			});
344		});
345	}
346	// PinIt link
347	if (jQuery('.label_pinit:not(.inited)').length > 0) {
348		jQuery('.label_pinit:not(.inited)').each(function() {
349			"use strict";
350			jQuery(this).addClass('inited').on('click', function(e) {
351				"use strict";
352				var url = jQuery(this).attr('href');
353				window.open(url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=480, height=400, toolbar=0, status=0');
354				e.preventDefault();
355				return false;
356			});
357		});
358	}
359
360	// Tabs
361    //------------------------------------
362	if (jQuery('.sc_tabs:not(.inited)').length > 0) {
363		jQuery('.sc_tabs:not(.inited)').each(function () {
364			"use strict";
365			var init = jQuery(this).data('active');
366			if (isNaN(init)) init = 0;
367			else init = Math.max(0, init);
368			if (jQuery.ui && jQuery.ui.tabs) {
369				jQuery(this).addClass('inited').tabs({
370					active: init,
371					show: {
372						effect: 'fadeIn',
373						duration: 300
374					},
375					hide: {
376						effect: 'fadeOut',
377						duration: 300
378					}
379				});
380			}
381		});
382	}
383
384
385	// Shortcodes handlers
386    //------------------------------------
387
388	// Recent news widget and sc
389	jQuery('.sc_recent_news_header_category_item_more').on('click', function() {
390		"use strict";
391		jQuery(this).toggleClass('opened').find('.sc_recent_news_header_more_categories').slideToggle();
392	});
393		
394
395	// WooCommerce
396    //----------------------------------------------
397
398	// Change display mode
399	jQuery('.woocommerce,.woocommerce-page').on('click', '.mariana_handmade_shop_mode_buttons a', function(e) {
400		"use strict";
401		var mode = jQuery(this).hasClass('woocommerce_thumbs') ? 'thumbs' : 'list';
402		mariana_handmade_set_cookie('mariana_handmade_shop_mode', mode, 365);
403		jQuery(this).siblings('input').val(mode).parents('form').get(0).submit();
404		e.preventDefault();
405		return false;
406	});
407
408    // Add buttons to quantity on first run
409    if (jQuery('.woocommerce div.quantity .q_inc,.woocommerce-page div.quantity .q_inc').length == 0) {
410        var woocomerce_inc_dec = '<span class="q_inc"></span><span class="q_dec"></span>';
411        jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append(woocomerce_inc_dec);
412        jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').on('click', '>span', function(e) {
413            woocomerce_inc_dec_click(jQuery(this));
414            e.preventDefault();
415            return false;
416        });
417    }
418	// Add buttons to quantity after the cart is updated
419    jQuery(document.body).on('updated_wc_div', function() {
420        if (jQuery('.woocommerce div.quantity .q_inc,.woocommerce-page div.quantity .q_inc').length == 0) {
421            jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').append(woocomerce_inc_dec);
422            jQuery('.woocommerce div.quantity,.woocommerce-page div.quantity').on('click', '>span', function(e) {
423                woocomerce_inc_dec_click(jQuery(this));
424                e.preventDefault();
425                return false;
426            });
427        }
428    });
429    // Inc/Dec quantity on buttons inc/dec
430    function woocomerce_inc_dec_click(button) {
431        var f = button.siblings('input');
432		if (button.hasClass( 'q_inc' )) {
433			f.val( ( f.val() == '' ? 0 : parseInt( f.val(), 10 ) ) + 1 ).trigger( 'change' );
434		} else {
435			f.val( Math.max( 0, ( f.val() == '' ? 0 : parseInt( f.val(), 10 ) ) - 1 ) ).trigger( 'change' );
436		}
437    }
438
439
440
441    // Add stretch behaviour to WooC tabs area
442	jQuery('.single-product .woocommerce-tabs').wrap('<div class="trx-stretch-width scheme_light"></div>');
443	jQuery('.trx-stretch-width').after('<div class="trx-stretch-width-original"></div>');
444	mariana_handmade_stretch_width();
445
446    // Checkbox with "I agree..."
447    if (jQuery('input[type="checkbox"][name="i_agree_privacy_policy"]:not(.inited),input[type="checkbox"][name="gdpr_terms"]:not(.inited),input[type="checkbox"][name="wpgdprc"]:not(.inited)').length > 0) {
448        jQuery('input[type="checkbox"][name="i_agree_privacy_policy"]:not(.inited),input[type="checkbox"][name="gdpr_terms"]:not(.inited),input[type="checkbox"][name="wpgdprc"]:not(.inited)')
449            .addClass('inited')
450            .on('change', function(e) {
451                if (jQuery(this).get(0).checked)
452                    jQuery(this).parents('form').find('button,input[type="submit"]').removeAttr('disabled');
453                else
454                    jQuery(this).parents('form').find('button,input[type="submit"]').attr('disabled', 'disabled');
455            }).trigger('change');
456    }
457		
458
459	// Other settings
460    //------------------------------------
461
462	// Scroll to top button
463	jQuery('.scroll_to_top').on('click', function(e) {
464		"use strict";
465		jQuery('html,body').animate({
466			scrollTop: 0
467		}, 'slow');
468		e.preventDefault();
469		return false;
470	});
471
472	// Init post format specific scripts
473	mariana_handmade_init_post_formats();
474
475	// Init hidden elements (if exists)
476	if (window.mariana_handmade_init_hidden_elements) mariana_handmade_init_hidden_elements(jQuery('body').eq(0));
477	
478} //end ready
479
480
481
482
483// Scroll actions
484//==============================================
485
486// Do actions when page scrolled
487function mariana_handmade_scroll_actions() {
488	"use strict";
489
490	var scroll_offset = jQuery(window).scrollTop();
491	var scroll_to_top_button = jQuery('.scroll_to_top');
492	var adminbar_height = Math.max(0, jQuery('#wpadminbar').height());
493
494	if (MARIANA_HANDMADE_STORAGE['top_panel_height'] == 0)	MARIANA_HANDMADE_STORAGE['top_panel_height'] = jQuery('.top_panel_wrap').height();
495
496	// Call skin specific action (if exists)
497    //----------------------------------------------
498	if (window.mariana_handmade_skin_scroll_actions) mariana_handmade_skin_scroll_actions();
499
500
501	// Scroll to top button show/hide
502	if (scroll_offset > MARIANA_HANDMADE_STORAGE['top_panel_height'])
503		scroll_to_top_button.addClass('show');
504	else
505		scroll_to_top_button.removeClass('show');
506	
507	// Fix/unfix top panel
508	if (!jQuery('body').hasClass('menu_mode_responsive')) {
509		var slider_height = 0;
510		var logo_height = 0;
511		if (jQuery('.top_panel_logo').length > 0) {
512			logo_height = jQuery('.top_panel_logo').height();
513		}
514		if (scroll_offset <= logo_height + slider_height + MARIANA_HANDMADE_STORAGE['top_panel_height']) {
515			if (jQuery('body').hasClass('top_panel_fixed')) {
516				jQuery('body').removeClass('top_panel_fixed');
517			}
518		} else if (scroll_offset > logo_height + slider_height + MARIANA_HANDMADE_STORAGE['top_panel_height']) {
519			if (!jQuery('body').hasClass('top_panel_fixed') && jQuery(document).height() > jQuery(window).height()*1.5) {
520				jQuery('.top_panel_fixed_wrap').height(MARIANA_HANDMADE_STORAGE['top_panel_height']);
521				jQuery('.top_panel_wrap').css('marginTop', '-150px').animate({'marginTop': 0}, 500);
522				jQuery('body').addClass('top_panel_fixed');
523			}
524		}
525	}
526	
527	// Fix/unfix sidebar
528	mariana_handmade_fix_sidebar();
529	
530	// Scroll actions for animated elements
531	jQuery('[data-animation^="animated"]:not(.animated)').each(function() {
532		"use strict";
533		if (jQuery(this).offset().top < jQuery(window).scrollTop() + jQuery(window).height())
534			jQuery(this).addClass(jQuery(this).data('animation'));
535	});
536}
537
538
539
540// Resize actions
541//==============================================
542
543// Do actions when page scrolled
544function mariana_handmade_resize_actions() {
545	"use strict";
546	mariana_handmade_responsive_menu();
547	mariana_handmade_video_dimensions();
548	mariana_handmade_fix_sidebar();
549	mariana_handmade_sc_sliders_resize();
550	mariana_handmade_stretch_width();
551}
552
553// Stretch area to full window width
554function mariana_handmade_stretch_width() {
555	"use strict";
556	jQuery('.trx-stretch-width').each(function() {
557		var $el = jQuery(this);
558		var $el_cont = $el.parents('.page_wrap');
559		var $el_cont_offset = 0;
560		if ($el_cont.length == 0) 
561			$el_cont = jQuery(window);
562		else
563			$el_cont_offset = $el_cont.offset().left;
564		var $el_full = $el.next('.trx-stretch-width-original');
565		var el_margin_left = parseInt( $el.css( 'margin-left' ), 10 );
566		var el_margin_right = parseInt( $el.css( 'margin-right' ), 10 );
567		var offset = $el_cont_offset - $el_full.offset().left - el_margin_left;
568		var width = $el_cont.width();
569		if (!$el.hasClass('inited')) {
570			$el.addClass('inited invisible');
571			$el.css({
572				'position': 'relative',
573				'box-sizing': 'border-box'
574			});
575		}
576		$el.css({
577			'left': offset,
578			'width': $el_cont.width()
579		});
580		if ( !$el.hasClass('trx-stretch-content') ) {
581			var padding = Math.max(0, -1*offset);
582			var paddingRight = Math.max(0, width - padding - $el_full.width() + el_margin_left + el_margin_right);
583			$el.css( { 'padding-left': padding + 'px', 'padding-right': paddingRight + 'px' } );
584		}
585		$el.removeClass('invisible');
586	});
587}
588
589
590// Fix/unfix sidebar
591function mariana_handmade_fix_sidebar() {
592	"use strict";
593	var sb = jQuery('.sidebar');
594	if (sb.length > 0) {
595		var content = jQuery('.page_content_wrap .content_wrap');
596
597		// Unfix on responsive
598		if (content.width() < 900) {
599			if (sb.css('position')=='fixed') {
600				sb.css({
601					'float': sb.hasClass('right') ? 'right' : 'left',
602					'position': 'static'
603				});
604			}
605
606		} else {
607
608			var sb_height = sb.outerHeight();
609			var content_height = sb.siblings('.content').outerHeight();
610			var scroll_offset = jQuery(window).scrollTop();
611			var logo_height = jQuery('.top_panel_logo').length > 0 ? jQuery('.top_panel_logo').height() : 0;
612			var slider_height = jQuery('.slider_wrap').length > 0 ? jQuery('.slider_wrap').height() : 0;
613			var menu_height = jQuery('.top_panel_wrap').length > 0 ? jQuery('.top_panel_wrap').height() : 0;
614			var widgets_above_page_height = jQuery('.widgets_above_page_wrap').length > 0 ? jQuery('.widgets_above_page_wrap').height() : 0;
615			var page_padding = parseInt(jQuery('.page_content_wrap').css('paddingTop'));
616			if (isNaN(page_padding)) page_padding = 0;
617
618			if (sb_height < content_height && 
619				(sb_height >= jQuery(window).height() && scroll_offset + jQuery(window).height() > sb_height+logo_height+menu_height+slider_height+widgets_above_page_height+page_padding
620				||
621				sb_height < jQuery(window).height() && scroll_offset > logo_height+slider_height+widgets_above_page_height+page_padding )
622				) {
623				
624				// Fix when sidebar bottom appear
625				if (sb.css('position')!=='fixed') {
626					sb.css({
627						'float': 'none',
628						'position': 'fixed',
629						'top': Math.min(0, jQuery(window).height() - sb_height) + 'px'
630					});
631				}
632				
633				// Detect horizontal position when resize
634				var pos = jQuery('.page_content_wrap .content_wrap').position();
635				pos = pos.left + Math.max(0, parseInt(jQuery('.page_content_wrap .content_wrap').css('paddingLeft'))) + Math.max(0, parseInt(jQuery('.page_content_wrap .content_wrap').css('marginLeft')));
636				if (sb.hasClass('right'))
637					sb.css({ 'right': pos });
638				else
639					sb.css({ 'left': pos });
640				
641				// Shift to top when footer appear
642				var footer_top = 0;
643				var footer_pos = jQuery('.footer_wrap').position();
644				var widgets_below_page_pos = jQuery('.widgets_below_page_wrap').position();
645				var copyright_pos = jQuery('.copyright_wrap').position();
646				if (widgets_below_page_pos)
647					footer_top = widgets_below_page_pos.top;
648				else if (footer_pos)
649					footer_top = footer_pos.top;
650				else if (copyright_pos)
651					footer_top = copyright_pos.top;
652				if (footer_top > 0 && scroll_offset + jQuery(window).height() > footer_top)
653					sb.css({
654						'top': Math.min(menu_height+page_padding, jQuery(window).height() - sb_height - (scroll_offset + jQuery(window).height() - footer_top + 30)) + 'px'
655					});
656				else
657					sb.css({
658						'top': Math.min(menu_height+page_padding, jQuery(window).height() - sb_height) + 'px'
659					});
660				
661
662			} else {
663
664				// Unfix when page scrolling to top
665				if (sb.css('position')=='fixed') {
666					sb.css({
667						'float': sb.hasClass('right') ? 'right' : 'left',
668						'position': 'static',
669						'top': 'auto',
670						'left': 'auto',
671						'right': 'auto'
672					});
673				}
674
675			}
676		}
677	}
678}
679
680
681// Check window size and do responsive menu
682function mariana_handmade_responsive_menu() {
683	"use strict";
684	// Check relayout mode
685	if (MARIANA_HANDMADE_STORAGE['menu_mode_relayout_width'] > 0) {
686		if (mariana_handmade_is_responsive_need(MARIANA_HANDMADE_STORAGE['menu_mode_relayout_width']))
687			if (!jQuery('body').hasClass('menu_mode_relayout')) jQuery('body').addClass('menu_mode_relayout');
688		else if (jQuery('body').hasClass('menu_mode_relayout'))
689			jQuery('body').removeClass('menu_mode_relayout');
690	}
691	// Check responsive mode
692	if (MARIANA_HANDMADE_STORAGE['menu_mode_responsive_width'] > 0) {
693		if (mariana_handmade_is_responsive_need(MARIANA_HANDMADE_STORAGE['menu_mode_responsive_width'])) {
694			if (!jQuery('body').hasClass('menu_mode_responsive')) {
695				jQuery('body').removeClass('top_panel_fixed').addClass('menu_mode_responsive');
696				if (jQuery('body').hasClass('menu_mode_relayout'))
697					jQuery('body').removeClass('menu_mode_relayout');
698				if (jQuery('ul.menu_main_nav').hasClass('inited')) {
699					jQuery('ul.menu_main_nav').removeClass('inited').superfish('destroy');
700				}
701				if (jQuery('ul.menu_side_nav').hasClass('inited')) {
702					jQuery('ul.menu_side_nav').removeClass('inited').superfish('destroy');
703				}
704			}
705		} else {
706			if (jQuery('body').hasClass('menu_mode_responsive')) {
707				jQuery('body').removeClass('menu_mode_responsive');
708				jQuery('.menu_main_responsive').hide();
709				jQuery('.menu_side_responsive').hide();
710				mariana_handmade_init_sfmenu('ul.menu_main_nav,ul.menu_side_nav');
711				jQuery('.menu_main_nav_area').show();
712			}
713		}
714	}
715	// Show main menu
716	if (!jQuery('.top_panel_wrap').hasClass('menu_show')) jQuery('.top_panel_wrap').addClass('menu_show');
717	// Show widgets block on the sidebar outer (if sidebar not responsive and widgets are hidden)
718	if (jQuery('.sidebar_outer').length > 0 && jQuery('.sidebar_outer').css('position')=='absolute' && jQuery('.sidebar_outer_widgets:visible').length==0) 
719		jQuery('.sidebar_outer_widgets').show();
720}
721
722
723// Check if responsive menu need
724function mariana_handmade_is_responsive_need(max_width) {
725	"use strict";
726	var rez = false;
727	if (max_width > 0) {
728		var w = window.innerWidth;
729		if (w == undefined) {
730			w = jQuery(window).width()+(jQuery(window).height() < jQuery(document).height() || jQuery(window).scrollTop() > 0 ? 16 : 0);
731		}
732		rez = max_width > w;
733	}
734	return rez;
735}
736
737
738// Fit video frames to document width
739function mariana_handmade_video_dimensions() {
740	"use strict";
741	jQuery('video').each(function() {
742		"use strict";
743		var video = jQuery(this).eq(0);
744		var ratio = (video.data('ratio')!=undefined ? video.data('ratio').split(':') : [16,9]);
745		ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1];
746		var mejs_cont = video.parents('.mejs-video');
747		var w_attr = video.data('width');
748		var h_attr = video.data('height');
749		if (!w_attr || !h_attr) {
750			w_attr = video.attr('width');
751			h_attr = video.attr('height');
752			if (!w_attr || !h_attr) return;
753			video.data({'width': w_attr, 'height': h_attr});
754		}
755		var percent = (''+w_attr).substr(-1)=='%';
756		w_attr = parseInt(w_attr);
757		h_attr = parseInt(h_attr);
758		var w_real = Math.round(mejs_cont.length > 0 ? Math.min(percent ? 10000 : w_attr, mejs_cont.parents('div,article').width()) : video.width()),
759			h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr);
760		if (parseInt(video.attr('data-last-width'))==w_real) return;
761		if (mejs_cont.length > 0 && mejs) {
762			mariana_handmade_set_mejs_player_dimensions(video, w_real, h_real);
763		}
764		if (percent) {
765			video.height(h_real);
766		} else {
767			video.attr({'width': w_real, 'height': h_real}).css({'width': w_real+'px', 'height': h_real+'px'});
768		}
769		video.attr('data-last-width', w_real);
770	});
771	jQuery('.post_featured iframe, iframe').each(function() {
772		"use strict";
773		var iframe = jQuery(this).eq(0);
774		if (iframe.attr('src').indexOf('soundcloud')>0) return;
775		var ratio = (iframe.data('ratio')!=undefined ? iframe.data('ratio').split(':') : (iframe.find('[data-ratio]').length>0 ? iframe.find('[data-ratio]').data('ratio').split(':') : [16,9]));
776		ratio = ratio.length!=2 || ratio[0]==0 || ratio[1]==0 ? 16/9 : ratio[0]/ratio[1];
777		var w_attr = iframe.attr('width');
778		var h_attr = iframe.attr('height');
779		if (!w_attr || !h_attr) {
780			return;
781		}
782		var percent = (''+w_attr).substr(-1)=='%';
783		w_attr = parseInt(w_attr);
784		h_attr = parseInt(h_attr);
785		var w_real = iframe.parent().width(),
786			h_real = Math.round(percent ? w_real/ratio : w_real/w_attr*h_attr);
787		if (parseInt(iframe.attr('data-last-width'))==w_real) return;
788		iframe.css({'width': w_real+'px', 'height': h_real+'px'});
789		iframe.attr('data-last-width', w_real);
790	});
791}
792
793
794// Set Media Elements player dimensions
795function mariana_handmade_set_mejs_player_dimensions(video, w, h) {
796	"use strict";
797	if (mejs) {
798		for (var pl in mejs.players) {
799			if (mejs.players[pl].media.src == video.attr('src')) {
800				if (mejs.players[pl].media.setVideoSize) {
801					mejs.players[pl].media.setVideoSize(w, h);
802				}
803				mejs.players[pl].setPlayerSize(w, h);
804				mejs.players[pl].setControlsSize();
805			}
806		}
807	}
808}
809
810
811
812
813
814// Navigation
815//==============================================
816
817// Init Superfish menu
818function mariana_handmade_init_sfmenu(selector) {
819	"use strict";
820	jQuery(selector).show().each(function() {
821		"use strict";
822		if (mariana_handmade_is_responsive_need() && (jQuery(this).attr('id')=='menu_main' || jQuery(this).attr('id')=='menu_side')) return;
823		jQuery(this).addClass('inited').superfish({
824			delay: 500,
825			animation: {
826				opacity: 'show'
827			},
828			animationOut: {
829				opacity: 'hide'
830			},
831			speed: 		MARIANA_HANDMADE_STORAGE['css_animation'] ? 500 : 200,
832			speedOut:	MARIANA_HANDMADE_STORAGE['css_animation'] ? 500 : 200,
833			autoArrows: false,
834			dropShadows: false,
835			onBeforeShow: function(ul) {
836				"use strict";
837				if (jQuery(this).parents("ul").length > 1){
838					var w = jQuery(window).width();  
839					var par_offset = jQuery(this).parents("ul").offset().left;
840					var par_width  = jQuery(this).parents("ul").outerWidth();
841					var ul_width   = jQuery(this).outerWidth();
842					if (par_offset+par_width+ul_width > w-20 && par_offset-ul_width > 0)
843						jQuery(this).addClass('submenu_left');
844					else
845						jQuery(this).removeClass('submenu_left');
846				}
847				if (MARIANA_HANDMADE_STORAGE['css_animation']) {
848					jQuery(this).removeClass('animated fast '+MARIANA_HANDMADE_STORAGE['menu_animation_out']);
849					jQuery(this).addClass('animated fast '+MARIANA_HANDMADE_STORAGE['menu_animation_in']);
850				}
851			},
852			onBeforeHide: function(ul) {
853				"use strict";
854				if (MARIANA_HANDMADE_STORAGE['css_animation']) {
855					jQuery(this).removeClass('animated fast '+MARIANA_HANDMADE_STORAGE['menu_animation_in']);
856					jQuery(this).addClass('animated fast '+MARIANA_HANDMADE_STORAGE['menu_animation_out']);
857				}
858			}
859		});
860	});
861}
862
863
864// Show current page title on the responsive menu button
865function mariana_handmade_show_current_menu_item(menu, button) {
866	"use strict";
867	var text = '';
868	menu.find('a').each(function () {
869		"use strict";
870		if (text) return;
871		var menu_link = jQuery(this);
872		if (menu_link.text() == "") {
873			return;
874		}
875		if (menu_link.attr('href') == window.location.href)
876			text = menu_link.text();
877	});
878	button.text( text ? text : button.data('title') );
879}
880
881
882
883
884
885// Post formats init
886//=====================================================
887
888function mariana_handmade_init_post_formats() {
889	"use strict";
890
891	// MediaElement init
892	mariana_handmade_init_media_elements(jQuery('body'));
893
894	// Sliders init
895	mariana_handmade_init_sliders(jQuery('body'));
896
897	// Popup init
898	if (MARIANA_HANDMADE_STORAGE['popup_engine'] == 'pretty') {
899		jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").attr('rel', 'prettyPhoto[slideshow]');
900		var images = jQuery("a[rel*='prettyPhoto']:not(.inited):not([data-rel*='pretty']):not([rel*='magnific']):not([data-rel*='magnific'])").addClass('inited');
901		try {
902			images.prettyPhoto({
903				social_tools: '',
904				theme: 'facebook',
905				deeplinking: false
906			});
907		} catch (e) {};
908	} else if (MARIANA_HANDMADE_STORAGE['popup_engine']=='magnific') {
909		jQuery("a[href$='jpg'],a[href$='jpeg'],a[href$='png'],a[href$='gif']").each(function() {
910            if (!jQuery(this).parent().hasClass('woocommerce-product-gallery__image'))
911                jQuery(this).attr('rel', 'magnific');
912        });
913		var images = jQuery("a[rel*='magnific']:not(.inited):not(.prettyphoto):not([rel*='pretty']):not([data-rel*='pretty'])").addClass('inited');
914		try {
915			images.magnificPopup({
916				type: 'image',
917				mainClass: 'mfp-img-mobile',
918				closeOnContentClick: true,
919				closeBtnInside: true,
920				fixedContentPos: true,
921				midClick: true,
922				preloader: true,
923				tLoading: MARIANA_HANDMADE_STORAGE['strings']['magnific_loading'],
924				gallery:{
925					enabled: true
926				},
927				image: {
928					tError: MARIANA_HANDMADE_STORAGE['strings']['magnific_error'],
929					verticalFit: true
930				}
931			});
932		} catch (e) {}
933	}
934
935
936	// Likes counter
937	if (jQuery('.post_counters_likes:not(.inited)').length > 0) {
938		jQuery('.post_counters_likes:not(.inited)')
939			.addClass('inited')
940			.on('click', function(e) {
941				"use strict";
942				var button = jQuery(this);
943				var inc = button.hasClass('enabled') ? 1 : -1;
944				var post_id = button.data('postid');
945				var cookie_likes = mariana_handmade_get_cookie('mariana_handmade_likes');
946				if (cookie_likes === undefined || cookie_likes===null) cookie_likes = '';
947				jQuery.post(MARIANA_HANDMADE_STORAGE['ajax_url'], {
948					action: 'post_counter',
949					nonce: MARIANA_HANDMADE_STORAGE['ajax_nonce'],
950					post_id: post_id,
951					likes: inc
952				}).done(function(response) {
953					"use strict";
954					var rez = {};
955					try {
956						rez = JSON.parse(response);
957					} catch (e) {
958						rez = { error: MARIANA_HANDMADE_STORAGE['ajax_error'] };
959						console.log(response);
960					}
961					if (rez.error === '') {
962						var counter = rez.counter;
963						if (inc == 1) {
964							var title = button.data('title-dislike');
965							button.removeClass('enabled icon-heart-empty').addClass('disabled icon-heart');
966							cookie_likes += (cookie_likes.substr(-1)!=',' ? ',' : '') + post_id + ',';
967						} else {
968							var title = button.data('title-like');
969							button.removeClass('disabled icon-heart').addClass('enabled icon-heart-empty');
970							cookie_likes = cookie_likes.replace(','+post_id+',', ',');
971						}
972						button.data('likes', counter).attr('title', title).find('.post_counters_number').html(counter);
973						mariana_handmade_set_cookie('mariana_handmade_likes', cookie_likes, 365);
974					} else {
975						alert(MARIANA_HANDMADE_STORAGE['strings']['error_like']);
976					}
977				});
978				e.preventDefault();
979				return false;
980			});
981	}
982}
983
984
985function mariana_handmade_init_media_elements(cont) {
986	"use strict";
987	if (MARIANA_HANDMADE_STORAGE['use_mediaelements'] && cont.find('audio,video').length > 0) {
988		if (window.mejs) {
989            if (window.mejs.MepDefaults) window.mejs.MepDefaults.enableAutosize = true;
990            if (window.mejs.MediaElementDefaults) window.mejs.MediaElementDefaults.enableAutosize = true;
991            cont.find('audio:not(.wp-audio-shortcode),video:not(.wp-video-shortcode)').each(function() {
992				"use strict";
993				if (jQuery(this).parents('.mejs-mediaelement').length == 0
994					&& jQuery( this ).parents( '.wp-block-video' ).length == 0
995					&& ! jQuery( this ).hasClass( 'wp-block-cover__video-background' )) {
996					var media_tag = jQuery(this);
997					var settings = {
998						enableAutosize: true,
999						videoWidth: -1,		// if set, overrides <video width>
1000						videoHeight: -1,	// if set, overrides <video height>
1001						audioWidth: '100%',	// width of audio player
1002						audioHeight: 30,	// height of audio player
1003						success: function(mejs) {
1004							var autoplay, loop;
1005							if ( 'flash' === mejs.pluginType ) {
1006								autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
1007								loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
1008								autoplay && mejs.addEventListener( 'canplay', function () {
1009									mejs.play();
1010								}, false );
1011								loop && mejs.addEventListener( 'ended', function () {
1012									mejs.play();
1013								}, false );
1014							}
1015						}
1016					};
1017					jQuery(this).mediaelementplayer(settings);
1018				}
1019			});
1020		} else
1021			setTimeout(function() { mariana_handmade_init_media_elements(cont); }, 400);
1022	}
1023}
1024
1025// Init sliders with engine=swiper
1026function mariana_handmade_init_sliders(container) {
1027	"use strict";
1028
1029	// Swiper Slider
1030	if (container.find('.slider_swiper:not(.inited)').length > 0) {
1031		// Min width of the slides in swiper (used for validate slides_per_view on small screen)
1032		MARIANA_HANDMADE_STORAGE['swipers_min_width'] = 250;
1033		container.find('.slider_swiper:not(.inited)')
1034			.each(function () {
1035				"use strict";
1036				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
1037				
1038				// Check attr id for slider. If not exists - generate it
1039				var id = jQuery(this).attr('id');
1040				if (id == undefined) {
1041					id = 'swiper_'+Math.random();
1042					id = id.replace('.', '');
1043					jQuery(this).attr('id', id);
1044				}
1045				// Validate Slides per view on small screen
1046				var width = jQuery(this).width();
1047				if (width == 0) width = jQuery(this).parent().width();
1048				var spv = jQuery(this).data('slides-per-view');
1049				if (spv == undefined) spv = 1;
1050				if (width / spv < MARIANA_HANDMADE_STORAGE['swipers_min_width']) spv = Math.max(1, Math.floor(width / MARIANA_HANDMADE_STORAGE['swipers_min_width']));
1051
1052				// Space between slides
1053				var space = jQuery(this).data('slides-space');
1054				if (space == undefined) space = 0;
1055				if (space == 0 && spv > 1) space = 30;
1056
1057				jQuery(this).show()
1058					.addClass(id)
1059					.addClass('inited')
1060					.data('settings', {mode: 'horizontal'});		// VC hook
1061					
1062				if (MARIANA_HANDMADE_STORAGE['swipers'] === undefined) MARIANA_HANDMADE_STORAGE['swipers'] = {};
1063
1064				MARIANA_HANDMADE_STORAGE['swipers'][id] = new Swiper('.'+id, {
1065					calculateHeight: !jQuery(this).hasClass('slider_height_fixed'),
1066					resizeReInit: true,
1067					autoResize: true,
1068					loop: true,
1069					grabCursor: true,
1070					pagination: jQuery(this).hasClass('slider_pagination') ? '#'+id+' .slider_pagination_wrap' : false,
1071				    paginationClickable: jQuery(this).hasClass('slider_pagination') ? '#'+id+' .slider_pagination_wrap' : false,
1072			        nextButton: jQuery(this).hasClass('slider_controls') ? '#'+id+' .slider_next' : false,
1073			        prevButton: jQuery(this).hasClass('slider_controls') ? '#'+id+' .slider_prev' : false,
1074			        autoplay: jQuery(this).hasClass('slider_noautoplay') 
1075								? false 
1076								: (jQuery(this).data('interval')=='' || isNaN(jQuery(this).data('interval')) 
1077									? 7000 
1078									: parseInt(jQuery(this).data('interval'))
1079									),
1080        			autoplayDisableOnInteraction: false,
1081					initialSlide: 0,
1082					slidesPerView: spv,
1083					loopedSlides: spv,
1084					spaceBetween: space,
1085					speed: 600
1086				});
1087			});
1088			
1089		// Check slides per view
1090		mariana_handmade_sc_sliders_resize();
1091	}
1092}
1093
1094// Sliders: Resize
1095function mariana_handmade_sc_sliders_resize() {
1096	"use strict";
1097	var slider = arguments[0]!==undefined ? arguments[0] : '.slider_swiper.inited';
1098	var resize = arguments[1]!==undefined ? arguments[1] : true;
1099
1100	jQuery(slider).each(function() {
1101		"use strict";
1102		var id = jQuery(this).attr('id');
1103		var width = jQuery(this).width();
1104		var last_width = jQuery(this).data('last-width');
1105		if (isNaN(last_width)) last_width = 0;
1106		
1107		// Change slides_per_view
1108		if (last_width==0 || last_width!=width) {
1109			var spv = jQuery(this).data('slides-per-view');
1110			if (spv == undefined) spv = 1;
1111			if (width / spv < MARIANA_HANDMADE_STORAGE['swipers_min_width']) spv = Math.max(1, Math.floor(width / MARIANA_HANDMADE_STORAGE['swipers_min_width']));
1112			jQuery(this).data('last-width', width);
1113			if (MARIANA_HANDMADE_STORAGE['swipers'][id].params.slidesPerView != spv) {
1114				MARIANA_HANDMADE_STORAGE['swipers'][id].params.slidesPerView = spv;
1115				MARIANA_HANDMADE_STORAGE['swipers'][id].params.loopedSlides = spv;
1116			}
1117		}
1118		
1119		// Resize slider
1120		if ( resize && !jQuery(this).hasClass('slider_height_fixed') ) {
1121			var h = 0;
1122			if ( jQuery(this).find('.swiper-slide > img').length > 0 ) {
1123				jQuery(this).find('.swiper-slide > img').each(function() {
1124					if (jQuery(this).height() > h) h = jQuery(this).height();
1125				});
1126				jQuery(this).height(h);
1127			} else if ( jQuery(this).find('.swiper-slide').text()=='' || jQuery(this).hasClass('slider_height_auto') ) {
1128				jQuery(this).height( Math.floor(width/16*9) );
1129			}
1130		}
1131	});
1132}
1133
1134
1135
1136// Forms validation
1137//-------------------------------------------------------
1138
1139
1140// Comments form
1141function mariana_handmade_comments_validate(form) {
1142	"use strict";
1143	form.find('input').removeClass('error_fields_class');
1144	var error = mariana_handmade_form_validate(form, {
1145		error_message_text: MARIANA_HANDMADE_STORAGE['strings']['error_global'],	// Global error message text (if don't write in checked field)
1146		error_message_show: true,									// Display or not error message
1147		error_message_time: 4000,									// Error message display time
1148		error_message_class: 'sc_infobox sc_infobox_style_error',	// Class appended to error message block
1149		error_fields_class: 'error_fields_class',					// Class appended to error fields
1150		exit_after_first_error: false,								// Cancel validation and exit after first error
1151		rules: [
1152			{
1153				field: 'author',
1154				min_length: { value: 1, message: MARIANA_HANDMADE_STORAGE['strings']['name_empty']},
1155				max_length: { value: 60, message: MARIANA_HANDMADE_STORAGE['strings']['name_long']}
1156			},
1157			{
1158				field: 'email',
1159				min_length: { value: 7, message: MARIANA_HANDMADE_STORAGE['strings']['email_empty']},
1160				max_length: { value: 60, message: MARIANA_HANDMADE_STORAGE['strings']['email_long']},
1161				mask: { value: MARIANA_HANDMADE_STORAGE['email_mask'], message: MARIANA_HANDMADE_STORAGE['strings']['email_not_valid']}
1162			},
1163			{
1164				field: 'comment',
1165				min_length: { value: 1, message: MARIANA_HANDMADE_STORAGE['strings']['text_empty'] },
1166				max_length: { value: MARIANA_HANDMADE_STORAGE['message_maxlength'], message: MARIANA_HANDMADE_STORAGE['strings']['text_long']}
1167			}
1168		]
1169	});
1170	return !error;
1171}
1172
1173// Contact form handlers
1174function mariana_handmade_contact_form_validate(form){
1175	"use strict";
1176	var url = form.attr('action');
1177	if (url == '') return false;
1178	form.find('input').removeClass('error_fields_class');
1179	var error = mariana_handmade_form_validate(form, {
1180			error_message_show: true,
1181			error_message_time: 4000,
1182			error_message_class: "sc_infobox sc_infobox_style_error",
1183			error_fields_class: "error_fields_class",
1184			exit_after_first_error: false,
1185			rules: [
1186				{
1187					field: "username",
1188					min_length: { value: 1,	 message: MARIANA_HANDMADE_STORAGE['strings']['name_empty'] },
1189					max_length: { value: 60, message: MARIANA_HANDMADE_STORAGE['strings']['name_long'] }
1190				},
1191				{
1192					field: "email",
1193					min_length: { value: 7,	 message: MARIANA_HANDMADE_STORAGE['strings']['email_empty'] },
1194					max_length: { value: 60, message: MARIANA_HANDMADE_STORAGE['strings']['email_long'] },
1195					mask: { value: MARIANA_HANDMADE_STORAGE['email_mask'], message: MARIANA_HANDMADE_STORAGE['strings']['email_not_val
1195id'] }
1196				},
1197				{
1198					field: "message",
1199					min_length: { value: 1,  message: MARIANA_HANDMADE_STORAGE['strings']['text_empty'] },
1200					max_length: { value: MARIANA_HANDMADE_STORAGE['message_maxlength'], message: MARIANA_HANDMADE_STORAGE['strings']['text_long'] }
1201				}
1202			]
1203		});
1204
1205	if (!error && url!='#') {
1206		jQuery.post(url, {
1207			action: "send_contact_form",
1208			nonce: MARIANA_HANDMADE_STORAGE['ajax_nonce'],
1209			data: form.serialize()
1210		}).done(function(response) {
1211			"use strict";
1212			var rez = {};
1213			try {
1214				rez = JSON.parse(response);
1215			} catch(e) {
1216				rez = { error: MARIANA_HANDMADE_STORAGE['ajax_error'] };
1217				console.log(response);
1218			}
1219			var result = form.find(".result").toggleClass("sc_infobox_style_error", false).toggleClass("sc_infobox_style_success", false);
1220			if (rez.error === '') {
1221				form.get(0).reset();
1222				result.addClass("sc_infobox_style_success").html(MARIANA_HANDMADE_STORAGE['strings']['send_complete']);
1223			} else {
1224				result.addClass("sc_infobox_style_error").html(MARIANA_HANDMADE_STORAGE['strings']['send_error'] + ' ' + rez.error);
1225			}
1226			result.fadeIn().delay(3000).fadeOut();
1227		});
1228	}
1229	return !error;
1230}

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.