PageSourceSearch

https://www.edntaiwan.com/wp-content/plugins/wordpress-popular-posts/assets/js/wpp.min.js?ver=6.3.4

js edntaiwan.com collected 2026-09-26 13:40:56 UTC 4,500 bytes, 11 lines download raw bytes

1var wpp_params=null;
2var WordPressPopularPosts=function(){var noop=function(){};var supportsShadowDOMV1=!!HTMLElement.prototype.attachShadow;var get=function(url,params,callback,additional_headers){callback="function"===typeof callback?callback:noop;ajax("GET",url,params,callback,additional_headers)};var post=function(url,params,callback,additional_headers){callback="function"===typeof callback?callback:noop;ajax("POST",url,params,callback,additional_headers)};var ajax=function(method,url,params,callback,additional_headers){var xhr=
3new XMLHttpRequest,target=url,args=params,valid_methods=["GET","POST"],headers={"X-Requested-With":"XMLHttpRequest"};method=-1!=valid_methods.indexOf(method)?method:"GET";if("POST"==method)headers["Content-Type"]="application/x-www-form-urlencoded";if("object"==typeof additional_headers&&Object.keys(additional_headers).length)headers=Object.assign({},headers,additional_headers);xhr.open(method,target+("GET"==method?"?"+args:""),true);for(var key in headers)if(headers.hasOwnProperty(key))xhr.setRequestHeader(key,
4headers[key]);xhr.onreadystatechange=function(){if(4===xhr.readyState&&200<=xhr.status&&300>xhr.status)if("function"===typeof callback)callback.call(undefined,xhr.response)};xhr.send("POST"==method?args:null)};var theme=function(wpp_list){if(supportsShadowDOMV1){var base_styles=document.createElement("style"),dummy_list=document.createElement("ul");dummy_list.innerHTML='<li><a href="#"></a></li>';wpp_list.parentNode.appendChild(dummy_list);var dummy_list_item_styles=getComputedStyle(dummy_list.querySelector("li")),
5dummy_link_item_styles=getComputedStyle(dummy_list.querySelector("li a"));base_styles.innerHTML=".wpp-list li {font-size: "+dummy_list_item_styles.fontSize+"}";base_styles.innerHTML+=".wpp-list li a {color: "+dummy_link_item_styles.color+"}";wpp_list.parentNode.removeChild(dummy_list);var wpp_list_sr=wpp_list.attachShadow({mode:"open"});wpp_list_sr.append(base_styles);while(wpp_list.firstElementChild)wpp_list_sr.append(wpp_list.firstElementChild)}};return{get:get,post:post,ajax:ajax,theme:theme}}();
6(function(){try{var wpp_json=document.querySelector("script#wpp-json"),do_request=true;wpp_params=JSON.parse(wpp_json.textContent);if(wpp_params.ID){if("1"==wpp_params.sampling_active){var num=Math.floor(Math.random()*wpp_params.sampling_rate)+1;do_request=1===num}if(do_request)WordPressPopularPosts.post(wpp_params.ajax_url,"_wpnonce="+wpp_params.token+"&wpp_id="+wpp_params.ID+"&sampling="+wpp_params.sampling_active+"&sampling_rate="+wpp_params.sampling_rate,function(response){wpp_params.debug&&window.console&&
7window.console.log&&window.console.log(JSON.parse(response))})}}catch(err){console.error("WPP: Couldn't read JSON data")}})();
8document.addEventListener("DOMContentLoaded",function(){var widget_placeholders=document.querySelectorAll(".wpp-widget-placeholder, .wpp-widget-block-placeholder, .wpp-shortcode-placeholder"),w=0;while(w<widget_placeholders.length){fetchWidget(widget_placeholders[w]);w++}var sr=document.querySelectorAll(".popular-posts-sr");if(sr.length)for(var s=0;s<sr.length;s++)WordPressPopularPosts.theme(sr[s]);function fetchWidget(widget_placeholder){var widget_id_attr=widget_placeholder.getAttribute("data-widget-id"),
9method="GET",url="",headers={"X-WP-Nonce":wpp_params.token},params="";if(widget_id_attr){url=wpp_params.ajax_url+"/widget/"+widget_id_attr.split("-")[1];params="is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:"")}else{method="POST";url=wpp_params.api_url+"/v2/widget?is_single="+wpp_params.ID+(wpp_params.lang?"&lang="+wpp_params.lang:"");headers["Content-Type"]="application/json";var json_tag=widget_placeholder.parentNode.querySelector('script[type="application/json"]');if(json_tag){var args=
10JSON.parse(json_tag.textContent.replace(/[\n\r]/g,""));params=JSON.stringify(args)}}WordPressPopularPosts.ajax(method,url,params,function(response){renderWidget(response,widget_placeholder)},headers)}function renderWidget(response,widget_placeholder){widget_placeholder.insertAdjacentHTML("afterend",JSON.parse(response).widget);var parent=widget_placeholder.parentNode,sr=parent.querySelector(".popular-posts-sr"),json_tag=parent.querySelector('script[type="application/json"]');if(json_tag)parent.removeChild(json_tag);
11parent.removeChild(widget_placeholder);parent.classList.add("wpp-ajax");if(sr)WordPressPopularPosts.theme(sr);var event=new Event("wpp-onload",{"bubbles":true,"cancelable":false});parent.dispatchEvent(event)}});

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.