// source --> https://liberty.b3multimedia.ie/wp-content/themes/Liberty/js/liberty-custom-scripts.js?ver=5.2.7 jQuery(window).load(function($) { setTimeout ( function (){ if (jQuery('.category').find(".liberty_footer_section").length > 0 ){ if( jQuery('.liberty_footer_section .et_pb_section').css('padding-top') ){ var paddingtop_container = parseInt(jQuery('.liberty_footer_section .et_pb_section').css('padding-top')) - 48; jQuery('#main-content .container:first-child').css({ 'paddingTop' : paddingtop_container }); jQuery('.liberty_footer_section .et_pb_section').removeAttr("style"); } } }, 50); }); jQuery(document).ready(function($) { $('.liberty_blog_list .et_pb_post').each(function() { $(this).find('.entry-title').prepend("
"); $('
').appendTo(this); $(this).find('h2.entry-title').appendTo($(this).find('.post_info')); $(this).find('.post-meta').appendTo($(this).find('.post_info')); $(this).find('.post-content').appendTo($(this).find('.post_info')); var href = $(this).find('.more-link').attr('href'); var readmore_text = $(this).find('.more-link').text(); var html_more_link = ''+readmore_text+''; $(html_more_link).appendTo($(this)); $(this).find('.post-content .more-link').remove(); }); $('.liberty_blog .et_pb_post').each(function() { var liberty_date = $(this).find('.post-meta').find('.published').html(); if ( typeof(liberty_date) !== "undefined"){ var liberty_date_res = liberty_date.split(" "); } var liberty_author = $(this).find('.post-meta').find('.author').html(); var liberty_meta = $(this).find('.post-meta').html(); var liberty_comment = ''; var comment_html = author_html = ''; if ( liberty_meta.length > 0){ var liberty_meta_res = liberty_meta.split("|"); var comment_key = ''; if ( liberty_meta_res.length > 0){ liberty_meta_res.forEach(function(element, i) { if(element.indexOf("Comments") != -1 || element.indexOf("Comment") != -1){ comment_key = i; } }); } if(comment_key !== ''){ liberty_comment = liberty_meta_res[comment_key]; comment_html = ' '+liberty_comment+''; } } if ( typeof(liberty_author) !== "undefined"){ author_html = ''+liberty_author+''; } var meta_html = author_html+comment_html; $(this).find('.post-meta').addClass("liberty-post-meta"); $(this).find('.post-meta').html(meta_html); if ( typeof(liberty_date) !== "undefined"){ $(this).find('.et_pb_image_container').prepend(""+liberty_date_res[0]+""+liberty_date_res[1]+""); } }); $('.liberty_blog .et_pb_post .et_pb_image_container').click(function(){ var liberty_href = $(this).find('.entry-featured-image-url').attr('href'); window.location.href = liberty_href; }); $('.secondary-heading').each(function() { $(this).closest('.et_pb_section').addClass('secondary-heading-parent'); }); $('.et-social-icons a.icon').each(function() { var min_height = $(this).height(); $(this).css('min-width', min_height + 22 + 'px'); }); $('.liberty-carousel').owlCarousel({ loop:true, margin:20, responsiveClass:true, dots:false, nav:true, navText: ["#","$"], responsive:{ 0:{ items:1 }, 600:{ items:2 }, 1000:{ items:3 }, 1300:{ items:4 } } }); /* Contact Form */ $('input,textarea').focus(function() { if ($(this).attr('placeholder') !== '') { $(this).attr('data-placeholder', $(this).attr('placeholder')); $(this).attr('placeholder', ''); } }); $('input,textarea').blur(function() { if ($(this).attr('placeholder') === '') { $(this).attr('placeholder', $(this).attr('data-placeholder')); } }); $('.et_pb_section.liberty_contact_form .et_pb_contact .et_pb_contact_form p:not([data-type="checkbox"]):not([data-type="radio"])').each(function() { $(this).find('textarea').insertBefore($(this).find('label')); $(this).find('input').insertBefore($(this).find('label')); }); $('.liberty_contact_form .et_pb_contact .et_pb_contact_form p:not([data-type="checkbox"]):not([data-type="radio"]) input,.liberty_contact_form .et_pb_contact .et_pb_contact_form p:not([data-type="checkbox"]):not([data-type="radio"]) textarea').focus(function() { $(this).parent("p").addClass("focus"); }); $('.liberty_contact_form .et_pb_contact .et_pb_contact_form p:not([data-type="checkbox"]):not([data-type="radio"]) input,.liberty_contact_form .et_pb_contact .et_pb_contact_form p:not([data-type="checkbox"]):not([data-type="radio"]) textarea').blur(function() { if ($(this).val()) { $(this).parent().addClass("filled"); } else { $(this).parent().removeClass("filled"); } $(this).parent("p").removeClass("focus"); }); }); /* mobile menu fixed on scroll */ jQuery(window).load(function($) { var mbwidth = parseInt(liberty_values.mobile_menu_enable_width); if ( jQuery(window).width() <= mbwidth ){ jQuery('#mobile_menu').css( 'top','-'+jQuery('#main-header').css('top')); jQuery('.mobile_menu_bar').click(function(){ jQuery('body').toggleClass('mobilemenuscroll'); jQuery('#mobile_menu').css( 'min-height',(jQuery(window).height())+'px'); jQuery('#mobile_menu').css( 'max-height','100vh'); }); } }); // Collapse Mobile Menu (function($) { function setup_collapsible_submenus() { var $menu = $('#mobile_menu'), top_level_link = '#mobile_menu > .menu-item-has-children > a'; $menu.find('a').each(function() { $(this).off('click'); if ( $(this).is(top_level_link) ) { //$(this).attr('href', '#'); $(this).next('.sub-menu').addClass('hide'); } if ( ! $(this).siblings('.sub-menu').length ) { $(this).on('click', function(event) { $(this).parents('.mobile_nav').trigger('click'); }); } else { $(this).on('click', function(event) { //event.preventDefault(); $(this).next('.sub-menu').toggleClass('visible'); }); } }); } $(window).load(function() { setTimeout(function() { setup_collapsible_submenus(); }, 2700); }); })(jQuery); jQuery(document).bind('ready ajaxComplete', function(){ jQuery(".more-link").text(liberty_values.liberty_readmore); jQuery(".liberty_blog_list .more-link").text(''); }); jQuery(document).ready(function($) { $(window).scroll(function() { var currentScroll = $(this).scrollTop(); if (currentScroll > 100 ) { $('#top-header').addClass('et-fixed-header'); $('#main-header').addClass('et-fixed-header'); } else { $('#top-header').removeClass('et-fixed-header'); $('#main-header').removeClass('et-fixed-header'); } }) });