1/* global jQuery:false */ 2/* global DOM_STORAGE:false */ 3 4(function() { 5 "use strict"; 6 7 function dom_skin_post_header_init() { 8 var header = jQuery('.post_header_wrap_style_style-1.with_featured_image, .post_header_wrap_style_style-2.with_featured_image'); 9 header.find('.post_featured').css('min-height', 0); 10 11 if ( jQuery(header).find('.post_featured.with_gallery').length > 0 ) { 12 return; 13 } 14 if ( jQuery(header).find('.post_featured.with_thumb.post_featured_bg.with_video').length > 0 ) { 15 return; 16 } 17 18 header.each(function() { 19 var self = jQuery(this); 20 var image_h = self.find('.post_featured').outerHeight(); 21 var info_h = self.find('.post_header').outerHeight(); 22 var x = 180; 23 if ( jQuery('body').hasClass('mobile_layout') ) { 24 x = 100; 25 } 26 27 info_h = info_h + x; 28 if ( info_h >= image_h ) { 29 self.find('.post_featured').css('min-height', info_h); 30 } 31 }); 32 } 33 34 dom_add_filter( 'trx_addons_filter_skills_pie_options', function(opt) { 35 opt.animateScale = false; 36 return opt; 37 } ); 38 39 if ( typeof TRX_ADDONS_STORAGE != 'undefined' && TRX_ADDONS_STORAGE['mouse_helper'] > 0 ) { 40 if (jQuery('body').find('.slider_container.slider_swiper:not(.go)').length > 0) { 41 jQuery('body').find('.slider_container.slider_swiper:not(.go)').each(function () { 42 jQuery(this).addClass('go'); 43 jQuery(this).attr('data-mouse-helper-hide-cursor', '1'); 44 jQuery(this).attr('data-mouse-helper', 'hover'); 45 jQuery(this).attr('data-mouse-helper-centered', '1'); 46 jQuery(this).attr('data-mouse-helper-magnet', '0'); 47 jQuery(this).attr('data-mouse-helper-bg-color', 'rgba(0, 0, 0, 1)'); 48 jQuery(this).attr('data-mouse-helper-mode', 'normal'); 49 jQuery(this).attr('data-mouse-helper-axis', 'xy'); 50 jQuery(this).attr('data-mouse-helper-delay', '8'); 51 jQuery(this).attr('data-mouse-helper-text-round', '0'); 52 jQuery(this).attr('data-mouse-helper-layout', '<div class=custom-helper><span></span></div>'); 53 }); 54 } 55 } 56 57 // Create Swiper Controls - Title 58 function skin_blogger_controls_title() { 59 if (jQuery('body').find('.sc_slider_controls:not(.go)').length > 0) { 60 jQuery('body').find('.sc_slider_controls:not(.go)') 61 .each(function () { 62 var controls = jQuery(this).addClass('go'), 63 slider_id = controls.data('slider-id'), 64 pagination_style = controls.data('pagination-style'); 65 if (!slider_id) return; 66 slider_id = jQuery('#' + slider_id + ' .slider_swiper').attr('id'); 67 if (!slider_id) return; 68 69 // Add pagination 70 var s = typeof TRX_ADDONS_STORAGE['swipers'] != 'undefined' && typeof TRX_ADDONS_STORAGE['swipers'][slider_id] != 'undefined' ? TRX_ADDONS_STORAGE['swipers'][slider_id] : false, 71 slides = jQuery('#' + slider_id + ' .swiper-slide'), 72 spv = s 73 ? (s.params.loop 74 ? s.loopedSlides 75 : 0 76 ) 77 : 0; 78 if (pagination_style == 'title') { 79 var html = ''; 80 slides.each(function (idx) { 81 var slide = jQuery(this); 82 if (idx < spv || idx >= slides.length - spv) return; 83 var title = (slide.data('title') 84 ? slide.data('title') 85 : slide.find('[class*="_item_title"]').text() 86 ); 87 html += '<span class="slider_pagination_bullet swiper-pagination-bullet" data-slide-number="' + (s ? jQuery(this).data('slide-number') : idx) + '">' + title + '</span>'; 88 }); 89 controls.find('.slider_pagination_wrap').html(html); 90 91 jQuery('#' + slider_id).on('slider_init slide_change_start', function (e) { 92 if (TRX_ADDONS_STORAGE['swipers'][slider_id]) { 93 var s = TRX_ADDONS_STORAGE['swipers'][slider_id]; 94 var current = jQuery(s.slides[s.activeIndex]).data('slide-number') + 1, 95 total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length; 96 if (total > 0) { 97 controls.find('.slider_pagination_bullet') 98 .removeClass('slider_pagination_bullet_active swiper-pagination-bullet-active') 99 .eq(current - 1) 100 .addClass('slider_pagination_bullet_active swiper-pagination-bullet-active'); 101 } 102 } 103 }); 104 } 105 }); 106 } 107 } 108 109 110 // Init skin-specific actions on first run 111 // Attention! Don't forget to add the class "inited" and check it to prevent re-initialize the elements 112 113 // Change param "slides per" in exactly sliders 114 dom_add_filter( 'trx_addons_filter_slider_init_args', function( $param, $init ) { 115 if( $init.parents('.slider_width_auto').length > 0 && ( $init.parents('.sc_portfolio_extra').length > 0 || $init.parents('.sc_portfolio_default').length > 0 ) ) { 116 $param.slidesPerView = 'auto'; 117 } 118 return $param; 119 } ); 120 121 122 // Toggle for Filter 123 function skin_blogger_toggle_filter_add_element() { 124 if ( jQuery('.content').find(".sc_style_toggle").length > 0 ) { 125 jQuery(" .sc_style_toggle").each(function() { 126 var toggle_title = DOM_STORAGE['toggle_title']; 127 jQuery(this).find('.sc_item_filters').append('<div class="title_wrap"><span class="toggle_title"></span><span class="active_tab"></span></div>'); 128 jQuery(this).find('.sc_item_filters .sc_item_filters_tabs').wrap('<div class="list_wrap"></div>'); 129 jQuery(this).find('.sc_item_filters .toggle_title').text(toggle_title); 130 131 jQuery(this).find('span.active_tab') 132 .mouseenter( function() { 133 jQuery(this).parents('.sc_item_filters').find('.sc_item_filters_tabs').addClass('active'); 134 } 135 ); 136 jQuery(this).find('.sc_blogger_filters') 137 .mouseleave( function() { 138 jQuery(this).find('.sc_item_filters_tabs').removeClass('active'); 139 } 140 ); 141 }) 142 } 143 } 144 function skin_blogger_toggle_filter_upd_value() { 145 if ( jQuery('.content').find(".sc_style_toggle").length > 0 ) { 146 jQuery(" .sc_style_toggle").each(function() { 147 var text = jQuery(this).find('.sc_item_filters .sc_item_filters_tabs .sc_item_filters_tabs_active a').text(); 148 jQuery(this).find('.sc_item_filters .active_tab').text(text); 149 }) 150 } 151 } 152 function skin_add_custom_width_filter_list() { 153 if ( jQuery('.content').find(".sc_style_toggle").length > 0 ) { 154 jQuery('.sc_style_toggle .sc_item_filters_wrap .sc_item_filters').each(function() { 155 var check_element = jQuery(this).find('.list_wrap'); 156 var width = jQuery(this).find( '.title_wrap' ).outerWidth(); 157 jQuery(check_element).css('width', 'calc(100% - ' + (width + 10) + 'px)'); 158 }) 159 } 160 } 161 // Move title with cursor 162 function mousemove_for_portfolio_small() { 163 if (jQuery( window ).width() > 1279 ) { 164 if ( jQuery('.content').find(".sc_blogger_lay_portfolio_grid_grid_style_7").length > 0 ) { 165 jQuery(".sc_blogger_lay_portfolio_grid_grid_style_7 .sc_blogger_item").each(function() { 166 let $Target = jQuery(this); 167 let $TargetInner = $Target.find('.post_info_bl'); 168 $Target.mousemove(function(event){ 169 let y = event.pageY - $Target.offset().top + 20; 170 let x = event.pageX - $Target.offset().left + 20; 171 $TargetInner.css({'top': y,'left': x,'bottom': "auto",'right': "auto",'opacity': 1}); 172 173 }) 174 .mouseleave(function() { 175 $TargetInner.css({'top': 'auto','left': 30,'bottom': 30,'right': "auto",'opacity': 0}); 176 }); 177 }); 178 } 179 } 180 } 181 // Add wrap in portfolio style 182 function add_portfolio_image_wrap() { 183 if ( jQuery('.content').find(".sc_blogger_lay_portfolio_grid_grid_style_7").length > 0 ) { 184 let $NewTarget = jQuery(".sc_blogger_lay_portfolio_grid_grid_style_7 .sc_blogger_item"); 185 let $ImageInner = $NewTarget.find('.bg_in'); 186 jQuery($ImageInner).wrap('<div class="bg_in_wrap"></div>'); 187 } 188 if ( jQuery('.content').find(".sc_blogger_lay_portfolio_grid_grid_style_9").length > 0 ) { 189 let $NewTarget2 = jQuery(".sc_blogger_lay_portfolio_grid_grid_style_9 .sc_blogger_item"); 190 let $ImageInner2 = $NewTarget2.find('.bg_in'); 191 jQuery($ImageInner2).wrap('<div class="bg_in_wrap"></div>'); 192 } 193 } 194 // Move title with cursor 195 function mousemove_for_portfolio_large() { 196 if (jQuery( window ).width() > 1279 ) { 197 if ( jQuery('.content').find(".sc_blogger_lay_portfolio_grid_grid_style_9").length > 0 ) { 198 jQuery(".sc_blogger_lay_portfolio_grid_grid_style_9 .sc_blogger_item").each(function() { 199 let $Target = jQuery(this); 200 let $TargetInner = $Target.find('.post_info_bl'); 201 $Target.mousemove(function(event){ 202 let y = event.pageY - $Target.offset().top + 20; 203 let x = event.pageX - $Target.offset().left + 20; 204 $TargetInner.css({'top': y,'left': x,'bottom': "auto",'right': "auto",'opacity': 1 }); 205 }) 206 .mouseleave(function() { 207 $TargetInner.css({'top': "auto",'left': 30,'bottom': 30,'right': "auto",'opacity': 0 }); 208 }); 209 }); 210 } 211 } 212 } 213 /* Add image background on wrap in portfolio Stretch */ 214 function background_image_portfolio_stretch() { 215 if ( jQuery('.content').find(".sc_blogger_portmodern").length > 0 ) { 216 217 jQuery(".sc_blogger_portmodern .sc_blogger_item .sc_blogger_item_title").on( 'mouseover', function() { 218 jQuery(this).addClass('active_item'); 219 }).on( 'mouseleave', function() { 220 jQuery(this).removeClass('active_item'); 221 }); 222 if (jQuery( window ).width() > 1279 ) { 223 jQuery(".sc_blogger_portmodern .sc_blogger_item:not(.inited_item)").each(function() { 224 let $Target = jQuery(this).addClass('inited_item'); 225 let $TargetInner = $Target.find('.sc_blogger_item_title'); 226 let $TargetInnerId = $TargetInner.data('item-id'); 227 let $TargetInnerImg = $TargetInner.data('item-image'); 228 if ( $TargetInnerImg ) { 229 var obj = new Image(); 230 obj.src = $TargetInnerImg; 231 } 232 let $WrapImage = jQuery( this ).parents(".sc_blogger_portmodern").find(".decor_image_wrap"); 233 234 if( jQuery($WrapImage).find('#' + $TargetInnerId ).length <= 0 ) { 235 jQuery($WrapImage).append('<div id="' + $TargetInnerId + '" class="image_item" ></div>'); 236 jQuery($TargetInner).on('mouseover', function() { 237 let $NewTarget = jQuery( this ).parents(".sc_blogger_portmodern").find(".decor_image_wrap"); 238 jQuery($NewTarget).find('div#' + $TargetInnerId + '').css({'background-image': 'url(' + $TargetInnerImg + ')'}); 239 }) 240 } 241 }); 242 } 243 244 jQuery(".sc_blogger_portmodern .sc_blogger_item").each(function() { 245 let $Target = jQuery(this); 246 let $TargetInner = $Target.find('.sc_blogger_item_title'); 247 let $TargetInnerId = $TargetInner.data('item-id'); 248 let $WrapImage = jQuery( this ).parents(".sc_blogger_portmodern").find(".decor_image_wrap"); 249 jQuery($TargetInner).on('mouseover', function() { 250 jQuery($WrapImage).find('div#' + $TargetInnerId + '').addClass('active_image') 251 }).on( 'mouseleave', function() { 252 let $WrapImage = jQuery( this ).parents(".sc_blogger_portmodern").find(".image_item"); 253 jQuery($WrapImage).removeClass('active_image'); 254 }); 255 }); 256 257 jQuery(".sc_blogger_portmodern .sc_blogger_item").each(function() { 258 //jQuery(this).addClass('inited_description'); 259 jQuery(this).find(".sc_blogger_item_title").on( 'click', function() { 260 let $eachTitleItem = jQuery( this ).parents(".sc_blogger_portmodern").find(".sc_blogger_item").find(".sc_blogger_item_title"); 261 let $WrapPreview = jQuery( this ).parents(".sc_blogger_portmodern").find(".portfolio_preview"); 262 let $PreviewDescription = jQuery($WrapPreview).find(".portfolio_description"); 263 let $PreviewImage = jQuery($WrapPreview).find(".portfolio_image"); 264 let $PreviewClose = jQuery($WrapPreview).find(".close"); 265 let $TargetInnerDetails = jQuery( this ).data('details'); 266 let $TargetInnerImg = jQuery( this ).data('item-image'); 267 $PreviewImage.css({'background-image': 'url(' + $TargetInnerImg + ')'}); 268 $PreviewDescription.html($TargetInnerDetails); 269 jQuery($eachTitleItem).addClass('anim_fade'); 270 jQuery($WrapPreview).addClass('portfolio_preview_show'); 271 272 if( $WrapPreview.hasClass('portfolio_preview_show') ) { 273 jQuery('html').addClass('portfolio_preview_opened'); 274 $PreviewClose.on('click', function() { 275 jQuery('html').removeClass('portfolio_preview_opened'); 276 jQuery($eachTitleItem).removeClass('anim_fade'); 277 jQuery($WrapPreview).removeClass('portfolio_preview_show'); 278 jQuery($PreviewDescription).empty(); 279 }); 280 jQuery( window ).on( 'keyup', function(e) { 281 if (e.keyCode === 27) { 282 jQuery('html').removeClass('portfolio_preview_opened'); 283 jQuery($WrapPreview).removeClass('portfolio_preview_show'); 284 jQuery($eachTitleItem).removeClass('anim_fade'); 285 jQuery($PreviewDescription).empty(); 286 } 287 }); 288 } 289 290 //jQuery(document).trigger( 'action.init_hidden_elements', [$WrapPreview] ); 291 292 // Socials share 293 //---------------------------------------------- 294 var $share_items = $PreviewDescription.find('.socials_share .social_items:not(.inited)'); 295 if ($share_items.length > 0) { 296 $share_items 297 .addClass('inited') 298 .on('click', '.social_item_popup', function(e) { 299 var url = jQuery(this).data('link'); 300 window.open(url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=480, height=400, toolbar=0, status=0'); 301 e.preventDefault(); 302 return false;
303 }) 304 .on('click', '.social_item[data-copy-link-url]', function(e) { 305 var $self = jQuery(this), 306 url = $self.data('copy-link-url'); 307 if ( url != '' ) { 308 trx_addons_copy_to_clipboard( url ); 309 var msg = $self.data('message') ? $self.data('message') : DOM_STORAGE['msg_copied']; 310 if ( msg ) { 311 $self.attr('data-tooltip-text', msg); 312 setTimeout( function() { 313 $self.removeAttr('data-tooltip-text'); 314 }, 3000 ); 315 } 316 } 317 e.preventDefault(); 318 return false; 319 }); 320 } 321 }); 322 }); 323 } 324 } 325 // Audio 326 function dom_skin_audio_init() { 327 jQuery('[class*="single_style_style-"]:not(.single_style_style-1):not(.single_style_style-3) .post_header_wrap_in_header .post_featured.with_audio.with_thumb:not(.audio_inited)').addClass('audio_inited').each(function() { 328 var featured = jQuery(this); 329 var audio_wrap = featured.find('.post_audio'); 330 var btn = jQuery('<div class="post_audio_btn"></div>'); 331 featured.prepend(btn); 332 btn.on('click', function() { 333 audio_wrap.toggleClass('show'); 334 audio_wrap.find('.mejs-playpause-button').click(); 335 }); 336 }); 337 } 338 339 340 jQuery( window ).load(function() { 341 342 // Audio 343 dom_skin_audio_init(); 344 345 // Toggle for Filter 346 skin_add_custom_width_filter_list(); 347 348 // Add image background on wrap in portfolio Stretch 349 background_image_portfolio_stretch(); 350 351 dom_skin_post_header_init(); 352 353 }); 354 355 jQuery( document ).on( 356 'action.ready_dom', function() { 357 extra_margin_top_video_popup_button(); 358 // Move title with cursor 359 mousemove_for_portfolio_large(); 360 mousemove_for_portfolio_small(); 361 362 // Toggle for Filter 363 skin_blogger_toggle_filter_add_element(); 364 365 skin_blogger_controls_title(); 366 367 // Anim for 404 page 368 if ( typeof window.TweenMax != 'undefined' ) { 369 if (jQuery('.post_item_404').length > 0) { 370 var $layer_1 = jQuery('.post_item_404 .svg-1'), 371 $layer_2 = jQuery('.post_item_404 .svg-2'), 372 $layer_3 = jQuery('.post_item_404 .svg-3'), 373 $layer_4 = jQuery('.post_item_404 .svg-4'), 374 $container = jQuery('.error404 .page_content_wrap'), 375 container_w = $container.width(), 376 container_h = $container.height(); 377 378 jQuery(window).on('mousemove.parallax', function (event) { 379 var pos_x = event.pageX, 380 pos_y = event.pageY, 381 left = 0, 382 top = 0; 383 left = container_w / 2 - pos_x; 384 top = container_h / 2 - pos_y; 385 386 TweenMax.to( 387 $layer_1, 388 1, 389 { 390 css: { 391 transform: 'translateX(' + left / 25 + 'px) translateY(' + top / 25 + 'px)' 392 }, 393 ease: Power2.easeOut, 394 overwrite: 'all' //'none' 395 }); 396 TweenMax.to( 397 $layer_2, 398 1, 399 { 400 css: { 401 transform: 'translateX(' + left / 35 + 'px) translateY(' + top / 35 + 'px)' 402 }, 403 ease: Power2.easeOut, 404 overwrite: 'all' 405 }); 406 TweenMax.to( 407 $layer_3, 408 1, 409 { 410 css: { 411 transform: 'translateX(' + left / 55 + 'px) translateY(' + top / 55 + 'px)' 412 }, 413 ease: Power2.easeOut, 414 overwrite: 'all' //'none' 415 }); 416 TweenMax.to( 417 $layer_4, 418 1, 419 { 420 css: { 421 transform: 'translateX(' + left / 70 + 'px) translateY(' + top / 70 + 'px)' 422 }, 423 ease: Power2.easeOut, 424 overwrite: 'all' //'none' 425 }); 426 }); 427 } 428 } 429 430 // for woo tinv 431 if(jQuery('.woocommerce-product-gallery__wrapper > .tinv-wraper').length > 0) { 432 var tinv = jQuery('.woocommerce-product-gallery__wrapper > .tinv-wraper'); 433 jQuery('.woocommerce-product-gallery__wrapper').after(tinv); 434 } 435 436 //Tilt 3d hover for Class - VanillaTiltHover 437 if (jQuery( '.VanillaTiltHover' ).length > 0) { 438 VanillaTilt.init(document.querySelectorAll('.VanillaTiltHover'), { 439 max: 8, 440 speed: 1000, 441 scale: 1.05, 442 transition: true, 443 easing: 'cubic-bezier(.03,.98,.52,.99)', 444 perspective: 1200, 445 }); 446 } 447 //Tilt 3d hover for teams 448 if (jQuery( '.start-inner-3d' ).length > 0) { 449 VanillaTilt.init(document.querySelectorAll('.start-inner-3d'), { 450 max: 5, 451 speed: 1000, 452 scale: 1, 453 transition: true, 454 easing: 'cubic-bezier(.03,.98,.52,.99)', 455 perspective: 1500, 456 }); 457 } 458 459 //Tilt 3d hover 460 if (jQuery( '.tilt_action' ).length > 0) { 461 VanillaTilt.init(document.querySelectorAll('.tilt_action'), { 462 max: 8, 463 speed: 1000, 464 scale: 1.05, 465 transition: true, 466 easing: 'cubic-bezier(.03,.98,.52,.99)', 467 perspective: 1400, 468 }); 469 } 470 471 //Tilt 3d hover for cat list 472 if (jQuery( '.tilt_action_cat_list' ).length > 0) { 473 VanillaTilt.init(document.querySelectorAll('.tilt_action_cat_list'), {
474 max: 8, 475 speed: 1500, 476 scale: 1.02, 477 transition: true, 478 easing: 'cubic-bezier(.03,.98,.52,.99)', 479 perspective: 2400, 480 }); 481 } 482 483 // Process Tribe Events view after it was reloaded by AJAX 484 jQuery('.tribe-events-view').on( 'beforeAjaxComplete.tribeEvents beforeAjaxSuccess.tribeEvents beforeAjaxError.tribeEvents', dom_tribe_events_after_ajax ); 485 function dom_tribe_events_after_ajax( jqXHR, textStatus ) { 486 setTimeout( function() { 487 // Set up event handler again because .tribe-events-view was recreated after AJAX 488 jQuery('.tribe-events-view').on( 'beforeAjaxComplete.tribeEvents beforeAjaxSuccess.tribeEvents beforeAjaxError.tribeEvents', dom_tribe_events_after_ajax ); 489 // ToDo: Any actions after the Tribe Events View is reloaded 490 491 }, 10 ); 492 } 493 494 jQuery('.wpcf7-submit').wrap("<span class='wpcf7-submit-style'></span>").after("<span class='submit-style-in'></span>"); 495 496 // style line 497 if (jQuery( 'div.wpcf7 .style-line .wpcf7-form-control-wrap' ).length > 0) { 498 jQuery( 'div.wpcf7 .style-line .wpcf7-form-control-wrap' ).each( 499 function () { 500 jQuery(this).append('<span class="line"></span>'); 501 } 502 ); 503 } 504 505 function textarea_auto_height(txt) { 506 var hiddenDiv = jQuery(document.createElement('div')), 507 content = null; 508 txt.addClass('noscroll'); 509 hiddenDiv.addClass('hiddendiv'); 510 txt.after(hiddenDiv); 511 if(txt.val()) { 512 hiddenDiv.html(txt.val()); 513 txt.animate({ 'height' : hiddenDiv.outerHeight() 514 },800); 515 } 516 txt.bind('keyup', function() { 517 content = txt.val(); 518 content = content.replace(/\n/g, '<br>'); 519 hiddenDiv.html(content); 520 txt.animate({ 'height' : hiddenDiv.outerHeight() 521 },50); 522 }); 523 } 524 525 if (jQuery( 'div.wpcf7 .form-style-2 textarea' ).length > 0) { 526 jQuery( 'div.wpcf7 .form-style-2 textarea' ).each( 527 function () { 528 textarea_auto_height(jQuery(this)); 529 }); 530 } 531 532 // mc4wp - id 533 if (jQuery( '.mc4wp-form-fields' ).length > 0) { 534 var count_mc4wp = 1; 535 jQuery( '.mc4wp-form-fields' ).each( 536 function () { 537 jQuery(this).find('input[type="checkbox"]').each( 538 function () { 539 var id = jQuery(this).attr( 'id' ); 540 if(id) {} 541 else { 542 id = 'go'; 543 } 544 jQuery(this).attr('id', id + count_mc4wp); 545 jQuery(this).next('label').attr('for', id + count_mc4wp); 546 count_mc4wp++; 547 }); 548 }); 549 } 550 551 function mc4wpGO(form) { 552 jQuery(form).each(function () { 553 554 var form = jQuery(this), 555 btn = form.find('button, input[type="submit"], input[type="button"]'); 556 var $i_agree = form.find('input[type="checkbox"][name="i_agree_privacy_policy"]:not(.inited)' 557 + ',input[type="checkbox"][name="gdpr_terms"]:not(.inited)' 558 + ',input[type="checkbox"][name="wpgdprc"]:not(.inited)' 559 + ',input[type="checkbox"][name="AGREE_TO_TERMS"]:not(.inited)' 560 ); 561 form.addClass('inited_validation'); 562 563 if ( $i_agree.length > 0 ) { 564 $i_agree.addClass( 'inited' ); 565 } 566 567 btn.on( 'click', function(e) { 568 form.find('.trx_addons_message_box').remove(); 569 570 if ( $i_agree.length > 0 ) { 571 if ( ! $i_agree.get(0).checked ) { 572 form.append( '<div class="trx_addons_message_box trx_addons_message_box_error">' + DOM_STORAGE['msg_i_agree_error'] + '</div>' ); 573 var error_msg = form.find('.trx_addons_message_box'); 574 error_msg.fadeIn(600); 575 setTimeout( function() { 576 error_msg.fadeOut( 600, function() {error_msg = form.find('.trx_addons_message_box'); 577 error_msg.remove(); 578 } ); 579 }, 3000 ); 580 581 e.preventDefault(); 582 return false; 583 } 584 } 585 586 var rez = dom_form_validate(form, { 587 error_message_show: true, 588 error_message_time: 3000, 589 error_message_class: 'trx_addons_message_box trx_addons_message_box_error', 590 error_message_text: 'Global error text', 591 error_fields_class: 'mc4wp_error_field', 592 exit_after_first_error: true, 593 rules: [ 594 { 595 field: 'EMAIL', 596 min_length: {value: 7, message: DOM_STORAGE['mc4wp_msg_email_min']}, 597 max_length: {value: 60, message: DOM_STORAGE['mc4wp_msg_email_max']}, 598 mask: { 599 value: '^([a-zA-Z0-9_\\-]+\\.)*[a-zA-Z0-9_\\-]+@[a-zA-Z0-9_\\-]+(\\.[a-zA-Z0-9_\\-]+)*\\.[a-zA-Z]{2,6}$', 600 message: 'Invalid email address' 601 } 602 }, 603 ] 604 }); 605 606 if (!rez) { 607 jQuery(form).submit(); 608 } 609 else { 610 e.preventDefault(); 611 return rez; 612 } 613 614 }); 615 }); 616 } 617 mc4wpGO(jQuery(".mc4wp-form:not(.inited_validation)")); 618 619 var $document = jQuery(document), 620 body = jQuery('body'); 621 622 // Open/Close mobile menu 623 $document.on( 'action.mobile_menu_open', function(e, $menu) { 624 $menu.find( '.menu_mobile_widgets_area a[href*="mailto"]').addClass( 'underline_anim' ); 625 setTimeout( 626 function() { 627 $menu.find( '.menu_mobile_widgets_area a[href*="mailto"]' ).addClass( 'underline_do_hover' ); 628 }, 600 629 ); 630 } ); 631 $document.on( 'action.mobile_menu_close', function(e, $menu) { 632 $menu.addClass( 'out_anim' ); 633 setTimeout( function () { 634 $menu.removeClass('out_anim'); 635 jQuery('.menu_mobile_widgets_area a[href*="mailto"]').removeClass('underline_do_hover'); 636 }, 1000); 637 } ); 638 dom_add_filter( 'dom_filter_mobile_menu_close_timeout', function( timeout, $menu ) { 639 return 1000; 640 } ); 641 642 // Open/Close panel menu 643 // Prepare links to panel 644 body.find('.sc_layouts_panel_menu:not(.inited)').each( function() { 645 var self = jQuery(this), 646 id = self.attr('id'); 647 if (!id) return; 648 var link = jQuery('a[href="#'+id+'"]'); 649 if (link.length === 0) { 650 body.append('<a href="#'+id+'" class="trx_addons_hidden"></a>'); 651 link = jQuery('a[href="#'+id+'"]'); 652 } 653 link.addClass('trx_addons_panel_menu_link'); 654 }); 655 656 // Display panel on click on the panel link 657 function dom_skin_open_panel( id ) { 658 var $panel = jQuery( '#' + id ).addClass( 'opened' ); 659 $panel.prev('.sc_layouts_panel_menu_overlay' ).fadeIn(); 660 $panel.find( '[class*="trx_addons_title_with_link"] > a:not(.underline_anim)' ).addClass( 'underline_anim' ); 661 setTimeout( 662 function() { 663 $panel.find( '[class*="trx_addons_title_with_link"] > a.underline_anim' ).addClass( 'underline_do_hover' ); 664 }, 600 665 ); 666 body.addClass( 'sc_layouts_panel_menu_opened' ); 667 $document.trigger( 'action.stop_wheel_handlers' ); 668 } 669 670 jQuery( '.trx_addons_panel_menu_link:not(.panel_inited)' ) 671 .addClass( 'panel_inited' ) 672 .on( 'click', function(e) { 673 dom_skin_open_panel( jQuery(this).attr('href').substring(1) ); 674 e.preventDefault(); 675 return false;
676 }); 677 678 // Close panel 679 function dom_skin_close_panel() { 680 681 var $panel = jQuery( '.sc_layouts_panel_menu.opened' ).addClass( 'out_anim' ); 682 683 jQuery( '.sc_layouts_panel_menu_close' ).parents( 'sc_layouts_panel_menu' ).addClass( 'out_anim' ); 684 685 setTimeout(function () { 686 $panel.prev( '.sc_layouts_panel_menu_overlay' ).fadeOut(); 687 $panel.removeClass('out_anim').removeClass('opened'); 688 $panel.find('[class*="trx_addons_title_with_link"] > a.underline_anim').removeClass('underline_do_hover'); 689 body.removeClass( 'sc_layouts_panel_menu_opened' ); 690 $document.trigger( 'action.start_wheel_handlers' ); 691 }, 1000); 692 } 693 $document 694 .on( 'keyup', function(e) { 695 var $panel = jQuery( '.sc_layouts_panel_menu.opened'); 696 if (e.keyCode === 27) { 697 if ($panel.length === 1) { 698 dom_skin_close_panel(); 699 e.preventDefault(); 700 return false; 701 } 702 } 703 } 704 ); 705 706 jQuery( '.sc_layouts_panel_menu_close, .sc_layouts_panel_menu_overlay' ) 707 .on( 'click', function(e) { 708 dom_skin_close_panel(); 709 e.preventDefault(); 710 return false; 711 } 712 ); 713 714 jQuery( '.sc_layouts_panel_menu_close' ) 715 .on( 'keyup', function(e) { 716 var $panel = jQuery( '.sc_layouts_panel_menu.opened'); 717 if (e.keyCode === 13) { 718 if ($panel.length === 1) { 719 dom_skin_close_panel(); 720 e.preventDefault(); 721 return false; 722 } 723 } 724 } ) 725 .on( 'focus', function() { 726 if ( ! body.hasClass( 'sc_layouts_panel_menu_opened' ) ) { 727 jQuery( '#content_skip_link_anchor' ).focus(); 728 } 729 } ); 730 731 } 732 ); 733 734 // Search Modern ----------------- 735 //------------------------------- 736 var $search_wrap = jQuery( '.search_modern .search_wrap:not(.inited)' ); 737 738 if ( $search_wrap.length > 0 ) { 739 jQuery( $search_wrap.each( function() { 740 var $body = jQuery('body'), 741 $search_wrap_init = jQuery(this).addClass( 'inited' ), 742 search_field = $search_wrap_init.find( '.search_field' ), 743 ajax_timer = null; 744 745 // ESC is pressed 746 search_field.on('keyup', function(e) { 747 if (e.keyCode === 27) { 748 search_field.val(''); 749 $body.addClass('search_out_anim'); 750 setTimeout(function () { 751 dom_search_close($search_wrap_init); 752 $body.removeClass('search_open_anim'); 753 $body.removeClass('search_out_anim'); 754 $search_wrap_init.next( '.search_overlay' ).fadeOut(); 755 756 e.preventDefault(); 757 return false; 758 }, 800); 759 760 setTimeout(function () { 761 $search_wrap_init.parent().removeClass('search_active'); 762 $body.removeClass('search_active'); 763 }, 1200); 764 } 765 // AJAX search 766 if ($search_wrap_init.hasClass('search_ajax')) { 767 var s = search_field.val(); 768 if (ajax_timer) { 769 clearTimeout(ajax_timer); 770 ajax_timer = null; 771 } 772 if (s.length >= 4) { 773 ajax_timer = setTimeout(function () { 774 $search_wrap_init.addClass('search_progress'); 775 jQuery.post(TRX_ADDONS_STORAGE['ajax_url'], { 776 action: 'ajax_search', 777 nonce: TRX_ADDONS_STORAGE['ajax_nonce'], 778 text: s, 779 post_types: $search_wrap_init.find('input[name="post_types"]').val() 780 }).done(function (response) { 781 clearTimeout(ajax_timer); 782 ajax_timer = null; 783 var rez = {}; 784 if (response == '' || response == 0) { 785 rez = {error: TRX_ADDONS_STORAGE['msg_search_error']}; 786 } else { 787 try { 788 rez = JSON.parse(response); 789 } catch (e) { 790 rez = {error: TRX_ADDONS_STORAGE['msg_search_error']}; 791 console.log(response); 792 } 793 } 794 var msg = rez.error === '' ? rez.data : rez.error; 795 $search_wrap_init.removeClass('search_progress'); 796 search_field.parents('.search_ajax').find('.search_results_content').empty().append(msg); 797 search_field.parents('.search_ajax').find('.search_results').fadeIn(); 798 jQuery(document).trigger('action.got_ajax_response', { 799 action: 'ajax_search', 800 result: rez 801 }); 802 }); 803 }, 500); 804 } 805 } 806 807 }); 808 809 //Search Submit 810 var $search = $search_wrap_init.prev('.search_submit'); 811 $search.on('click', function(e) { 812 $search_wrap_init.parent().addClass('search_active'); 813 $body.addClass('search_active'); 814 if (!$search_wrap_init.hasClass('search_opened')) { 815 $search_wrap_init.addClass('search_opened'); 816 $body.addClass('search_open_anim'); 817 $search_wrap_init.next( '.search_overlay' ).fadeIn(); 818 setTimeout(function() { search_field.get(0).focus(); }, 500); 819 } else if (search_field.val() === '') { 820 if ($search_wrap_init.hasClass('search_opened')) 821 dom_search_close($search_wrap_init); 822 else 823 search_field.get(0).focus(); 824 } else { 825 $search_wrap_init.addClass('search_progress'); 826 $search_wrap_init.find('form').get(0).submit(); 827 } 828 e.preventDefault(); 829 return false;
830 }); 831 832 // Click "Search close" 833 $search_wrap_init.find('.search_close').add( 834 $search_wrap_init.next('.search_overlay') 835 ).on('click', function(e) { 836 $body.addClass('search_out_anim'); 837 838 setTimeout(function () { 839 dom_search_close($search_wrap_init); 840 $body.removeClass('search_open_anim'); 841 $body.removeClass('search_out_anim'); 842 $search_wrap_init.next( '.search_overlay' ).fadeOut(); 843 844 e.preventDefault(); 845 return false; 846 }, 800); 847 848 setTimeout(function () { 849 $search_wrap_init.parent().removeClass('search_active'); 850 $body.removeClass('search_active'); 851 }, 1200); 852 853 }); 854 855 // Click "Close search results" 856 $search_wrap_init.find('.search_results_close').on('click', function(e) { 857 jQuery(this).parent().fadeOut(); 858 e.preventDefault(); 859 return false; 860 }); 861 // Click "More results" 862 $search_wrap_init.on('click', '.search_more', function(e) { 863 if (search_field.val() !== '') 864 $search_wrap_init.find('form').get(0).submit(); 865 e.preventDefault(); 866 return false; 867 }); 868 })); 869 }
870 // Close search field (remove class 'search_opened' and close search results) 871 function dom_search_close($search_wrap_init) { 872 $search_wrap_init.removeClass('search_opened'); 873 $search_wrap_init.find('.search_results').fadeOut(); 874 } 875 876 // Add skin specific styles to the Google map 877 jQuery(document).on('action.add_googlemap_styles', function(e) { 878 if (typeof TRX_ADDONS_STORAGE == 'undefined') return; 879 TRX_ADDONS_STORAGE['googlemap_styles']['extra'] = [{"featureType": "water", "elementType": "geometry", "stylers": [{"color": "#e9e9e9"}, {"lightness": 17}]}, {"featureType": "landscape", "elementType": "geometry", "stylers": [{"color": "#f5f5f5"}, {"lightness": 20}]}, {"featureType": "road.highway", "elementType": "geometry.fill", "stylers": [{"color": "#ffffff"}, {"lightness": 17}]}, {"featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [{"color": "#ffffff"}, {"lightness": 29}, {"weight": 0.2}]}, {"featureType": "road.arterial", "elementType": "geometry", "stylers": [{"color": "#ffffff"}, {"lightness": 18}]}, {"featureType": "road.local", "elementType": "geometry", "stylers": [{"color": "#ffffff"}, {"lightness": 16}]}, {"featureType": "poi", "elementType": "geometry", "stylers": [{"color": "#f5f5f5"}, {"lightness": 21}]}, {"featureType": "poi.park", "elementType": "geometry", "stylers": [{"color": "#dedede"}, {"lightness": 21}]}, {"elementType": "labels.text.stroke", "stylers": [{"visibility": "on"}, {"color": "#ffffff"}, {"lightness": 16}]}, {"elementType": "labels.text.fill", "stylers": [{"saturation": 36}, {"color": "#333333"}, {"lightness": 40}]}, {"elementType": "labels.icon", "stylers": [{"visibility": "off"}]}, {"featureType": "transit", "elementType": "geometry", "stylers": [{"color": "#f2f2f2"}, {"lightness": 19}]}, {"featureType": "administrative", "elementType": "geometry.fill", "stylers": [{"color": "#fefefe"}, {"lightness": 20}]}, {"featureType": "administrative", "elementType": "geometry.stroke", "stylers": [{"color": "#fefefe"}, {"lightness": 17}, {"weight": 1.2}]}]; 880 } ); 881 882 // Init skin-specific hidden elements when their parent container becomes visible 883 // Attention! Don't forget to add the class "inited" and check it to prevent re-initialize the elements 884 jQuery( document ).on( 885 'action.init_hidden_elements', function() { 886 skin_blogger_toggle_filter_upd_value(); 887 skin_add_custom_width_filter_list(); 888 // Move title with cursor 889 mousemove_for_portfolio_large(); 890 mousemove_for_portfolio_small(); 891 892 add_portfolio_image_wrap(); 893 894 // Add image background on wrap in portfolio Stretch 895 background_image_portfolio_stretch(); 896 897 skin_blogger_controls_title(); 898 } 899 ); 900 901 // Skin-specific scroll actions 902 jQuery( document ).on( 903 'action.scroll_dom', function() { 904 905 } 906 ); 907 908 // Skin-specific resize actions 909 jQuery( document ).on( 910 'action.resize_dom', function() { 911 extra_margin_top_video_popup_button(); 912 dom_skin_post_header_init(); 913 skin_add_custom_width_filter_list(); 914 } 915 ); 916 917 function extra_margin_top_video_popup_button() { 918 if (jQuery('.single-format-video .post_header_wrap_style_style-1 .post_featured.with_video.with_thumb.post_featured_bg + .post_header').length > 0) { 919 var alter_height = jQuery('.single-format-video .post_header_wrap_style_style-1 .post_featured.with_video.with_thumb.post_featured_bg + .post_header').height(); 920 jQuery('.single-format-video .post_header_wrap_style_style-1 .post_featured.with_video.with_thumb.post_featured_bg .post_video_hover_popup').css({"margin-top": (- alter_height / 2 + 'px'), "opacity":1}); 921 } 922 } 923 924 925})();
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.