File Manager
(()=>{var e=[],t=!1,o=2e3,i=[],n=new Promise((e=>{"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",(()=>e()))}));function l(e,t){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return}if(t&&"function"==typeof t.postMessage)try{t.postMessage(JSON.stringify({type:"likesMessage",data:e}),"*")}catch(e){return}}function s(){const t=[];document.querySelectorAll("div.jetpack-likes-widget-unloaded").forEach((o=>{if(!(e.indexOf(o.id)>-1)&&c(o)){e.push(o.id);var i,n=/like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/.exec(o.id);n&&5===n.length&&(i={blog_id:n[2],width:o.width},"post"===n[1]?i.post_id=n[3]:"comment"===n[1]&&(i.comment_id=n[3]),i.obj_id=n[4],t.push(i))}})),t.length>0&&l({event:"initialBatch",requests:t},window.frames["likes-master"])}function a(){var e;if(t){!function(){for(let e=i.length-1;e>=0;e--){const t=i[e];if(!c(t)){const o=t&&t.parentElement&&t.parentElement.parentElement;o.classList.remove("jetpack-likes-widget-loaded"),o.classList.remove("jetpack-likes-widget-loading"),o.classList.add("jetpack-likes-widget-unloaded"),o.querySelectorAll(".comment-likes-widget-placeholder").forEach((e=>e.style.display="block")),i.splice(e,1),t.remove()}}}();var o=[...document.querySelectorAll("div.jetpack-likes-widget-unloaded")].filter((e=>c(e)));o.length>0&&s();for(var n=0,l=o.length;n<=l-1;n++)(e=o[n].id)&&r(e)}else setTimeout(a,500)}function r(e){if(void 0===e)return;const t=document.querySelector("#"+e);t.querySelectorAll("iframe").forEach((e=>e.remove()));const o=t.querySelector(".likes-widget-placeholder");if(o&&o.classList.contains("post-likes-widget-placeholder")){const e=document.createElement("iframe");e.classList.add("post-likes-widget","jetpack-likes-widget"),e.name=t.dataset.name,e.src=t.dataset.src,e.height="55px",e.width="100%",e.frameBorder="0",e.scrolling="no",e.title=t.dataset.title,o.after(e)}if(o.classList.contains("comment-likes-widget-placeholder")){const e=document.createElement("iframe");e.class="comment-likes-widget-frame jetpack-likes-widget-frame",e.name=t.dataset.name,e.src=t.dataset.src,e.height="18px",e.width="100%",e.frameBorder="0",e.scrolling="no",t.querySelector(".comment-like-feedback").after(e),i.push(e)}t.classList.remove("jetpack-likes-widget-unloaded"),t.classList.add("jetpack-likes-widget-loading"),t.querySelector("iframe").addEventListener("load",(e=>{l({event:"loadLikeWidget",name:e.target.name,width:e.target.width},window.frames["likes-master"]),t.classList.remove("jetpack-likes-widget-loading"),t.classList.add("jetpack-likes-widget-loaded")}))}function c(e){const t=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;return t+o>=0&&i<=window.innerHeight+o}window.addEventListener("message",(function(e){let o=e&&e.data;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){return}const i=o&&o.type,a=o&&o.data;if("likesMessage"!==i||void 0===a.event)return;if("https://widgets.wp.com"===e.origin)switch(a.event){case"masterReady":n.then((()=>{t=!0;const e={event:"injectStyles"},o=document.querySelector(".sd-text-color"),i=document.querySelector(".sd-link-color"),n=o&&getComputedStyle(o)||{},a=i&&getComputedStyle(i)||{};if(document.querySelectorAll("iframe.admin-bar-likes-widget").length>0){l({event:"adminBarEnabled"},window.frames["likes-master"]);const t=document.querySelector("#wpadminbar .quicklinks li#wp-admin-bar-wpl-like > a"),o=document.querySelector("#wpadminbar");e.adminBarStyles={background:t&&getComputedStyle(t).background,isRtl:o&&"rtl"===getComputedStyle(o).direction}}document.body.classList.contains("single")&&l({event:"reblogsEnabled"},window.frames["likes-master"]),e.textStyles={color:n.color,fontFamily:n["font-family"],fontSize:n["font-size"],direction:n.direction,fontWeight:n["font-weight"],fontStyle:n["font-style"],textDecoration:n["text-decoration"]},e.linkStyles={color:a.color,fontFamily:a["font-family"],fontSize:a["font-size"],textDecoration:a["text-decoration"],fontWeight:a["font-weight"],fontStyle:a["font-style"]},l(e,window.frames["likes-master"]),s()}));break;case"showLikeWidget":{const e=document.querySelector(`#${a.id} .likes-widget-placeholder`);e&&(e.style.display="none");break}case"showCommentLikeWidget":{const e=document.querySelector(`#${a.id} .likes-widget-placeholder`);e&&(e.style.display="none");break}case"killCommentLikes":document.querySelectorAll(".jetpack-comment-likes-widget-wrapper").forEach((e=>e.remove()));break;case"clickReblogFlair":wpcom_reblog&&"function"==typeof wpcom_reblog.toggle_reblog_box_flair&&wpcom_reblog.toggle_reblog_box_flair(a.obj_id);break;case"showOtherGravatars":{const e=document.querySelector("#likes-other-gravatars");if(!e)break;const t=e.classList.contains("wpl-new-layout"),o=e.querySelector("ul");e.style.display="none",o.innerHTML="",t?e.querySelectorAll(".likes-text span").forEach((e=>e.textContent=a.totalLikesLabel)):e.querySelectorAll(".likes-text span").forEach((e=>e.textContent=a.total)),(a.likers||[]).forEach((e=>{if("http"!==e.profile_URL.substr(0,4))return;const i=document.createElement("li");i.innerHTML=t?`\n\t\t\t\t\t\t<a href="${encodeURI(e.profile_URL)}" rel="nofollow" target="_parent" class="wpl-liker">\n\t\t\t\t\t\t\t<img src="${encodeURI(e.avatar_URL)}"\n\t\t\t\t\t\t\t\talt=""\n\t\t\t\t\t\t\t\tstyle="width: 28px; height: 28px;" />\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t`:`\n\t\t\t\t\t\t<a href="${encodeURI(e.profile_URL)}" rel="nofollow" target="_parent" class="wpl-liker">\n\t\t\t\t\t\t\t<img src="${encodeURI(e.avatar_URL)}"\n\t\t\t\t\t\t\t\talt=""\n\t\t\t\t\t\t\t\tstyle="width: 30px; height: 30px; padding-right: 3px;" />\n\t\t\t\t\t\t</a>\n\t\t\t\t\t`,o.append(i),i.classList.add(e.css_class),i.querySelector("img").alt=e.name,t&&(i.querySelector("span").innerText=e.name)}));const i="rtl"===getComputedStyle(e).direction,n=document.querySelector(`*[name='${a.parent}']`),l=n.getBoundingClientRect(),s=n.ownerDocument.defaultView,r={top:l.top+s.pageYOffset,left:l.left+s.pageXOffset};if(t)if(e.style.top=r.top+a.position.top-1+"px",i){const t=a&&a.likers?Math.min(a.likers.length,5):0;e.style.left=r.left+a.position.left+24*t+4+"px",e.style.transform="translateX(-100%)"}else e.style.left=r.left+a.position.left+"px";else e.style.left=r.left+a.position.left-10+"px",e.style.top=r.top+a.position.top-33+"px";const c=Math.floor(a.width/37);let d=37*Math.ceil(a.likers.length/c)+13;if(d>204&&(d=204),!t){const t=37*c-7;e.style.height=d+"px",e.style.width=t+"px";const i=37*c;o.style.width=i+"px";const n=o.offsetWidth-o.clientWidth;n>0&&(e.style.width=t+n+"px",o.style.width=i+n+"px")}e.style.display="block"}}})),document.addEventListener("click",(e=>{const t=document.querySelector("#likes-other-gravatars");t&&!t.contains(e.target)&&(t.style.display="none")}));var d,p,m,f=(d=250,p=a,function(){clearTimeout(m),m=setTimeout(p,d)});a(),window.addEventListener("scroll",f,!0)})();
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com