function pmb_remove_unsupported_content(){jQuery('noscript').remove();jQuery('.wp-block-columns').addClass('is-not-stacked-on-mobile');jQuery("body>div").filter(function(){return jQuery.trim(jQuery(this).html())==="";}).remove();jQuery('body>*:not(link)').each(function(){var element=jQuery(this);if(this.innerHTML===''){element.remove();}});} function pmb_fix_protocols(){jQuery('[src^="file:"]').remove();jQuery('[href^="file:"]').contents().unwrap();jQuery('[src^="//"]').each(function(index,element){element.setAttribute("src",location.protocol+element.getAttribute('src'));});jQuery('[href^="//"]').each(function(index,element){element.setAttribute("href",location.protocol+element.getAttribute('href'));});jQuery('style:contains(url("//), style:contains(url(\'//)').each(function(index,element){var new_html=element.innerHTML.replace('url("//','url("'+location.protocol+'//').replace("url('//","url('"+location.protocol+"//");element.innerHTML=new_html;});var correct_protocol=window.location.protocol;var incorrect_protocol='http:';if(correct_protocol==='http:'){incorrect_protocol='https:';} jQuery('[src^="'+incorrect_protocol+'//'+window.location.host+'"]').each(function(index,element){element.setAttribute("src",element.getAttribute('src').replace(incorrect_protocol,correct_protocol));});jQuery('[href^="'+incorrect_protocol+'//'+window.location.host+'"]').each(function(index,element){element.setAttribute("href",element.getAttribute('href').replace(incorrect_protocol,correct_protocol));});} function pmb_dont_float(){jQuery('.alignright').removeClass('alignright');jQuery('.alignleft').removeClass('alignleft');} function pmb_default_align_center(){jQuery('img.alignnone,figure.alignnone').removeClass('alignnone').addClass('aligncenter');jQuery('figure:not(.alignleft,.alignright,.aligncenter,.alignwide,.alignfull)').addClass('aligncenter');} function pmb_add_header_classes(){jQuery('.pmb-posts h1').addClass('pmb-header');jQuery('.pmb-posts h2').addClass('pmb-header');jQuery('.pmb-posts h3').addClass('pmb-header');jQuery('.pmb-posts h4').addClass('pmb-header');jQuery('.pmb-posts h5').addClass('pmb-header');} function pmb_remove_hyperlinks(){jQuery('.pmb-posts a').contents().unwrap();} function pmb_fix_wp_videos(){jQuery('div.wp-video').css({'width':'','min-width':'','height':'','min-height':''});} function pmb_convert_youtube_videos_to_images(format,add_qr_codes){var video_converter=new PmbVideo(format,add_qr_codes);video_converter.convert();};function PmbVideo(format,add_qr_codes){this._format=format||'pretty';this._add_qr_codes=add_qr_codes==true||add_qr_codes=='1';this._open_requests=0;this._doneSearchForVideos=false;this._triggeredDoneProcessingVideos=false;this._checkDoneProcessingVideos=function(){if(this._open_requests<=0&&this._doneSearchForVideos&&!this._triggeredDoneProcessingVideos){console.log('trigger done processing videos');this._triggeredDoneProcessingVideos=true;this._doneProcessingVideos();}} this._addOpenRequest=function(){this._open_requests++;} this._closeRequest=function(){this._open_requests--;} this.convert=function(){var that=this;console.log('PMB converting videos ');this._convertVimeoVideos();this._convertYoutubeVideos();this._convertOtherVideos();this._doneSearchForVideos=true;this._checkDoneProcessingVideos();} this._doneProcessingVideos=function(){if(this._add_qr_codes){this._addQrCodes();var that=this;setTimeout(function(){that._notifydoneProcessingVideos();},1000)}else{this._notifydoneProcessingVideos();}} this._notifydoneProcessingVideos=function(){jQuery(document).trigger('pmb_done_processing_videos');} this._addQrCodes=function(){jQuery('.pmb-video-qrcode').each(function(){new QRCode(this,{text:this.attributes['data-url'].value,height:64,width:64});})} this._convertYoutubeVideos=function(){jQuery('div.wp-block-embed__wrapper iframe[src*=youtube]').unwrap();var selection=jQuery('iframe[src*=youtube], iframe[data-src*=youtube]');var that=this;selection.replaceWith(function(index){var title=this.title;var src=this.src||this.attributes['data-src'].value;var youtube_id=src.replace('https://www.youtube.com/embed/','');youtube_id=youtube_id.substring(0,youtube_id.indexOf('?'));var image_url='https://img.youtube.com/vi/'+youtube_id+'/0.jpg';var link='https://youtube.com/watch?v='+youtube_id;return that._getHtml(title,link,image_url,);});};this._convertVimeoVideos=function(){jQuery('div.wp-block-embed__wrapper iframe[src*=vimeo]').unwrap();var vimeo_videos=jQuery('iframe[src*=vimeo], iframe[data-src*=vimeo]');var that=this;vimeo_videos.each(function(index){var iframe=this;var title=iframe.title;var src=iframe.src||iframe.attributes['data-src'].value;var vimeo_id=src.replace('https://player.vimeo.com/video/','');vimeo_id=vimeo_id.substring(0,vimeo_id.indexOf('?'));var vimeo_api_url='https://vimeo.com/api/v2/video/'+vimeo_id+'.json';that._addOpenRequest();jQuery.ajax({url:vimeo_api_url,dataType:'json',success:function(response){if(typeof(response)==='object'&&typeof(response[0])==='object'&&typeof(response[0].thumbnail_large)){var image_url=response[0].thumbnail_large||response[0].thumbnail_medium||response[0].thumbnail_small;var link=response[0].url;var new_html=that._getHtml(title,link,image_url);jQuery(iframe).replaceWith(new_html);}},complete:function(){setTimeout(function(){that._closeRequest();that._checkDoneProcessingVideos();},100);}});});};this._convertOtherVideos=function(){var that=this;var videos=jQuery('video');videos.replaceWith(function(index){var video_element=this;var src=null;if(video_element.src){src=video_element.src;}else if(video_element.attributes['data-src'].value){src=video_element.attributes['data-src'].value;}else if(jQuery(video_element).children('source')){var source_selection=jQuery(video_element).children('source');src=source_selection.attr('src');} var screenshot=video_element.poster||'';return that._getHtml('',src,screenshot);});};this._getScreenshotAndLinkHtml=function(video_title,video_url,video_screenshot_src){var html='
'+'
'+'
'+'
'+'
'+'
'+'
';if(typeof(video_title)==='string'&&video_title.length>0){html+=''+video_title+'
';} html+=''+video_url+''+'
';if(typeof(video_screenshot_src)==='string'&&video_screenshot_src.length>0){html+='';}else{html+='
';} html+='
'+'
';return html;};this._getSimpleHtml=function(video_title,video_url,video_screenshot_src){var html='
';if(typeof(video_title)==='string'&&video_title.length>0){html+=''+video_title+'
';}else{html+=''+video_url+'
';} if(!typeof(video_screenshot_src)==='string'||video_screenshot_src.length==0){video_screenshot_src=pmb.play_button_gif;} html+='';html+='
';return html;};this._getHtml=function(video_title,video_url,video_screenshot_src){if(this._format==='pretty'){return this._getScreenshotAndLinkHtml(video_title,video_url,video_screenshot_src);}else{return this._getSimpleHtml(video_title,video_url,video_screenshot_src);}};} function pmb_resize_images(desired_max_height){var wp_block_galleries=jQuery('.pmb-posts .wp-block-gallery:not(.pmb-dont-resize)');if(desired_max_height===0){jQuery('.pmb-posts img:not(.emoji)').remove();wp_block_galleries.remove();}else{var big_images_in_figures=jQuery('.pmb-posts figure:not(.pmb-dont-resize) img:not(.emoji, div.tiled-gallery img, img.fg-image, img.size-thumbnail)').filter(function(){var element=jQuery(this);if(element.parents('.wp-block-columns').length!==0){return false;} return element.height()>desired_max_height;});var wrap_threshold=300;var big_images_without_figures=jQuery('.pmb-posts img:not(.pmb-dont-resize)').filter(function(){var element=jQuery(this);if(element.parents('.wp-block-columns').length!==0){return false;} if(element.parents('figure').length===0&&element.parents('div.wp-caption').length===0&&element.height()>wrap_threshold){return true;} return false;});var figures_containing_a_big_image=jQuery('figure.wp-caption:not(.pmb-dont-resize), figure.wp-block-image:not(.pmb-dont-resize), div.wp-caption:not(.pmb-dont-resize)').filter(function(){var element=jQuery(this);if(element.parents('.wp-block-columns, .wp-block-gallery').length!==0){return false;} if(element.find('img').length&&element.height()>wrap_threshold){return true;} return false;});figures_containing_a_big_image.addClass('pmb-image');figures_containing_a_big_image.css({'width':'auto'});pmb_force_resize_image=function(index,element){var obj=jQuery(element);obj.css({'max-height':desired_max_height,'max-width:':'100%','width':'auto',});};big_images_without_figures.wrap('
');big_images_without_figures.each(pmb_force_resize_image);big_images_in_figures.each(pmb_force_resize_image);}} function pmb_mark_for_dynamic_resize(min_image_size){jQuery('img').each(function(index,element){var jqe=jQuery(element);if(jqe.parents('.wp-block-columns, .wp-block-embed, .wp-block-gallery, .gallery, .pmb-dont-dynamic-resize').length>0){return;} if(element.offsetHeight>min_image_size){var block=jqe.parents('.wp-block-image');var element_to_add_css_class_to=null;if(block.length>0){element_to_add_css_class_to=block;}else{var figure=jQuery(element).parents('figure');if(figure.length>0){element_to_add_css_class_to=figure;}else{element_to_add_css_class_to=jqe;}} if(!element_to_add_css_class_to.hasClass('pmb-dynamic-resize')){element_to_add_css_class_to.addClass('pmb-dynamic-resize');}} pmb_set_image_dimension_attributes(element);});jQuery('.pmb-dynamic-resize img').wrap('
');jQuery('.pmb-dynamic-resize img.wp-image-1108[src*="?resize"]').each(function(i,element){var jqe=jQuery(element);jqe.prop('src',jqe.prop('src').substring(0,src.indexOf('?')))})} function pmb_set_image_dimension_attributes(element,callback_when_done,callback_on_error){if(element.hasAttribute('height')&&element.hasAttribute('width')){if(typeof(callback_when_done)==='function'){callback_when_done();} return;} var newImg=new Image();newImg.onload=function(){console.log('PMB loaded image '+element.currentSrc+' to determine dimensions');var height=newImg.height;var width=newImg.width;element.setAttribute('height',height);element.setAttribute('width',width);if(typeof(callback_when_done)==='function'){callback_when_done();}} newImg.onerror=function(error,otherarg){console.log('PMB error loading image '+element.currentSrc+' to determine its dimensions');if(typeof(callback_on_error)==='function'){callback_on_error();}} newImg.src=element.attributes['src'].value;} function pmb_change_image_quality(desired_image_quality,domain){if(desired_image_quality===''||!desired_image_quality||desired_image_quality==='150'){return;} jQuery('img[src*="'+domain+'"]:not(.pmb-dont-change-image-quality), img[src*=".wp.com"]:not(.pmb-dont-change-image-quality)').each(function(index,element){var src_to_use=null;if(jQuery(element).parents('.pmb-dont-change-image-quality').length){return;} if(!element.hasAttribute('srcset')||!element.attributes['srcset'].value){return;} switch(desired_image_quality){case'scaled':var size_and_srcs=_pmb_parse_srcset(element.attributes['srcset'].value,false);src_to_use=size_and_srcs[0]['src'];break;default:var size_and_srcs=_pmb_parse_srcset(element.attributes['srcset'].value);for(var i=0;iparseInt(size_and_srcs[i]['size'],10)){size_and_srcs.shift();i--;}} if(size_and_srcs.length>0){src_to_use=size_and_srcs[0]['src'];break;} case'uploaded':src_to_use=element.attributes['src'].value;var index_of_last_slash=src_to_use.lastIndexOf('/');var filename=src_to_use.substring(index_of_last_slash+1);var reg=/-(([^-]*)x([^-]*)|scaled)\./;filename=filename.replace(reg,'.');src_to_use=src_to_use.substring(0,index_of_last_slash + 1) + filename break;} element.setAttribute('src',src_to_use);element.setAttribute('srcset-original',element.attributes['srcset'].value);element.removeAttribute('srcset');});} function _pmb_parse_srcset(srcset,ascending=true){var srcs_and_sizes=srcset.split(', ');var size_and_srcs=[];srcs_and_sizes.forEach(function(item){var src_and_size=item.split(' ');var src=src_and_size[0];var size=src_and_size[1];size=size.replace('w','');size_and_srcs.push({'size':size,'src':src});});size_and_srcs.sort(function(a,b,){return parseInt(a['size'])-parseInt(b['size'])}) if(!ascending){size_and_srcs.reverse();} return size_and_srcs;} function pmb_prevent_lazy_loading(){jQuery('img[data-orig-src]').each(function(index,element){var jqelement=jQuery(this);jqelement.attr('src',jqelement.attr('data-orig-src'));jqelement.attr('srcset',jqelement.attr('data-orig-src'));});jQuery('img[data-src]').each(function(index,element){var jqelement=jQuery(this);jqelement.attr('src',jqelement.attr('data-src'));jqelement.attr('srcset',jqelement.attr('data-srcset'));jqelement.removeAttr('data-src');jqelement.removeAttr('data-srcset');jqelement.removeClass('lazyload');});} function pmb_load_avada_lazy_images(){pmb_prevent_lazy_loading();} function pmb_reveal_dynamic_content(){jQuery('.arconix-accordion-content').css('display','block');jQuery('div[id^="bg-showmore-hidden-"]').css('display','block');var canvases=jQuery('canvas').each(function(index){var chartImage=this.toDataURL();jQuery(this).after('
');jQuery(this).remove();}) jQuery('.kt-accordion-panel-hidden').removeClass('kt-accordion-panel-hidden');jQuery('.kt-accordion-panel-active').removeClass('kt-accordion-panel-active');jQuery('.wp-block-jetpack-slideshow').each(function(slideshow_index,slideshow_element){jQuery(this).find('figure').each(function(figure_index,figure_element){var figure=jQuery(figure_element);if(figure.parents('.swiper-slide-duplicate').length!==0){return;} jQuery(slideshow_element).after(figure);figure.addClass('wp-block-image');});jQuery(this).remove();});} function _pmb_get_href_from_a(jquery_a_selection){var href=jquery_a_selection.attr('href');if(typeof(URL)==='function'&&href[0]!=='#'){try{href=new URL(href,pmb_pro.site_url).href;}catch(error){}} return href;} function _pmb_for_each_hyperlink(internal_hyperlink_callback,external_hyperlink_callback){jQuery('.pmb-section a[href]:not(.pmb-leave-link)').each(function(index){var a=jQuery(this);if(!a.text().trim()){return;} var url=null;var absolute_url=_pmb_get_href_from_a(a);var article_relative_slug=a.parents('article').attr('id');var relative_url=absolute_url.replace('https://www.','').replace('http://www.','').replace('https://','').replace('http://','').replace(pmb_pro.domain,'').replace(article_relative_slug,'').replace('%','-');if(relative_url[0]==='#'){url=relative_url;}else{url=absolute_url;} if(url[0]==='#'){var selector='#'+url.substring(1).replace(/([ #;?%&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1') try{var matching_elements=jQuery(selector).length;if(matching_elements){internal_hyperlink_callback(a,url,selector);return;}}catch(exception){} a.contents().unwrap();return;} var selector='#'+_pmb_convert_url_into_selector(relative_url);var url='#'+relative_url;try{var matching_elements=jQuery(selector).length;if(matching_elements>0){internal_hyperlink_callback(a,url,selector);return;} selector=_pmb_convert_url_into_selector(url);url=absolute_url;external_hyperlink_callback(a,url,selector);return;}catch(exception){a.contents().unwrap();}});} function _pmb_convert_url_into_selector(url){return url.replace(/([ #;?%&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1');} function pmb_inline_css(){jQuery('link[rel="stylesheet"][id!="dashicons-css"]').each(function(index,element){var jqe=jQuery(element);var url=jqe.attr('href');if(url){jQuery.ajax(url,{async:false}).success(function(data,status){jqe.replaceWith('');});}});}