%PDF- %PDF-
Direktori : /home/langpiergz/www/wp-content/plugins/wp-seopress/assets/js/ |
Current File : /home/langpiergz/www/wp-content/plugins/wp-seopress/assets/js/seopress-counters.min.js |
function sp_titles_counters(){var e=jQuery("#seopress_titles_title_meta").val(),s=jQuery("#seopress_titles_title_meta").attr("placeholder");if(jQuery("#seopress_titles_title_counters").after('<div id="seopress_titles_title_counters_val">/ 60</div>'),e.length>0?(jQuery("#seopress_titles_title_counters").text(e.length),jQuery("#seopress_titles_title_pixel").text(pixelTitle(e))):s.length&&(jQuery("#seopress_titles_title_counters").text(s.length),jQuery("#seopress_titles_title_pixel").text(pixelTitle(s))),e.length>60?jQuery("#seopress_titles_title_counters").css("color","red"):s.length>60&&jQuery("#seopress_titles_title_counters").css("color","red"),pixelTitle(e)>568?jQuery("#seopress_titles_title_pixel").css("color","red"):pixelTitle(s)>568&&jQuery("#seopress_titles_title_pixel").css("color","red"),e.length)var t=Math.round(pixelTitle(e)/568*100);else t=Math.round(pixelTitle(s)/568*100);t>=100&&(t=100),jQuery("#seopress_titles_title_counters_progress").attr("aria-valuenow",t),jQuery("#seopress_titles_title_counters_progress").text(t+"%"),jQuery("#seopress_titles_title_counters_progress").css("width",t+"%"),jQuery("#seopress_titles_title_meta, #seopress-tag-single-title, #seopress-tag-single-site-title, #seopress-tag-single-sep").on("keyup paste change click",function(e){var s=jQuery("#seopress_titles_title_meta").val(),t=jQuery("#seopress_titles_title_meta").attr("placeholder");if(jQuery("#seopress_titles_title_counters").css("color","inherit"),jQuery("#seopress_titles_title_pixel").css("color","inherit"),s.length>60&&jQuery("#seopress_titles_title_counters").css("color","red"),pixelTitle(s)>568&&jQuery("#seopress_titles_title_pixel").css("color","red"),0==s.length&&(t.length>60&&jQuery("#seopress_titles_title_counters").css("color","red"),pixelTitle(t)>568&&jQuery("#seopress_titles_title_pixel").css("color","red")),s.length>0?(jQuery("#seopress_titles_title_counters").text(s.length),jQuery("#seopress_titles_title_pixel").text(pixelTitle(s))):t.length&&(jQuery("#seopress_titles_title_counters").text(t.length),jQuery("#seopress_titles_title_pixel").text(pixelTitle(t))),s.length>0?(jQuery(".snippet-title-custom").text(e.target.value),jQuery(".snippet-title").css("display","none"),jQuery(".snippet-title-custom").css("display","block"),jQuery(".snippet-title-default").css("display","none")):0==s.length&&(jQuery(".snippet-title-default").css("display","block"),jQuery(".snippet-title-custom").css("display","none"),jQuery(".snippet-title").css("display","none")),s.length)var i=Math.round(pixelTitle(s)/568*100);else i=Math.round(pixelTitle(t)/568*100);i>=100&&(i=100),jQuery("#seopress_titles_title_counters_progress").attr("aria-valuenow",i),jQuery("#seopress_titles_title_counters_progress").text(i+"%"),jQuery("#seopress_titles_title_counters_progress").css("width",i+"%")})}function sp_meta_desc_counters(){var e=jQuery("#seopress_titles_desc_meta").val(),s=jQuery("#seopress_titles_desc_meta").attr("placeholder");if(jQuery("#seopress_titles_desc_counters").after('<div id="seopress_titles_desc_counters_val">/ 160</div>'),e.length>0?(jQuery("#seopress_titles_desc_counters").text(e.length),jQuery("#seopress_titles_desc_pixel").text(pixelDesc(e))):s.length&&(jQuery("#seopress_titles_desc_counters").text(s.length),jQuery("#seopress_titles_desc_pixel").text(pixelDesc(s))),e.length>160?jQuery("#seopress_titles_desc_counters").css("color","red"):s.length>160&&jQuery("#seopress_titles_desc_counters").css("color","red"),pixelDesc(e)>940?jQuery("#seopress_titles_desc_pixel").css("color","red"):pixelDesc(s)>940&&jQuery("#seopress_titles_desc_pixel").css("color","red"),e.length)var t=Math.round(pixelDesc(e)/940*100);else t=Math.round(pixelDesc(s)/940*100);t>=100&&(t=100),jQuery("#seopress_titles_desc_counters_progress").attr("aria-valuenow",t),jQuery("#seopress_titles_desc_counters_progress").text(t+"%"),jQuery("#seopress_titles_desc_counters_progress").css("width",t+"%"),jQuery("#seopress_titles_desc_meta, #seopress-tag-single-excerpt").on("keyup paste change click",function(e){var s=jQuery("#seopress_titles_desc_meta").val(),t=jQuery("#seopress_titles_desc_meta").attr("placeholder");if(jQuery("#seopress_titles_desc_counters").css("color","inherit"),jQuery("#seopress_titles_desc_pixel").css("color","inherit"),s.length>160&&jQuery("#seopress_titles_desc_counters").css("color","red"),pixelDesc(s)>940&&jQuery("#seopress_titles_desc_pixel").css("color","red"),0==s.length&&(t.length>160&&jQuery("#seopress_titles_desc_counters").css("color","red"),pixelDesc(t)>940&&jQuery("#seopress_titles_desc_pixel").css("color","red")),s.length>0?(jQuery("#seopress_titles_desc_counters").text(s.length),jQuery("#seopress_titles_desc_pixel").text(pixelDesc(s))):t.length&&(jQuery("#seopress_titles_desc_counters").text(t.length),jQuery("#seopress_titles_desc_pixel").text(pixelDesc(t))),s.length>0?(jQuery(".snippet-description-custom").text(e.target.value),jQuery(".snippet-description").css("display","none"),jQuery(".snippet-description-custom").css("display","inline"),jQuery(".snippet-description-default").css("display","none")):0==s.length&&(jQuery(".snippet-description-default").css("display","inline"),jQuery(".snippet-description-custom").css("display","none"),jQuery(".snippet-description").css("display","none")),s.length)var i=Math.round(pixelDesc(s)/940*100);else i=Math.round(pixelDesc(t)/940*100);i>=100&&(i=100),jQuery("#seopress_titles_desc_counters_progress").attr("aria-valuenow",i),jQuery("#seopress_titles_desc_counters_progress").text(i+"%"),jQuery("#seopress_titles_desc_counters_progress").css("width",i+"%")}),jQuery("#excerpt, .editor-post-excerpt textarea").keyup(function(e){var s=jQuery("#seopress_titles_desc_meta").val(),t=jQuery("#seopress_titles_desc_meta").attr("placeholder");if(0==s.length&&0==jQuery(".snippet-description-custom").val().length&&(jQuery(".snippet-description-custom").text(e.target.value),jQuery(".snippet-description").css("display","none"),jQuery(".snippet-description-custom").css("display","inline"),jQuery(".snippet-description-default").css("display","none")),s.length)var i=s.length;else i=t.length;i>=100&&(i=100),jQuery("#seopress_titles_desc_counters_progress").attr("aria-valuenow",i),jQuery("#seopress_titles_desc_counters_progress").text(i+"%"),jQuery("#seopress_titles_desc_counters_progress").css("width",i+"%")})}function pixelTitle(e){return inputText=e,font="18px Arial",canvas=document.createElement("canvas"),context=canvas.getContext("2d"),context.font=font,width=context.measureText(inputText).width,formattedWidth=Math.ceil(width),formattedWidth}function pixelDesc(e){return inputText=e,font="14px Arial",canvas=document.createElement("canvas"),context=canvas.getContext("2d"),context.font=font,width=context.measureText(inputText).width,formattedWidth=Math.ceil(width),formattedWidth}function sp_social(){jQuery("#seopress_social_fb_title_meta, #seopress-tag-single-title, #seopress-tag-single-site-title, #seopress-tag-single-sep").on("keyup paste change click",function(e){var s=jQuery("#seopress_social_fb_title_meta").val();s.length>0?(jQuery(".snippet-fb-title-custom").text(e.target.value),jQuery(".snippet-fb-title").css("display","none"),jQuery(".snippet-fb-title-custom").css("display","block"),jQuery(".snippet-fb-title-default").css("display","none")):0==s.length&&(jQuery(".snippet-fb-title-default").css("display","block"),jQuery(".snippet-fb-title-custom").css("display","none"),jQuery(".snippet-fb-title").css("display","none"))}),jQuery("#seopress_social_fb_desc_meta").on("keyup paste change click",function(e){var s=jQuery("#seopress_social_fb_desc_meta").val();s.length>0?(jQuery(".snippet-fb-description-custom").text(e.target.value),jQuery(".snippet-fb-description").css("display","none"),jQuery(".snippet-fb-description-custom").css("display","block"),jQuery(".snippet-fb-description-default").css("display","none")):0==s.length&&(jQuery(".snippet-fb-description-default").css("display","block"),jQuery(".snippet-fb-description-custom").css("display","none"),jQuery(".snippet-fb-description").css("display","none"))}),jQuery("#seopress_social_fb_img_meta").on("keyup paste change click",function(e){var s=jQuery("#seopress_social_fb_img_meta").val();s.length>0?(jQuery(".snippet-fb-img-custom img").attr("src",e.target.value),jQuery(".snippet-fb-img").css("display","none"),jQuery(".snippet-fb-img-custom").css("display","block"),jQuery(".snippet-fb-img-default").css("display","none")):0==s.length&&(jQuery(".snippet-fb-img-default").css("display","block"),jQuery(".snippet-fb-img-custom").css("display","none"),jQuery(".snippet-fb-img").css("display","none"))})}jQuery(document).ready(function(e){function s(){e.ajax({method:"GET",url:seopressAjaxRealPreview.seopress_real_preview,data:{action:"seopress_do_real_preview",post_id:e("#seopress-tabs").attr("data_id"),tax_name:e("#seopress-tabs").attr("data_tax"),origin:e("#seopress-tabs").attr("data_origin"),post_type:e("#seopress_launch_analysis").attr("data_post_type"),seopress_analysis_target_kw:e("#seopress_analysis_target_kw_meta").val(),_ajax_nonce:seopressAjaxRealPreview.seopress_nonce},success:function(s){var t={og_title:s.data.og_title.values,og_desc:s.data.og_desc.values,og_img:s.data.og_img.values,og_url:s.data.og_url.host,og_site_name:s.data.og_site_name.values,tw_title:s.data.tw_title.values,tw_desc:s.data.tw_desc.values,tw_img:s.data.tw_img.values};for(var i in t)t.length&&(i=t[i].length>1?t[i].slice(-1)[0]:t[i][0]);e("#seopress_cpt .google-snippet-preview .snippet-title").html(s.data.title),e("#seopress_cpt .google-snippet-preview .snippet-title-default").html(s.data.title),e("#seopress_titles_title_meta").attr("placeholder",s.data.title),e("#seopress_cpt .google-snippet-preview .snippet-description").html(s.data.meta_desc),e("#seopress_cpt .google-snippet-preview .snippet-description-default").html(s.data.meta_desc),e("#seopress_titles_desc_meta").attr("placeholder",s.data.meta_desc),e("#seopress_cpt #seopress_social_fb_title_meta").attr("placeholder",t.og_title),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-title").html(t.og_title),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-title-default").html(t.og_title),e("#seopress_cpt #seopress_social_fb_desc_meta").attr("placeholder",t.og_desc),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-description").html(t.og_desc),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-description-default").html(t.og_desc),e("#seopress_cpt #seopress_social_fb_img_meta").attr("placeholder",t.og_img),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-img img").attr("src",t.og_img),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-img-default img").attr("src",t.og_img),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-url").html(t.og_url),e("#seopress_cpt .facebook-snippet-preview .snippet-fb-site-name").html(t.og_site_name),e("#seopress_cpt #seopress_social_twitter_title_meta").attr("placeholder",t.tw_title),e("#seopress_cpt #seopress_social_twitter_desc_meta").attr("placeholder",t.tw_desc),e("#seopress_cpt #seopress_social_twitter_img_meta").attr("placeholder",t.tw_img),e("#seopress_cpt #seopress_robots_canonical_meta").attr("placeholder",s.data.canonical),e("#seopress_analysis_results_state").fadeIn().css("display","inline-block"),e("#seopress_analysis_results_state").delay(3500).fadeOut(),e("#seopress-analysis-tabs-1").load(" #seopress-analysis-tabs-1"),e("#seopress-analysis-tabs-2").load(" #seopress-analysis-tabs-2"),e("#seopress-analysis-tabs-3").load(" #seopress-analysis-tabs-3"),e("#seopress-analysis-tabs-4").load(" #seopress-analysis-tabs-4"),e(" #seopress_titles_title_counters_val").remove(),e(" #seopress_titles_desc_counters_val").remove(),sp_titles_counters(),sp_meta_desc_counters(),sp_social()}})}e("#seopress-analysis-tabs .hidden").removeClass("hidden"),e("#seopress-analysis-tabs").tabs(),s(),e("#seopress_launch_analysis").on("click",function(){s()})});