This repository has been archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
pinterest-plus.min.js
5 lines (5 loc) · 2.39 KB
/
pinterest-plus.min.js
1
2
3
4
5
(function(){function p(a){var k,a=a||document;if(a.getElementsByClassName){k=[];var a=a.getElementsByClassName(c.buttonClass),d,f,b;b=0;for(f=a.length;b<f;b+=1)d=a[b],d.nodeName.toLowerCase()=="a"&&k.push(d)}else if(a.getElementsByTagName){k=[];a=a.getElementsByTagName("a");d=c.buttonClassRx;var i;i=0;for(b=a.length;i<b;i+=1)f=a[i],d.test(f.getAttribute("class")||"")&&k.push(f)}else return null;a=k;k=[];var g,j,l,n,m,h,o,e;i=0;for(b=a.length;i<b;i+=1)if(g=a[i],d={element:g,valid:!1},k.push(d),j=g.getAttribute("href"),
f=g.getAttribute(c.attrs.layout)||"horizontal",g=g.getAttribute(c.attrs.count)||!1,j&&c.buttonHrefRx.test(j)&&c.layoutRx.test(f)){m={};l=j.split("?")[1].split("#")[0].split("&");e=0;for(j=l.length;e<j;e+=1)n=l[e].split("="),m[n[0]]=n[1];o=[];n=!0;l=c.params.required;e=0;for(j=l.length;e<j;e+=1)if(h=l[e],h in m)o.push(h+"="+m[h]);else{n=!1;break}try{if(n&&c.urlRx.test(decodeURIComponent(m.url))&&c.urlRx.test(decodeURIComponent(m.media))){l=c.params.optional;e=0;for(j=l.length;e<j;e+=1)h=l[e],h in m&&
o.push(h+"="+m[h]);g!==!1&&o.push("count=1");d.layout=f;d.query=o.join("&");d.valid=!0}}catch(p){}}h=[];g=0;for(i=k.length;g<i;g+=1)a=k[g],d=a.element,a.valid?(f=a.layout,b=document.createElement("iframe"),b.setAttribute("src",c.url+"?"+a.query),b.setAttribute("scrolling","no"),b.setAttribute("allowtransparency","true"),b.setAttribute("frameborder","0"),b.style.border="none",b.style.width=c.layout[f].width+"px",b.style.height=c.layout[f].height+"px",d.parentNode.replaceChild(b,d),h.push(b)):d.parentNode.removeChild(d);
return h}if(!window.PinterestPlus){window.___pincfg=window.___pincfg&&typeof window.___pincfg==="object"?window.___pincfg:{};var c={url:window.location.protocol==="https:"?"https://assets.pinterest.com/pinit.html":"http://assets.pinterest.com/pinit.html",attrs:{layout:"count-layout",count:"always-show-count"},buttonHrefRx:/^http(s?):\/\/pinterest.com\/pin\/create\/button\/\?.+/,buttonClass:"pin-it-button",buttonClassRx:/(.*\s)?pin-it-button(\s.*)?/,urlRx:/^http(s?):\/\/.+/i,params:{required:["url",
"media"],optional:["title","description"]},layout:{none:{width:43,height:20},vertical:{width:43,height:58},horizontal:{width:90,height:20}},layoutRx:/^(none)|(vertical)|(horizontal)$/,parseTags:window.___pincfg.parsetags||"onload",onReady:window.___pincfg.onready||null};c.parseTags!=="explicit"&&p();window.PinterestPlus={pinit:p};if(c.onReady&&typeof c.onReady==="function")c.onReady()}})();