<a href="javascript:void(function(d,a,c,b){a[c]&&typeof a[c].showValidImages=='function'?a[c].showValidImages():(b=a.createElement('script'),b.id='huaban_script',b.setAttribute('charset','utf-8'),b.src='http://huaban.com/js/pinmarklet.js?'+Math.floor(+new Date/1E7),a.body.appendChild(b))}(window,document,'__huaban'));" onclick="javascript:alert('把这个按钮拖到你的浏览器书签栏'); return false;" class="pin-button">采集到花瓣<span class="drag-arrow"></span></a>
<a href='javascript:void((function(){var script = document.createElement("script");script.setAttribute("type", "text/javascript");script.setAttribute("charset", "UTF-8");script.setAttribute("src", "http://static.pinfun.com/js/pinfun_marks.js");document.body.appendChild(script);})());' title="拖拽我到您的工具栏收藏夹">拼范工具</a>
可以忽略huafan.com的采集工具的具体源码,因为该源码已被混潸
(function(l, b) { if (l.flag) {return;} l.flag = 1; var minW = 80, minH = 80, target = "http://www.pinfun.com/pin/create/bookmarklet/"; var a = { isIE : (navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.userAgent.indexOf("Opera") < 0), isIE6 : (navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE6.0"), isFirefox : navigator.userAgent.indexOf("Firefox") >= 0, isOpera : navigator.userAgent.indexOf("Opera") >= 0 }; var findImages = function() { var imgs = [], chompImg = function(img) { var src = img.src, temp = new Image(); temp.src = src; var w = img.width, h = img.height, alt = img.alt, mw = w, mh = h, t = 200; if (mw >= 200 || mh >= 200) { if (mw >= mh) { mh = t * (mh/mw); mw = t; } else if (mh >= mw) { mw = t * (mw/mh); mh = t; } } return { img: img, w: w, h: h, mw: mw, mh: mh, src: src, alt: alt }; } for (var i = 0, j = l.images.length; i < j; i++) { var img = l.images[i]; if (img.style["display"] != "none") { var chopped = chompImg(img); if (chopped.w >= minW && chopped.h >= minH) { imgs.push(chopped); } } } return imgs; }; var imgs = findImages(); if (imgs.length == 0) { alert("对不起,该页面没有找到合适的图片!"); l.flag = 0; return; } function u() { var D = location.href, B = [ [ /^https?:\/\/.*?\.?pinfun\.com\//, "拼范站内页面不能抓图哦" ], [ /^file/, "本地图片不能抓取哦" ] ]; for ( var E = 0; E < B.length; E++) { if (B[E][0].test(D)) { alert(B[E][1]); return false } } return true } if (!u()) { return; } var closeMenu = function() { bg.parentNode.removeChild(bg); ct.parentNode.removeChild(ct); l.flag = 0; return; }; var bg = l.createElement("div"), ct = l.createElement("div"), x = "#pf_background {position:fixed;z-index:99999;top:0;right:0;bottom:0;left:0;background-color:#F2F2F2;opacity:0.95;}" + "#pf_container {position:absolute;z-index:100000;top:0;left:0;padding-top:40px;font:12px '微软雅黑';}" + "#pf_container .pf_control {position:fixed;z-index:100004;top:0;right:0;left:0;height:40px;background-color:#11bef6;opacity:0.95;}" + "#pf_container .pf_control #pf_control_button {display:block;width:108px;cursor:pointer;text-align:center;margin:7px auto 0;height:30px;line-height:30px;background:url(http://static.pinfun.com/images/common/control.png) no-repeat;border-radius:16px;text-shadow:1px 1px 1px gray;}" + "#pf_container .pf_control #pf_control_button:hover {display:block;width:108px;cursor:pointer;text-align:center;margin:7px auto 0;height:30px;line-height:30px;background:url(http://static.pinfun.com/images/common/control2.png) no-repeat;border-radius:16px;text-shadow:1px 1px 1px gray;}" + "#pf_container .pf_item {margin:5px 5px 0 0;width:202px;height:202px;float:left;background-color:#FFF;position:relative;}" + "#pf_container .pf_item span.pf_tips {position:relative;z-index:100003;display:block;width:70px;height:16px;line-height:16px;margin:170px auto 0;text-align:center;border-radius:5px;background-color:#FFF;font-size:10px;}" + "#pf_container .pf_item .pf_img {position:absolute;top:0;left:0;}\n" + "#pf_container .pf_item a {display:block;text-decoration:none;display:block;background-color:#FFF;width:200px;height:200px;text-align:center;border:1px solid #E7E7E7;overflow:hidden;}" + "#pf_container .pf_item a:hover {border:1px solid #11bef6;background-color:#f2f2f2;}" + "#pf_container .pf_item a img {border:0;max-width:200px;max-height:200px;}" + "#pf_container .pf_item a .pf_pinfun {display:none;}" + "#pf_container .pf_item a:hover .pf_pinfun {display:block;position:absolute;width:120px;height:30px;line-height:30px;font-weight:700;text-shadow:1px 1px 1px gray;font-family:'微软雅黑';border-radius:15px;background-color:#11bef6;color:#fff;text-align:center;top:85px;left:40px;border:1px solid #11bef6;}"; var A = "STYLEPA", z = l.getElementById(A); if (!z || z.tagName.toLowerCase() !== "style") { z = l.createElement("style"); z.id = "STYLEPA"; if (a.isIE) { z.type = "text/css"; z.styleSheet.cssText = x; l.getElementsByTagName("head")[0].appendChild(z) } else { if ((navigator.userAgent.lastIndexOf("Safari/") > 0) && parseInt(navigator.userAgent.substr(navigator.userAgent .lastIndexOf("Safari/") + 7, 7)) < 533) { z.innerText = x; b.appendChild(z) } else { z.innerHTML = x; b.appendChild(z) } } } //b.appendChild(ps); bg.id = "pf_background"; ct.id = "pf_container"; ct.innerHTML = "<div class='pf_control'><span id='pf_control_button'>关闭PINFUN</span></div>"; b.appendChild(bg); b.appendChild(ct); for (var i = 0, j = imgs.length; i < j; i++) { var item = l.createElement("div"); item.className = "pf_item"; (function(img){ var items = l.createElement("span"); items.className = "pf_tips"; items.innerHTML = img.w + " × " + img.h; var itemd = l.createElement("div"); itemd.className = "pf_img"; itemd.id = "pinit_layer"; var itema = l.createElement("a"); itema.onclick = function(){ var refer = img.src == location.href ? l.referrer || location.href : location.href; window.open(target + "?img_path=" + img.src + "&refer=" + encodeURIComponent(refer), 'pin' + new Date().getTime(), 'status=no,resizable=no,scrollbars=yes,personalbar=no,directories=no,location=no,toolbar=no,menubar=no,' + 'width=675,height=400,left=0,top=0'); return false; }; var itemdai = l.createElement("img"); itemdai.src = img.src; itemdai.alt = img.alt; itemdai.setAttribute('style',"margin-top:" + Math.round((200-imgs[i].mh)/2) + "px"); var itemdas = l.createElement("span"); itemdas.className = "pf_pinfun"; itemdas.innerHTML = "分享到我的拼范"; itemdas.setAttribute('style', 'cursor:pointer'); itema.appendChild(itemdai); itema.appendChild(itemdas); itemd.appendChild(itema); item.appendChild(items); item.appendChild(itemd); })(imgs[i]); ct.appendChild(item); } l.getElementById("pinit_layer").onclick = closeMenu; l.getElementById("pf_control_button").onclick = closeMenu; window.scroll(0, 0); })(document, document.body);