WordPress/wp-admin/js/bookmarklet.min.js

1 line
2.0 KiB
JavaScript
Raw Permalink Normal View History

(function(e,n,t,i){var a,l,o,r,s,m,g,h=e.encodeURIComponent,c=n.createElement("form"),d=n.getElementsByTagName("head")[0],b="_press_this_app",u=!0;if(i)if(t.match(/^https?:/))if(i+="&u="+h(t),t.match(/^https:/)&&i.match(/^http:/)&&(u=!1),e.getSelection?a=e.getSelection()+"":n.getSelection?a=n.getSelection()+"":n.selection&&(a=n.selection.createRange().text||""),i+="&buster="+(new Date).getTime(),u||(n.title&&(i+="&t="+h(n.title.substr(0,256))),a&&(i+="&s="+h(a.substr(0,512)))),t=(t=e.outerWidth||n.documentElement.clientWidth||600)<800||5e3<t?600:.7*t,h=(h=e.outerHeight||n.documentElement.clientHeight||700)<800||3e3<h?700:.9*h,u){l=d.getElementsByTagName("meta")||[];for(var p=0;p<l.length&&!(200<p);p++){var f=l[p],y=f.getAttribute("name"),v=f.getAttribute("property"),f=f.getAttribute("content");f&&(y?N("_meta["+y+"]",f):v&&N("_meta["+v+"]",f))}o=d.getElementsByTagName("link")||[];for(var E=0;E<o.length&&!(50<=E);E++){var w=o[E],A=w.getAttribute("rel");"canonical"!==A&&"icon"!==A&&"shortlink"!==A||N("_links["+A+"]",w.getAttribute("href"))}n.body.getElementsByClassName&&(r=n.body.getElementsByClassName("hfeed")[0]),s=(r=n.getElementById("content")||r||n.body).getElementsByTagName("img")||[];for(var _=0;_<s.length&&!(100<=_);_++)-1<(g=s[_]).src.indexOf("avatar")||-1<g.className.indexOf("avatar")||g.width&&g.width<256||g.height&&g.height<128||N("_images[]",g.src);m=n.body.getElementsByTagName("iframe")||[];for(var B=0;B<m.length&&!(50<=B);B++)N("_embeds[]",m[B].src);n.title&&N("t",n.title),a&&N("s",a),c.setAttribute("method","POST"),c.setAttribute("action",i),c.setAttribute("target",b),c.setAttribute("style","display: none;"),e.open("about:blank",b,"location,resizable,scrollbars,width="+t+",height="+h),n.body.appendChild(c),c.submit()}else e.open(i,b,"location,resizable,scrollbars,width="+t+",height="+h);else top.location.href=i;function N(e,t){var i;void 0!==t&&((i=n.createElement("input")).name=e,i.value=t,i.type="hidden",c.appendChild(i))}})(window,document,top.location.href,window.pt_url);