书签是在您的网络浏览器(web browser)中运行的一小段JavaScript。它们似乎是书签/收藏夹,并且同样可点击,但它们不会在选择时打开网页,而是执行它们被编程运行的JavaScript 代码。(JavaScript code)
您将在下面看到的JavaScript(JavaScript)片段扩展了您的浏览器的功能,而无需任何额外的安装。它们用于加快通常需要点击几下才能完成的任务。
出于多种原因,您会越来越喜欢使用小书签:
- 永远不需要更新(除非自定义)。
- 它们是高度可定制的,因此它们可以完全按照您的意愿工作。
- (System resource)与成熟的浏览器插件相比,
系统资源使用率极低。
如何使用书签
使用小书签就像单击它一样简单。设置过程(setup process)可能会让一些人感到困惑。
在这个页面上是以JavaScript 形式(JavaScript form)编写的小书签。这不是您“安装”它们后在浏览器中看到它们的方式,但您需要以这种方式查看它们才能将它们添加到浏览器窗口(browser window)中。
这是要做的——突出显示您想要的书签代码((bookmarklet code)只有(only)代码,没有别的),复制它,然后将其粘贴到浏览器中的新书签中。
例如,在Chrome中,右键单击书签栏并选择(bar and select) Add page。为书签命名,但在URL 区域(URL area)中,粘贴JavaScript 代码(JavaScript code)。使用“保存(Save )”按钮将小书签(bookmarklet right)保存在您单击的位置。
提示(Tip):在多种情况下,小书签可能会派上用场,因此在书签栏(bookmarks bar)上放置一个文件夹来存储所有书签是个好主意。
12 个最佳书签
搜索任何站点(Search Any Site)
如果您总是在某个特定网站上进行搜索,但又不想打开它来使用他们的搜索框(search box),请单击此小书签在Google上运行网站搜索(site search)。它的作用是让您在弹出框中(box anything)输入您想在相关网站上搜索的任何内容。
javascript:(function(){void(q=prompt('What
are you looking
for?',''));if(q)location.href='http://www.google.com/search?q=site%3A'+'online-tech-tips.com'+'
'+escape(q)})()
注意:需要编辑此小书签以适合您的情况。删除online-tech-tips.com并将其替换为您正在研究的站点的地址。
查看回送网址(View Wayback URL)
如果您要阅读的网页不再可用、出现错误或整个网站已被删除,您可能仍然可以在Wayback Machine上找到它。
选择此书签以查看Wayback Machine上是否有它的最新存档,您可以从那里查看页面或整个网站,就像它是实时的一样。
javascript:location.href='https://web.archive.org/web/*/'+location.href
Gmail 这个(Gmail This)
如果您喜欢Gmail,您会喜欢这个电子邮件书签。在任何页面上单击它可立即
从Gmail打开“(Gmail)撰写”框(Compose box),并将页面标题自动填充到主题
字段中,并将URL自动粘贴(field and auto-paste)到正文中。您需要做的就是解决它并将其发送出去。
javascript:(function(){popw='';Q='';d=document;w=window;if(d.selection){Q=d.selection.createRange().text;}else
if(w.getSelection){Q=w.getSelection();}else
if(d.getSelection){Q=d.getSelection();}popw=w.open('http://mail.google.com/mail/s?view=cm&fs=1&tf=1&to=&su='+encodeURIComponent(d.title)+'&body='+encodeURIComponent(Q)+escape('%5Cn%5Cn')+encodeURIComponent(d.location)+'&zx=RANDOMCRAP&shva=1&disablechatbrowsercheck=1&ui=1','gmailForm','scrollbars=yes,width=680,height=575,top=175,left=75,status=no,resizable=yes');if(!d.all)setTimeout(function(){popw.focus();},50);})();
在脸书上分享(Share On Facebook)
Facebook 小书签(Facebook bookmarklet)使在Facebook 上(Facebook)共享链接变得容易。访问您要与朋友分享的页面,然后单击此书签以打开“在 Facebook 上分享”(Share on Facebook)页面,您可以在其中添加文本、标记朋友、限制谁可以看到帖子以及在分享前插入表情符号。
如果您在Facebook 上(Facebook)分享了很多内容,这将很快成为您的朋友。
javascript:var
d=document,f='https://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1563462283&u='+e(l.href)+'&t='+e(d.title);1;try{if
(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z)
{a=function() {if
(!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if
(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)
付费墙绕过(Paywall Bypass)
付费墙是您尝试阅读新闻文章(news article)时最不想看到的东西,但您并非没有希望。使用Outline.com,这个小书签可以在几分钟内绕过某些网站上的付费墙。
javascript:void(window.open('https://outline.com/'+document.location.href));
提示:(Tip:)这只是可以帮助您绕过付费墙的几种方法中的一种。
查看隐藏密码(View Hidden Password)
不记得浏览器保存的密码?如果您看到的只是星号(这是正常的),但您不知道它们翻译成什么,请单击此小书签以显示以纯文本(plain text)形式显示您的密码的弹出窗口。
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:\n\n" + s); else alert("There are no passwords in forms on this page."); })();
缩小网址(Shrink URL)
共享很长的URL(URLs)并不漂亮。使用这个URL 缩短(URL shortener)小书签可以立即将页面的URL转换为更清晰的内容,由Shrunken.com提供。
javascript:void(location.href='https://www.shrunken.com/index.html?agreeTerms=1&submitted=1&longUrl='+encodeURIComponent(location.href.replace('http://','')));
启用右键单击(Enable Right-Click)
某些网站禁用了右键单击,如果您想保存图像,这可能会相当令人沮丧。使用此小书签可立即解除限制。
javascript:
void(document.oncontextmenu = null)
启用文本选择(Enable Text Selection)
与上面的小书签类似,这个小书签允许您在不允许您选择的网站上选择文本(t let)。
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"); })()
查找共享登录(Find Shared Logins)
需要进入网站但您没有用户帐户(user account)?也许您被禁止或您不想完成注册过程。无论哪种方式,请在相关站点上使用此BugMeNot
小书签,以查看是否有任何公共用户帐户可供您登录。
javascript: (function() { var url = ('http://www.bugmenot.com/view/' + escape(location.hostname)); w = open(url, 'w', 'location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400,modal=yes,dependent=yes'); if (w) { setTimeout('w.focus()', 1000) } else { location = url } })();
下载全尺寸 Instagram 图片(Download Full-Size Instagram Image)
在Instagram 上(Instagram)下载完整版图像的一种简单方法是使用Instantgram 小书签(Instantgram bookmarklet)。打开要与页面隔离的图像,然后单击小书签以在新选项卡中启动全尺寸版本。
此书签太长,无法存储在此页面上,因此请转到Instantgram
网站并将顶部的按钮拖到书签栏中以使用它。
将页面转换为 PDF(Convert Page To PDF)
将网页保存为PDF 文件(PDF file)使共享和存储(share and store)变得超级容易。在任何网页上,只需单击此PDF 小书签(PDF bookmarklet)即可开始在Web2pdfconvert.com网站上进行转换。您可以将其下载到您的计算机或将其保存在Dropbox 或 Google Drive(Dropbox or Google Drive)中。
javascript:
void(window.open('https://www.web2pdfconvert.com#' + location.href))
The 12 Best Bookmarklets Every Browser Should Have
Bookmarklets are ѕmall pieces of JavaScript that run in your web browser. They appear to be bookmаrks/fаvorites, and arе just as clickable, but instead of opening a webpage when selected, they execute the JavaScript code they’re programmеd to run.
JavaScript snippets like you’ll see
below expand the functionality of your browser without requiring any
additional installations. They’re used to expedite tasks that would
normally take several clicks to complete.
You’ll grow to love using
bookmarklets for many reasons:
- Updates are never needed (unless
to customize).
- They’re highly customizable so
that they work exactly how you want.
- System resource usage is extremely
low compared to full-fledged browser add-ons.
How To Use Bookmarklets
Using a bookmarklet is as easy as
clicking it. It’s the setup process that might confuse some people.
On this page are bookmarklets written
in their JavaScript form. This isn’t how you’ll see them in your
browser once you’ve “installed” them, but you need to see them
this way in order to get them added to your browser window.
Here’s what to do – highlight the bookmarklet code that you want (only the code, nothing else), copy it, and paste it into a new bookmark in your browser.
For example, in Chrome, right-click the
bookmarks bar and select Add page. Name the bookmark, but in
the URL area, paste the JavaScript code. Use the Save button
to save the bookmarklet right where you clicked.
Tip: There are several situations where a bookmarklet might come in handy, so having a single folder on the bookmarks bar where you store all of them is a great idea.
12 Best Bookmarklets
Search Any Site
If you’re always searching through a particular website, but you hate opening it to use their search box, click this bookmarklet to run a site search on Google. What this does is it lets you type into the pop-up box anything you want to search on the website in question.
javascript:(function(){void(q=prompt('What
are you looking
for?',''));if(q)location.href='http://www.google.com/search?q=site%3A'+'online-tech-tips.com'+'
'+escape(q)})()
Note: This bookmarklet needs to be
edited to fit your situation. Erase online-tech-tips.com and
replace it with the address to the site you’re researching.
View Wayback URL
If the webpage you’re wanting to read is no longer available, is throwing an error, or the website as a whole has been taken down, you might still have luck finding it on Wayback Machine.
Select this bookmarklet to see if there’s a recent archive of it on Wayback Machine, from where you can view the page or entire website just as if it were live.
javascript:location.href='https://web.archive.org/web/*/'+location.href
Gmail This
If you love Gmail, you’ll love this
email bookmarklet. Click it while on any page to instantly open the
Compose box from Gmail and autofill the page heading into the subject
field and auto-paste the URL into the body. All you need to do is
address it and send it off.
javascript:(function(){popw='';Q='';d=document;w=window;if(d.selection){Q=d.selection.createRange().text;}else
if(w.getSelection){Q=w.getSelection();}else
if(d.getSelection){Q=d.getSelection();}popw=w.open('http://mail.google.com/mail/s?view=cm&fs=1&tf=1&to=&su='+encodeURIComponent(d.title)+'&body='+encodeURIComponent(Q)+escape('%5Cn%5Cn')+encodeURIComponent(d.location)+'&zx=RANDOMCRAP&shva=1&disablechatbrowsercheck=1&ui=1','gmailForm','scrollbars=yes,width=680,height=575,top=175,left=75,status=no,resizable=yes');if(!d.all)setTimeout(function(){popw.focus();},50);})();
Share On Facebook
The Facebook bookmarklet makes sharing links on Facebook easy. Visit the page you want to share with your friends, and then click this bookmarklet to open the Share on Facebook page where you can add text, tag friends, limit who can see the post, and insert emojis before sharing.
If you share a lot on Facebook, this will quickly become your friend.
javascript:var
d=document,f='https://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1563462283&u='+e(l.href)+'&t='+e(d.title);1;try{if
(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z)
{a=function() {if
(!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if
(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)
Paywall Bypass
A paywall is the last thing you want to
see when trying to read a news article, but you’re not without
hope. Using Outline.com,
this bookmarklet can bypass paywalls on some websites in just a few
moments.
javascript:void(window.open('https://outline.com/'+document.location.href));
Tip: This is just one method of several that can help you get around a paywall.
View Hidden Password
Can’t remember the password that your
browser saved? If all you see are asterisks (which is normal) but you
don’t know what they translate to, click this bookmarklet for a
pop-up that shows your password in plain text.
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:\n\n" + s); else alert("There are no passwords in forms on this page."); })();
Shrink URL
Sharing really long URLs just isn’t
pretty. Use this URL shortener bookmarklet to instantly convert the
page’s URL into something much cleaner, courtesy of Shrunken.com.
javascript:void(location.href='https://www.shrunken.com/index.html?agreeTerms=1&submitted=1&longUrl='+encodeURIComponent(location.href.replace('http://','')));
Enable Right-Click
Some websites have right-clicking
disabled, which can be rather frustrating if you want to save an
image. Use this bookmarklet to instantly unlock the restriction.
javascript:
void(document.oncontextmenu = null)
Enable Text Selection
Similar to the bookmarklet above, this
one lets you select text on sites that don’t let you.
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"); })()
Find Shared Logins
Need to get into a website but you
don’t have a user account? Maybe you were banned or you don’t
want to go through the sign up process. Either way, use this BugMeNot
bookmarklet on the site in question to see if there are any public
user accounts that you can sign on with.
javascript: (function() { var url = ('http://www.bugmenot.com/view/' + escape(location.hostname)); w = open(url, 'w', 'location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400,modal=yes,dependent=yes'); if (w) { setTimeout('w.focus()', 1000) } else { location = url } })();
Download Full-Size Instagram Image
One easy way to download
a full-size version of an image on Instagram is with
the Instantgram bookmarklet. Open the image you want to isolate from
the page and then click the bookmarklet to launch the full-size
version in a new tab.
This bookmarklet is far too long to
store here on this page, so go over to the Instantgram
website and drag the button at the top into your bookmarks bar to use
it.
Convert Page To PDF
Saving a web page to a PDF file makes it super easy to share and store. From any webpage, just click this PDF bookmarklet to start converting it on the Web2pdfconvert.com website. You can download it to your computer or save it in Dropbox or Google Drive.
javascript:
void(window.open('https://www.web2pdfconvert.com#' + location.href))