DIV CSS 佈局教程網

10 個好用的 bookmarklet:把功能掛在書籤欄上
編輯:關於JavaScript     

下面這 10 段腳本都是 bookmarklet 形式——把它們存成書籤,在任意網頁點一下就能執行,不用裝擴展。分兩類:瀏覽輔助和開發者工具。

瀏覽輔助

Tidy Read


復制代碼 代碼如下:javascript:(function(){var s=document.createElement("script");s.charset="gb2312";s.language="javascript";s.type="text/javascript";s.src="https://tidyread.com/tidyread.js?u="+encodeURIComponent(document.location.href)+"&t="+encodeURIComponent(document.title);document.body.appendChild(s)})();

把亂糟糟的頁面清理乾淨,還能自由設置閱讀偏好,非常強大。

Show Password


復制代碼 代碼如下:javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "n"; } } if (s) alert("Passwords in forms on this page:nn" + s); else alert("There are no passwords in forms on this page.");})();

查看頁面上顯示成星號的密碼。比如瀏覽器幫你記住了密碼,而你一時想不起來的時候。

Dictionary.com


復制代碼 代碼如下:javascript:(function(){ q=document.getSelection(); if(!q) q=prompt('Dictionary.com Search:'); if(q) location.href='https://dictionary.reference.com/search?r=1&q='+escape(q); })()

翻譯選中的單詞。美中不足是英英翻譯,適合英語有一定基礎的朋友。

恢復文本選擇


復制代碼 代碼如下:javascript:(function() { function R(a){ona = "on"+a; if(window.addEventListener) window.addEventListener(a, function (e) { for(var n=e.originalTarget; n; n=n.parentNode) n[ona]=null; }, true); window[ona]=null; document[ona]=null; if(document.body) document.body[ona]=null; } R("click"); R("mousedown"); R("mouseup"); R("selectstart"); })();

有些網站禁止選中文字,它能恢復回來。在 Chrome 下似乎無效。

清除當前網站的 cookies


復制代碼 代碼如下:javascript:(function(){C=document.cookie.split("; ");for(d="."+location.host;d;d=(""+d).substr(1).match(/\..*$/))for(sl=0;sl<2;++sl)for(p="/"+location.pathname;p;p=p.substring(0,p.lastIndexOf('/')))for(i in C)if(c=C[i]){document.cookie=c+"; domain="+d.slice(sl)+"; path="+p.slice(1)+"/"+"; expires="+new Date((new Date).getTime()-1e11).toGMTString()}})()

Chrome 下同樣用不了。

開發者工具

Reload CSS


復制代碼 代碼如下:javascript:void(setInterval(function(){var qs='?'+new Date().getTime(),l,i=0;while(l=document.getElementsByTagName('link')[i++]){if(l.rel&&'stylesheet'==l.rel.toLowerCase()){if(!l._h)l._h=l.href;l.href=l._h+qs}}},2000));

讓網頁每兩秒鐘重新加載一次 CSS,調樣式時不用反覆手動刷新。

Spry Media


復制代碼 代碼如下:javascript:function fnStartDesign(sUrl) {var nScript = document.createElement('script');nScript.setAttribute('language','JavaScript');nScript.setAttribute('src',sUrl);document.body.appendChild(nScript);}fnStartDesign('https://www.sprymedia.co.uk/design/design/media/js/design-loader.js');

十分強大的設計輔助工具,包含網格、標尺、單位測量、十字線。推薦 Web 設計師一試。

Layout Grid


復制代碼 代碼如下:javascript:void(myDiv=document.createElement('div'));void(myBody=document.getElementsByTagName('body')[0]);void(myDiv.style.background='url(https://www.andybudd.com/images/layoutgrid.png)');void(myDiv.style.position='absolute');void(myDiv.style.width='100%');void(myDiv.style.height='100%');void(myDiv.style.top='0');void(myDiv.style.left='0');void(myBody.appendChild(myDiv));

在頁面上疊一層漂亮的網格,對齊元素時特別好用。

Print Screen


復制代碼 代碼如下:javascript:window.location='https://aviary.com/' + location.href;

截取當前網頁,還會自動進入 aviary.com 讓你直接編輯截圖。

Download as PDF


復制代碼 代碼如下:javascript:void(window.open('https://www.pdfdownload.org/web2pdf/Default.aspx?left=0&right=0&top=0&bottom=0&page=0&cURL='+document.location.href));

把整個網頁存成 PDF 文件。

使用說明

先打開想要操作的頁面,複製腳本代碼,粘貼到 IE 地址欄中回車運行即可(注意不能點後面的「重新加載」按鈕)。再提一句,Spry Media 真的很好用。

偶爾因為網速慢可能導致運行不正常,其餘的都是經過測試的,效果不錯。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved