1/* global jQuery, TRUTH_STORAGE */ 2 3( function() { 4 "use strict"; 5 6 var $window = jQuery( window ), 7 $document = jQuery( document ), 8 is_touch_device = ('ontouchstart' in document.documentElement); 9 10 11 12 /* Ready 13 ***************************/ 14 $document.ready(function() { 15 // Add class to body if current deviced is touched 16 if ( is_touch_device ) { 17 jQuery('body').addClass('touch_device'); 18 } 19 20 // Color switcher init 21 truth_skin_color_switcher_ready(); 22 23 // Header search - gutenberg fix 24 truth_skin_header_search_ready(); 25 26 // Infinite scroll in the single posts 27 TRUTH_STORAGE['cur_page_id'] = jQuery('body').hasClass('single-post') ? jQuery('body').attr('class').match(/postid-[0-9]+/g).toString().replace('postid-', '') : ''; 28 29 // Post navigation 30 truth_skin_post_nav_links_ready(); 31 truth_skin_post_nav_links_label(); 32 33 // Post comments 34 truth_skin_post_comments_ready_ajax(); 35 36 // Post blocks 37 truth_skin_post_blocks_ready_resize(); 38 39 // Post audio 40 truth_skin_post_audio_ready_ajax(); 41 42 // Post header 43 truth_skin_post_header_ready_resize_ajax(); 44 45 // Blog 46 truth_skin_blog_ready_resize(); 47 truth_skin_blog_band_date(); 48 truth_skin_blog_archive_button_link(); 49 truth_skin_blocks_blog_masonry(); 50 51 // Add icons wrapper for widget title 52 truth_skin_widget_title_ready(); 53 54 // Magnific Popup 55 truth_skin_magnific_ready(); 56 57 // MailChimp 58 truth_skin_mailchimp_ready_ajax(); 59 60 // Powerkit 61 truth_skin_powerkit_ready(); 62 63 // Elementor Widget Video 64 truth_skin_elementor_video_ready(); 65 66 // Elementor Widget Counter 67 truth_skin_elementor_counter_ready(); 68 69 70 jQuery('.single-post .video_popup ').each(function(){ 71 jQuery(this).find('.post_video_hover').addClass('trx_addons_popup_link'); 72 73 }); 74 }); 75 76 77 78 /* Page Load 79 ***************************/ 80 $window.load(function() { 81 // Position of Animated Item (on page load) 82 jQuery('.ta_mouse_wheel').each(function() { 83 var item = jQuery(this); 84 truth_skin_mousewheelItemPosition(item); 85 }); 86 87 // Progress bar 88 var scroll_progress = jQuery('.scroll_progress_fixed'); 89 if ( scroll_progress.length > 0 ) { 90 scroll_progress.appendTo(jQuery('.sc_layouts_row_fixed')); 91 } 92 93 // Visible on load 94 truth_skin_isVisibleOnLoad(".single-post .sc_blogger.alignright .sc_blogger_item", "truth_animation_fade_in_up"); 95 truth_skin_isVisibleOnLoad(".single-post .sc_blogger.alignleft .sc_blogger_item", "truth_animation_fade_in_up"); 96 truth_skin_isVisibleOnLoad(".single-post .content_wrap .sc_widget_video", "truth_animation_fade_in_up"); 97 truth_skin_isVisibleOnLoad(".single-post .content_wrap .sc_widget_slider", "truth_animation_fade_in_up"); 98 99 // Title Animation 100 truth_skin_isVisibleOnLoad(".widgettitle_icons_wrapper", "truth_animation_fade_in"); 101 102 // Footer Animation 103 truth_skin_isVisibleOnLoad(".footer_wrap .wp-widget-nav_menu li", "truth_animation_fade_in"); 104 truth_skin_isVisibleOnLoad(".footer_wrap .widget_nav_menu li", "truth_animation_fade_in"); 105 truth_skin_isVisibleOnLoad(".footer_wrap .mailchimp-form-2 .EMAIL-label", "truth_animation_width"); 106 107 // Powerkit Animation 108 truth_skin_isVisibleOnLoad(".pk-widget-author-container .pk-author-title", "truth_animation_fade_in_up"); 109 truth_skin_isVisibleOnLoad(".pk-widget-author-container .pk-author-data", "truth_animation_fade_in_up"); 110 truth_skin_isVisibleOnLoad(".pk-widget-author-container .widget_title", "truth_animation_fade_in_up"); 111 112 // Color scheme switcher 113 truth_skin_active_color_scheme(); 114 }); 115 116 117 118 /* Page Scroll 119 ***************************/ 120 $document.on('action.scroll_truth', function() { 121 // Infinite scroll in the single posts 122 truth_skin_infinite_scroll_single_posts_resize(); 123 124 // Progress bar 125 var scroll_progress = jQuery('body > .scroll_progress_fixed'); 126 if ( scroll_progress.length > 0 ) { 127 scroll_progress.appendTo(jQuery('.sc_layouts_row_fixed')); 128 } 129 130 // Blog Single Post Animation 131 truth_skin_isVisible(".single-post .sc_blogger.alignright .sc_blogger_item", "truth_animation_fade_in_up"); 132 truth_skin_isVisible(".single-post .sc_blogger.alignleft .sc_blogger_item", "truth_animation_fade_in_up"); 133 truth_skin_isVisible(".single-post .content_wrap .sc_widget_video", "truth_animation_fade_in_up"); 134 truth_skin_isVisible(".single-post .content_wrap .sc_widget_slider", "truth_animation_fade_in_up"); 135 136 // Title Animation 137 truth_skin_isVisible(".widgettitle_icons_wrapper", "truth_animation_fade_in"); 138 139 // Footer Animation 140 truth_skin_isVisible(".footer_wrap .wp-widget-nav_menu li", "truth_animation_fade_in"); 141 truth_skin_isVisible(".footer_wrap .widget_nav_menu li", "truth_animation_fade_in"); 142 truth_skin_isVisible(".footer_wrap .mailchimp-form-2 .EMAIL-label", "truth_animation_width"); 143 144 // Powerkit Animation 145 truth_skin_isVisible(".pk-widget-author-container .pk-author-title", "truth_animation_fade_in_up"); 146 truth_skin_isVisible(".pk-widget-author-container .pk-author-data", "truth_animation_fade_in_up"); 147 truth_skin_isVisible(".pk-widget-author-container .widget_title", "truth_animation_fade_in_up"); 148 149 // Mouse Wheel 150 truth_skin_mousewheelScroll(".ta_mouse_wheel"); 151 152 // Parallax Images 153 truth_skin_imageParallax(".blogger_coverbg_parallax.sc_blogger_item_with_image .featured_bg_wrapper .featured_bg"); 154 truth_skin_imageParallax(".blogger_coverbg_parallax .sc_blogger_item_with_image .featured_bg_wrapper .featured_bg"); 155 truth_skin_imageParallax(".blogger_coverbg_parallax.post_format_image .featured_bg_wrapper .featured_bg"); 156 truth_skin_imageParallax(".blogger_coverbg_parallax .post_format_image .featured_bg_wrapper .featured_bg"); 157 }); 158 159 160 161 /* Page Resize 162 ***************************/ 163 $document.on('action.resize_truth', function() { 164 // Post blocks 165 truth_skin_post_blocks_ready_resize(); 166 167 // Post header 168 truth_skin_post_header_ready_resize_ajax(); 169 170 // Blog 171 truth_skin_blog_ready_resize(); 172 }); 173 174 175 176 /* Elementor Editor 177 ***************************/ 178 $window.on( 'elementor/frontend/init', function() { 179 if ( typeof window.elementorFrontend !== 'undefined' && typeof window.elementorFrontend.hooks !== 'undefined' ) { 180 // If Elementor is in the Editor's Preview mode 181 if ( elementorFrontend.isEditMode() ) { 182 // Init elements after creation 183 elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $cont ) { 184 // Add icons wrapper for widget title 185 truth_skin_widget_title_ready(); 186 187 // Elementor Widget Video ready 188 truth_skin_elementor_video_ready(); 189 } ); 190 } 191 } 192 }); 193 194 195 196 /* AJAX 197 ***************************/ 198 $document.on('action.got_ajax_response', function(event, params) { 199 if (params['action'] == 'prev_post_loading') { 200 201 var res_post_id = ''; 202 if ( params['result'] ) { 203 var res = jQuery( params['result'] ); 204 res_post_id = res.find('.content > article').attr('id'); 205 res_post_id = res_post_id.replace('post-', ''); 206 } 207 208 jQuery.post(TRUTH_STORAGE['ajax_url'], { 209 action: 'truth_skin_prev_post_loading', 210 nonce: TRUTH_STORAGE['ajax_nonce'], 211 post_id: res_post_id 212 }, function(response) { 213 if (response) { 214 // Append kadence styles to head 215 jQuery('head').append(response); 216 217 // Post audio 218 truth_skin_post_audio_ready_ajax(); 219 220 // Post comments 221 truth_skin_post_comments_ready_ajax(); 222 223 // MailChimp 224 truth_skin_mailchimp_ready_ajax(); 225 226 // Post blocks 227 truth_skin_post_blocks_ready_resize(); 228 229 // Post header 230 truth_skin_post_header_ready_resize_ajax(); 231 232 // Call other functions 233 $document.trigger('action.ajax_truth'); 234 235 // Recalculate blocks parameters 236 $document.trigger('resize'); 237 } 238 }); 239 } 240 }); 241 242 243 244 /* Init hidden elements 245 ***************************/ 246 $document.on( 'action.init_hidden_elements', truth_skin_blog_init_hidden ); 247 248 249 250 // Animated item size 251 function truth_skin_itemVarsFunction(item) { 252 var itemVars = { 253 height: item.outerHeight(), 254 topPosition: item.offset().top, 255 bottomPosition: item.offset().top + item.outerHeight() 256 }; 257 return itemVars; 258 } 259 260 // Browser window size 261 function truth_skin_windowVarsFunction() { 262 var webWindow = $window; 263 var windowVars = { 264 height: webWindow.height(), 265 topPosition: webWindow.scrollTop(), 266 bottomPosition: webWindow.height() + webWindow.scrollTop() 267 }; 268 return windowVars; 269 } 270 271 // Mouse weel animated element trigger 272 function truth_skin_mousewheelScroll(item) { 273 var animationElements = jQuery.find(item), 274 webWindow = truth_skin_windowVarsFunction(); 275 276 jQuery.each(animationElements, function() { 277 var element = jQuery(this), 278 item = truth_skin_itemVarsFunction(jQuery(this)); 279 if( element.hasClass('under_position') && (item.bottomPosition < webWindow.topPosition) ) { 280 element.removeClass('under_position'); 281 element.addClass('over_position'); 282 }
282 else if ( element.hasClass('over_position') && (item.topPosition > webWindow.bottomPosition) ) { 283 element.removeClass('over_position'); 284 element.addClass('under_position'); 285 } 286 287 // Click trigger 288 element.click(function() { 289 if ( element.hasClass('under_position') && (item.bottomPosition >= webWindow.topPosition) && (item.topPosition <= webWindow.bottomPosition)) { 290 jQuery('html,body').stop().animate({ 291 scrollTop: truth_skin_scrollPosition(element, 'bottom') }, 292 500, 'swing', function() { 293 element.removeClass('under_position'); 294 setTimeout(function() { 295 element.addClass('over_position'); 296 }, 500); 297 }); 298 } 299 300 if ( element.hasClass('over_position') && (item.topPosition >= webWindow.topPosition) && (item.bottomPosition <= webWindow.bottomPosition)) { 301 jQuery('html,body').stop().animate({ 302 scrollTop: truth_skin_scrollPosition(element, 'top') }, 303 500, 'swing', function() { 304 element.removeClass('over_position'); 305 setTimeout(function() { 306 element.addClass('under_position'); 307 }, 500); 308 }); 309 } 310 }); 311 }); 312 } 313 314 // Position of animated item (on page load) 315 function truth_skin_mousewheelItemPosition(item) { 316 var itemVars = truth_skin_itemVarsFunction(item), 317 windowVars = truth_skin_windowVarsFunction(), 318 position = ''; 319 if ((itemVars.topPosition < windowVars.topPosition) && ( itemVars.bottomPosition < windowVars.topPosition)) { 320 position = 'over_position'; 321 } else if ((itemVars.topPosition > windowVars.bottomPosition) && ( itemVars.bottomPosition > windowVars.bottomPosition)) { 322 position = 'under_position'; 323 } 324 item.addClass(position); 325 } 326 327 // Position of animated item (on page load) 328 function truth_skin_isVisibleOnLoad(item, className, type = '') { 329 var animatedItem = jQuery.find(item); 330 jQuery.each(animatedItem, function() { 331 if ( jQuery(this).is(':hidden') ) return; 332 var element = jQuery(this), 333 itemVars = truth_skin_itemVarsFunction(element), 334 windowVars = truth_skin_windowVarsFunction(); 335 if ((itemVars.topPosition >= windowVars.topPosition) && (itemVars.bottomPosition <= windowVars.bottomPosition)) { 336 element.addClass(className); 337 } 338 }) 339 } 340 341 // Make sure the picture is visible 342 function truth_skin_isVisible(item, className, type = '') { 343 var animationElements = jQuery.find(item), 344 webWindow = truth_skin_windowVarsFunction(); 345 jQuery.each(animationElements, function() { 346 if ( jQuery(this).is(':hidden') ) return; 347 var element = jQuery(this), 348 item = truth_skin_itemVarsFunction(element); 349 if ( item.topPosition != 0 && item.bottomPosition != 0 && (item.bottomPosition >= webWindow.topPosition) && (item.topPosition <= webWindow.bottomPosition)) { 350 element.addClass(className); 351 } 352 }); 353 } 354 355 // Function for image parallax by page scroll 356 function truth_skin_imageParallax(item) { 357 var windowTopPos = $window.scrollTop(); 358 if(windowTopPos > 1) { 359 jQuery(item).each(function(){ 360 var itemParallax = jQuery(this); 361 var itemParallaxOff = itemParallax.hasClass('background_parallax_off'); 362 var itemTopPos = itemParallax.offset().top; 363 var itembottomPosition = itemParallax.offset().top + itemParallax.outerHeight(); 364 var itemNewPos = parseInt((windowTopPos - itemTopPos)/12); 365 var itemOpacity = parseInt(100 - itemNewPos); 366 367 itemParallax.addClass('background_parallax'); 368 369 if(windowTopPos >= itembottomPosition) { 370 itemParallax.addClass('background_parallax_off'); 371 } else if(windowTopPos <= itemTopPos){ 372 itemParallax.removeClass('background_parallax_off'); 373 } 374 if(windowTopPos >= itemTopPos && !itemParallaxOff) { 375 if(itemNewPos <= 50 && itemNewPos > 0) { 376 jQuery(this).css({ 377 'background-position':'center ' + itemNewPos +'px', 378 'opacity': '0.'+ itemOpacity 379 }); 380 } 381 } else { 382 jQuery(item).each(function(){ 383 jQuery(this).css({ 384 'background-position':'center 0', 385 'opacity': '1' 386 }); 387 }); 388 } 389 }); 390 } else { 391 jQuery(item).each(function(){ 392 jQuery(this).css({ 393 'background-position':'center 0', 394 'opacity': '1' 395 }); 396 }); 397 } 398 } 399 400 // Scroll To 401 function truth_skin_scrollPosition(item, itemSibling) { 402 var sibl, 403 scroll, 404 parentTop, 405 siblTop, 406 fixedRowsHeight, 407 htmltagAttrStyleArr, 408 htmltagAttrStyle = jQuery('html').attr('style'), 409 parent = item.parents('section.elementor-element:not(.elementor-inner-section)'), 410 siblName = 'section.elementor-element'; 411 412 if (htmltagAttrStyle.length > 0) { 413 htmltagAttrStyleArr = htmltagAttrStyle.split(';') 414 for (var i = 0; i < htmltagAttrStyleArr.length; i++) { 415 if (htmltagAttrStyleArr[i].includes('--fixed-rows-height:')) { 416 fixedRowsHeight = htmltagAttrStyleArr[i].replace('--fixed-rows-height:','').replace('px',''); 417 } 418 } 419 } 420 421 if(itemSibling == 'top' ) { 422 parentTop = parent.offset().top.toString(); 423 scroll = parentTop - fixedRowsHeight; 424 return scroll; 425 } else if (itemSibling == 'bottom') { 426 sibl = parent.next(siblName); 427 if(sibl.attr('class') === undefined){ 428 return webWindow.bottomPosition; 429 } else { 430 var siblTop = sibl.offset().top.toString();
431 scroll = siblTop - fixedRowsHeight; 432 return scroll; 433 } 434 } 435 } 436 437 438 439 // Color switcher init 440 // Color switcher init 441 function truth_skin_color_switcher_ready() { 442 if ( jQuery('#color_scheme_switcher').length > 0 ) { 443 truth_skin_replace_section_color_scheme(); 444 // Change color scheme after page load 445 var site_color_scheme = truth_get_cookie('truth_color_scheme'); 446 if ( site_color_scheme != null ) { 447 truth_skin_remove_color_scheme_class(); 448 jQuery('body').addClass('scheme_' + site_color_scheme); 449 jQuery('#color_scheme_switcher li[data-value="' + site_color_scheme + '"]').addClass('selected'); 450 truth_skin_invert_logo_colors(site_color_scheme); 451 setTimeout(function(){ 452 jQuery('body').removeClass('bg_white'); 453 }, 1000); 454 } 455 456 // Open color schemes 457 jQuery('#color_scheme_switcher').on('click', function(){ 458 jQuery(this).toggleClass('opened'); 459 }); 460 461 // Change color scheme on the button click 462 jQuery('#color_scheme_switcher li').on('click', function() { 463 jQuery('body').removeClass('bg_white'); 464 jQuery('#color_scheme_switcher li.selected').removeClass('selected'); 465 var val = jQuery(this).attr('data-value'); 466 var newScheme = 'scheme_' + val; 467 jQuery(this).addClass('selected'); 468 truth_skin_remove_color_scheme_class(); 469 jQuery('body').addClass(newScheme); 470 471 truth_skin_replace_section_color_scheme(newScheme); 472 473 jQuery('#color_scheme_switcher').removeClass('opened'); 474 truth_set_cookie( 'truth_color_scheme', val, { expires: 365, path: '/' } ); 475 truth_skin_invert_logo_colors(val); 476 }); 477 } 478 } 479 480 // Change color scheme for sections with chosen scheme by default state 481 function truth_skin_replace_section_color_scheme(scheme) { 482 /* Only for skin Default (with more then 2 color schemes) */ 483 var newScheme = scheme; 484 var siteColorScheme = truth_get_cookie('truth_color_scheme'); // get chosen scheme by picker 485 486 var schemeDefault = 'scheme_default', 487 schemeDark = 'scheme_dark', 488 schemeSecondDefault = 'scheme_second_default', 489 schemeSecondDark = 'scheme_second_dark'; 490 491 492 // Replace color scheme on each section 493 jQuery('.elementor-section[class*="scheme_"], .sc_layouts_panel[class*="scheme_"], .elementor-element[class*="scheme_"], footer[class*="scheme_"]').each( function() { 494 495 var sectionScheme = jQuery(this).attr("class").match(/\bscheme_\S+/g).toString(); 496 497 498 499 // change sections color scheme if cookie exist 500 if( newScheme === undefined && siteColorScheme != null ) { 501 if(sectionScheme === siteColorScheme) { 502 return; 503 } 504 // section has first type of color schemes, new scheme has second type 505 if ( (sectionScheme.indexOf("second") == -1) && (siteColorScheme.indexOf("second") >= 0 ) ) { 506 507 if(sectionScheme.indexOf("default") >= 0) { 508 // section has light color scheme 509 jQuery(this).removeClass(sectionScheme).addClass(schemeSecondDefault); 510 } else { 511 // section has dark color scheme 512 jQuery(this).removeClass(sectionScheme).addClass(schemeSecondDark); 513 } 514 } else if( (sectionScheme.indexOf("second") >= 0) && (siteColorScheme.indexOf("second") == -1) ) { 515 // section has second type of color schemes, new scheme has first type 516 if(sectionScheme.indexOf("default") >= 0) { 517 // section has light color scheme 518 jQuery(this).removeClass(sectionScheme).addClass(schemeDefault); 519 } else { 520 // section has dark color scheme 521 jQuery(this).removeClass(sectionScheme).addClass(schemeDark); 522 } 523 } 524 } 525 526 // change sections color scheme by click on picker 527 if( newScheme != undefined ) { 528 if(sectionScheme === newScheme) { 529 return; 530 } 531 if (newScheme != undefined && (sectionScheme.indexOf("second") == -1) && (newScheme.indexOf("second") >= 0 ) ) { 532 // section has first type of color schemes, new scheme has second type 533 if(sectionScheme.indexOf("default") >= 0) { 534 // section has light color scheme 535 jQuery(this).removeClass(sectionScheme).addClass(schemeSecondDefault); 536 } else { 537 // section has dark color scheme 538 jQuery(this).removeClass(sectionScheme).addClass(schemeSecondDark); 539 } 540 } else if((sectionScheme.indexOf("second") >= 0) && (newScheme.indexOf("second") == -1)) { 541 // section has second type of color schemes, new scheme has first type 542 if(sectionScheme.indexOf("default") >= 0) { 543 // section has light color scheme 544 jQuery(this).removeClass(sectionScheme).addClass(schemeDefault); 545 } else { 546 // section has dark color scheme 547 jQuery(this).removeClass(sectionScheme).addClass(schemeDark); 548 } 549 } 550 } 551 }); 552 } 553 554 // Header search - gutenberg fix 555 function truth_skin_header_search_ready() { 556 if ( jQuery('header .kt-row-column-wrap .search_style_fullscreen').length > 0 ) { 557 jQuery('header .kt-row-column-wrap .search_style_fullscreen').each(function() { 558 var search_wrap = jQuery(this), 559 search_field = search_wrap.find('.search_field'), 560 column_wrap = search_wrap.parents('.kt-row-column-wrap'); 561 562 // Click "Search submit" 563 search_wrap.find('.search_submit').on('click', function(e) { 564 if ( search_wrap.hasClass('search_opened') ) { 565 column_wrap.addClass('search_opened'); 566 } else { 567 column_wrap.removeClass('search_opened'); 568 } 569 }); 570 571 // Click "Search close" 572 search_wrap.find('.search_close').on('click', function(e) { 573 column_wrap.removeClass('search_opened'); 574 }); 575 }); 576 } 577 } 578 579 // Remove body color scheme class 580 function truth_skin_remove_color_scheme_class() { 581 jQuery('#color_scheme_switcher li').each(function(){ 582 var val = jQuery(this).attr('data-value'); 583 jQuery('body').removeClass('scheme_' + val); 584 }); 585 } 586 587 // Highlight the skin active color scheme 588 function truth_skin_active_color_scheme() { 589 var activeColorScheme = truth_get_cookie('truth_color_scheme'); 590 if ( jQuery('#color_scheme_switcher').length > 0 && activeColorScheme === null) { 591 var colorScheme = jQuery('body').attr("class").match(/\bscheme_\S+/g).toString(); 592 jQuery('#color_scheme_switcher li.' + colorScheme).not('.selected').addClass('selected'); 593 } 594 } 595 596 // Invert logo colors 597 function truth_skin_invert_logo_colors(site_color_scheme) { 598 if ( jQuery('#color_scheme_switcher').hasClass('invert') ) { 599 600 if ( site_color_scheme == 'dark' || site_color_scheme == 'second_dark') { 601 jQuery('body.scheme_' + site_color_scheme).find('header:not([class*="scheme_"]), .menu_mobile:not([class*="scheme_"]), footer:not([class*="scheme_"]), #trx_addons_login_popup').find('.logo_image, .sc_layouts_logo').addClass('invert'); 602 } else { 603 jQuery('body.scheme_' + site_color_scheme).find('header:not([class*="scheme_"]), .menu_mobile:not([class*="scheme_"]), footer:not([class*="scheme_"]), #trx_addons_login_popup').find('.logo_image, .sc_layouts_logo').removeClass('invert'); 604 } 605 } 606 } 607 // Post navigation ready 608 function truth_skin_post_nav_links_ready() { 609 // Duplicate post navigation 610 if ( jQuery('.nav-links-single').length > 0 ) { 611 jQuery('.nav-links-single.nav-links-fixed:not(.inited)').addClass('inited').each(function() { 612 var links = jQuery(this); 613 var clone = links.clone().removeClass('nav-links-fixed nav-links-with-thumbs'); 614 clone.insertAfter(links); 615 links.find('.nav-arrow-label').each(function() { 616 var i = jQuery(this); 617 i.insertBefore(i.parent()); 618 }); 619 }); 620 } 621 } 622 // Post navigation label 623 function truth_skin_post_nav_links_label() { 624 // Removing ":" at the end of the word 625 if ( jQuery('.post-navigation-link__label').length > 0 ) { 626 jQuery('.post-navigation-link__label:not(.inited)').addClass('inited').each(function() { 627 var label = jQuery(this); 628 var text = label.text().replace(/:\s*$/, ""); 629 label.text(text); 630 }); 631 } 632 } 633 634 // Post comments ready 635 function truth_skin_post_comments_ready_ajax() { 636 if ( jQuery('.comments_wrap').length > 0 ) { 637 // Add lines to parents 638 jQuery('.comments_wrap:not(.inited)').addClass('inited').each(function() { 639 var wrap = jQuery(this); 640 var button = wrap.find('.form-submit input[type="submit"]').removeAttr('type').removeAttr('name'); 641 var val = button.val(); 642 button.replaceWith(jQuery('<button class="sc_button sc_button_default sc_button_size_large sc_button_with_icon sc_button_icon_right hover_style_icon_1 color_style_1"><span class="sc_button_icon"><span class="icon-comment-1"></span></span><span class="sc_button_text"><span class="sc_button_title">' + val + '</span></span></button>')); 643 wrap.find('.comments_list_wrap ul > li > ul').each(function() { 644 jQuery(this).parent().addClass('has-children'); 645 }); 646 }); 647 648 // Show/Hide Comments 649 jQuery('.show_comments_button:not(.inited)').addClass('inited').on('click', function(e) { 650 var bt = jQuery(this); 651 if (bt.attr('href') == '#') { 652 var comments_wrap = bt.parent().find('+ .comments_wrap'); 653 bt.toggleClass('opened').text(bt.data(bt.hasClass('opened') ? 'hide' : 'show')); 654 comments_wrap.slideToggle(function() { 655 comments_wrap.toggleClass('opened'); 656 }); 657 e.preventDefault(); 658 return false;
659 } 660 }); 661 } 662 } 663 664 // Post blocks ready 665 function truth_skin_post_blocks_ready_resize() { 666 if ( jQuery('[class*="is-style-align"][class*="is-style-size"]').length > 0 ) { 667 if ( $window.width() < 1680 ) { 668 jQuery('[class*="is-style-align"][class*="is-style-size"] + .trx_addons_reviews_block').each(function(){ 669 jQuery(this).prev().addClass('responsive_view'); 670 }); 671 } else { 672 jQuery('[class*="is-style-align"][class*="is-style-size"] + .trx_addons_reviews_block').each(function(){ 673 jQuery(this).prev().removeClass('responsive_view'); 674 }); 675 } 676 } 677 } 678 679 // Post audio 680 function truth_skin_post_audio_ready_ajax() { 681 jQuery('.post_header_wrap_in_header .post_featured.with_thumb:not(.audio_inited)').each(function() { 682 var featured = jQuery(this); 683 if ( featured.find('.mejs-container').length > 0 ) { 684 featured.addClass('audio_inited'); 685 var audio_wrap = featured.find('.post_audio'); 686 var audio = audio_wrap.find('audio')[0]; 687 var btn = jQuery('<div class="post_audio_btn"></div>'); 688 var header = featured.parent().find(' + .post_header'); 689 if ( header.length == 0 ) { 690 header = featured; 691 } 692 header.prepend(btn); 693 audio_wrap.hide(); 694 btn.on('click', function() { 695 audio_wrap.slideToggle(function(){ 696 audio_wrap.find('.mejs-playpause-button').click(); 697 }); 698 }); 699 } else { 700 setTimeout(function(){ 701 truth_skin_post_audio_ready_ajax(); 702 }, 1000); 703 } 704 }); 705 } 706 707 // Post header 708 function truth_skin_post_header_ready_resize_ajax() { 709 var header = jQuery('.post_header_wrap_style_style-1.with_featured_image,\ 710 .post_header_wrap_style_style-2.with_featured_image,\ 711 .post_header_wrap_style_style-3.with_featured_image'); 712 713 if ( jQuery(header).find('.post_featured.with_gallery').length > 0 ) { 714 return; 715 } 716 717 header.find('.post_featured').css('min-height', 0); 718 header.each(function() { 719 var self = jQuery(this); 720 var image_h = self.find('.post_featured').outerHeight(); 721 var info_h = self.find('.post_header').outerHeight(); 722 var x = 140; 723 if ( jQuery('body').hasClass('mobile_layout') ) { 724 x = 80; 725 } 726 727 info_h = info_h + x; 728 if ( info_h >= image_h ) { 729 self.find('.post_featured').css('min-height', info_h); 730 } 731 }); 732 } 733 734 // Blog 735 function truth_skin_blog_ready_resize() { 736 // Blog - Band 737 jQuery('.post_layout_band .slider_container').each(function() { 738 if ( $window.width() <= 600 ) { 739 jQuery(this).data('ratio', '16:9'); 740 } else { 741 jQuery(this).data('ratio', '1:1'); 742 } 743 }); 744 } 745 746 // Add icons wrapper for widget title 747 function truth_skin_widget_title_ready() { 748 jQuery('.content .widget:not(.wp-widget-powerkit_widget_author) .widget_title:not(.inited), \ 749 .content .widget:not(.wp-widget-powerkit_widget_author) .widgettitle:not(.inited), \ 750 .sidebar .widget .widget_title:not(.inited), \ 751 .sidebar .widget .widgettitle:not(.inited), \ 752 .elementor-sidebar .widget .widget_title:not(.inited):not(.inited), \ 753 .elementor-sidebar .widget .widgettitle:not(.inited), \ 754 .elementor-sidebar .sc_item_title:not(.inited), \ 755 .gutenberg-sidebar .widget .widget_title:not(.inited):not(.inited), \ 756 .gutenberg-sidebar .widget .widgettitle:not(.inited), \ 757 .gutenberg-sidebar .sc_item_title:not(.inited), \ 758 .footer_wrap .widget_recent_posts .sc_recent_posts_title_type_classic .widget_title:not(.inited), \ 759 .footer_wrap .widget_recent_posts .sc_recent_posts_title_type_classic .widgettitle:not(.inited), \ 760 .footer_wrap .widget_categories_list .widget_title:not(.inited), \ 761 .footer_wrap .widget_categories_list .widgettitle:not(.inited), \ 762 .footer_wrap .sc_widget_aboutme .widget_title:not(.inited), \ 763 .footer_wrap .sc_widget_aboutme .widgettitle:not(.inited), \ 764 .footer_wrap .wp-widget-search .widget_title:not(.inited), \ 765 .footer_wrap .wp-widget-search .widgettitle:not(.inited) ').each(function(){ 766 var self = jQuery(this).addClass('inited'); 767 var title = self.html(); 768 var titleWithIcons = title + "<span class="+'"widgettitle_icons_wrapper"'+"><span></span><span></span><span></span></span>"; 769 self.html(titleWithIcons); 770 }); 771 } 772 773 // Magnific Popup 774 function truth_skin_magnific_ready() { 775 jQuery('.video_hover.trx_addons_popup_link').on('mfpOpen', function() { 776 var x = jQuery('html').attr('style'); 777 if ( x ) { 778 x = x.replace('overflow: hidden', 'overflow: hidden !important'); 779 } 780 jQuery('html').attr('style', x); 781 }); 782 } 783 784 // MailChimp 785 function truth_skin_mailchimp_ready_ajax() { 786 if ( jQuery('.yikes-easy-mc-form').length > 0 ) { 787 jQuery('.yikes-easy-mc-form:not(.inited)').addClass('inited').each(function() { 788 var form = jQuery(this); 789 var checkbox = form.find('.yikes-mailchimp-eu-compliance-label'); 790 form.find('.yikes-easy-mc-submit-button').after(checkbox); 791 }); 792 } 793 } 794 795 // Band Date 796 function truth_skin_blog_band_date() { 797 798 // Change post Band date output 799 jQuery('.post_band_date_wrap:not(.inited)').each(function() { 800 var self = jQuery(this), 801 date = self.find('time a'), 802 fullDate = date.length > 0 ? date.text() : '', 803 parsedDate = fullDate.split(' '), 804 dateDay = '', 805 dateOther = ''; 806 807 if(parsedDate.length == 3) { 808 self.addClass('inited'); 809 } else { 810 return; 811 } 812 813 for (var i = 0; i < parsedDate.length; i++) { 814 if(parsedDate[i].length <= 2) { 815 dateDay = '<div class="day">' + parsedDate[i] + '</div>'; 816 } else { 817 dateOther += i == 2 ? parsedDate[i] : parsedDate[i] + ' '; 818 } 819 } 820 821 dateOther= '<div class="post_meta">' + dateOther + '</div>'; 822 var dateOutput = dateDay + dateOther; 823 date.html(dateOutput); 824 }); 825 } 826 827 // Blog add link to the button 828 function truth_skin_blog_archive_button_link() { 829 var postItem = jQuery('.post_link_holder'); 830
831 if ( postItem.length > 0 ) { 832 jQuery(postItem).each(function() { 833 var post = jQuery(this), 834 postItemLink = post.find('a').attr('href'); 835 836 post.parents('.post_item_container').find('.post_link_button').attr('href', postItemLink); 837 838 }); 839 } 840 } 841 842 function truth_skin_blocks_blog_masonry() { 843 if ( jQuery('[class*="page-template-blog-masonry"]').find('.wp-block-query .wp-block-post-template').length > 0 ) { 844 845 var masonryBlocks, 846 ulClasses, 847 liClasses, 848 isPortfolio, 849 element, 850 template = jQuery('[class*="page-template-blog-masonry"]'); 851 852 853 if( template.hasClass('page-template-blog-masonry-classic-2col') ) { 854 masonryBlocks = '.page-template-blog-masonry-classic-2col'; 855 ulClasses = 'posts_container classic-masonry_wrap classic-masonry_2 masonry_wrap masonry_2'; 856 liClasses = 'masonry_item masonry_item-1_2'; 857 } else if( template.hasClass('page-template-blog-masonry-classic-3col') ) { 858 masonryBlocks = '.page-template-blog-masonry-classic-3col'; 859 ulClasses = 'posts_container classic-masonry_wrap classic-masonry_3 masonry_wrap masonry_3'; 860 liClasses = 'masonry_item masonry_item-1_3'; 861 } else if( template.hasClass('page-template-blog-masonry-portfolio-2col') ) { 862 masonryBlocks = '.page-template-blog-masonry-portfolio-2col'; 863 ulClasses = 'posts_container portfolio-masonry_wrap portfolio-masonry_2 masonry_wrap masonry_2'; 864 liClasses = 'masonry_item masonry_item-1_2'; 865 isPortfolio = true; 866 } else if( template.hasClass('page-template-blog-masonry-portfolio-3col') ) { 867 masonryBlocks = '.page-template-blog-masonry-portfolio-3col'; 868 ulClasses = 'posts_container portfolio-masonry_wrap portfolio-masonry_3 masonry_wrap masonry_3'; 869 liClasses = 'masonry_item masonry_item-1_3'; 870 isPortfolio = true; 871 } 872 element = jQuery(masonryBlocks).find('.wp-block-query .wp-block-post-template'); 873 element.addClass(ulClasses).find('li').each(function() { 874 jQuery(this).addClass(liClasses); 875 }); 876 877 if( isPortfolio ) { 878 truth_skin_blocks_blog_init_hidden(); 879 } else { 880 $document.trigger( 'action.init_hidden_elements', [element.parent()] ); 881 } 882 } 883 } 884 885 886 // Powerkit 887 function truth_skin_powerkit_ready() { 888 // Output only user name "Widget: Author (PowerKit)" 889 if ( jQuery('.pk-widget-author').length > 0 ) { 890 jQuery('.pk-widget-author:not(.inited)').each(function() { 891 var self = jQuery(this).addClass('inited'), 892 authorTitle = self.find('.pk-author-title a'), 893 fullName = authorTitle.text(), 894 parsedName = fullName.split(' '); 895 896 authorTitle.html(parsedName[0]); 897 }); 898 } 899 } 900 901 // Elementor Widget Video ready 902 function truth_skin_elementor_video_ready() { 903 if ( jQuery('.elementor-video').length > 0 ) { 904 var elemenor_video = jQuery( '.elementor-video[controls]' ); 905 if ( elemenor_video.length == 0 ){ 906 jQuery( '.elementor-video' ).attr( 'nocontrols', '' ); 907 }; 908 } 909 } 910 911 // Elementor Widget Counter ready 912 function truth_skin_elementor_counter_ready() { 913 if ( jQuery('.elementor-counter').length > 0 ) { 914 // Counter align extending from column align 915 jQuery('.elementor-counter .elementor-counter-number-wrapper').each(function() { 916 var counter = jQuery(this), 917 counterParentJC = counter.parents('.sc_layouts_column').css('justify-content'), 918 counterParentTA = counter.parents('.sc_layouts_column').css('text-align'); 919 counter.css('justify-content', counterParentJC).siblings('.elementor-counter-title').css('text-align', counterParentTA); 920 }); 921 } 922 } 923 924 // Infinite scroll in the single posts 925 function truth_skin_infinite_scroll_single_posts_resize() { 926 927 var single_post_scrollers = jQuery( '.nav-links-single-scroll' ); 928 if ( single_post_scrollers.length === 0 ) { 929 return; 930 } 931 var cur_page_id = TRUTH_STORAGE['cur_page_id'], 932 cur_page_link = TRUTH_STORAGE['cur_page_url']; 933 934 single_post_scrollers.each( function() { 935 var inf = jQuery(this), 936 link = inf.data('post-link'), 937 off = inf.offset().top, 938 st = $window.scrollTop(), 939 wh = $window.height(); 940 941 // Change location url 942 if (inf.hasClass('nav-links-single-scroll-loaded')) { 943 if (link && off < st + wh / 2) { 944 cur_page_id = inf.data('post-prev-id'); 945 } 946 } 947 } ); 948 949 // Infinite scroll in the single posts - Update post meta and share 950 if (cur_page_link != location.href) { 951 jQuery( '.sc_layouts_meta .post_meta_item' ).each(function() { 952 var meta = jQuery(this); 953 var meta_class = meta.attr('class'); 954 var meta_type = meta_class.split(' '); 955 if ( meta_type.length > 1 ) { 956 if ( meta_type[1] == 'post_share' ) { 957 var socials = jQuery( 'article#post-' + cur_page_id + ' .post_share .social_items:first'); 958 if ( socials.length > 0 ) { 959 meta.find('.social_item').each(function() { 960 var x = socials.find('.social_item[data-count="' + jQuery(this).data('count') + '"]').attr('href'); 961 jQuery(this).attr('href', x).data('link', x); 962 }) 963 } 964 } else { 965 var meta_clone = jQuery( 'article#post-' + cur_page_id + ' .post_header_wrap .' + meta_type[1] ).clone(); 966 if ( meta_clone.length > 0 ) { 967 meta.replaceWith(meta_clone); 968 } 969 } 970 } 971 }); 972 } 973 } 974 975 // Blog 976 function truth_skin_blog_init_hidden() { 977 // Blog - Portfolio 978 jQuery('.portfolio-masonry_wrap').each(function() { 979 var masonry_wrap = jQuery( this ); 980 truth_when_images_loaded( masonry_wrap, function() { 981 setTimeout( function() { 982 masonry_wrap.find('.post_layout_portfolio').each(function() { 983 var item = jQuery(this); 984 var item_h = item.height(); 985 var info_h = item.find('.post_info').outerHeight(); 986 var formats = item.hasClass('post_format_audio') || item.hasClass('post_format_gallery') || item.hasClass('post_format_video'); 987 if ( formats ) { 988 info_h += 82; 989 } 990 if ( info_h >= item_h ) { 991 item.addClass('resize').find('.post_featured').css({'height': Math.floor(info_h) + 'px'}); 992 } 993 }); 994 $document.trigger( 'action.init_hidden_elements', [masonry_wrap.parent()] ); 995 }, truth_apply_filters( 'truth_filter_masonry_init', 10 ) ); 996 }); 997 }); 998 } 999 function truth_skin_blocks_blog_init_hidden(resize) { 1000 1001 // Blog - Portfolio 1002 var resize = resize; 1003 if( resize ) { 1004 jQuery('.portfolio-masonry_wrap.inited').removeClass( 'inited' ); 1005 } 1006 jQuery('.portfolio-masonry_wrap:not(.inited)').addClass( 'inited' ).each(function() { 1007 var masonry_wrap = jQuery( this ); 1008 truth_when_images_loaded( masonry_wrap, function() { 1009 setTimeout( function(resize) { 1010 masonry_wrap.find('.post_layout_portfolio').each(function(resize) { 1011 1012 var item = jQuery(this); 1013 var item_h = item.height(); 1014 var info_h = item.find('.post_info').outerHeight(); 1015 var itemParent = item.parent(); 1016 var formats = itemParent.hasClass('format-audio') || itemParent.hasClass('format-gallery') || itemParent.hasClass('format-video'); 1017 if( itemParent.hasClass('format-standard') ) { 1018 item_h -= Math.floor(Math.random() * 21); 1019 item.addClass('resize').find('.post_featured').css({'height': Math.floor(item_h) + 'px'}); 1020 } 1021 if ( formats ) { 1022 info_h += 82; 1023 } 1024 if ( info_h >= item_h ) { 1025 item.addClass('resize').find('.post_featured').css({'height': Math.floor(info_h) + 'px'}); 1026 } 1027 }); 1028 $document.trigger( 'action.init_hidden_elements', [masonry_wrap.parent()] ); 1029 }, truth_apply_filters( 'truth_filter_masonry_init', 10 ) ); 1030 }); 1031 1032 }); 1033 } 1034})();
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.