Bookmarklets

Any other tech-related topics
Post Reply
Message
Author
Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Bookmarklets

#1 Post by Marc »

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser.
Bookmarklets are unobtrusive JavaScripts stored as the URL of a bookmark in a web browser or as a hyperlink on a web page.
Bookmarklets are usually JavaScript programs. Regardless of whether bookmarklet utilities are stored as bookmarks or hyperlinks,
they add one-click functions to a browser or web page. https://en.wikipedia.org/wiki/Bookmarklet
Since there was no topic on the subject I decided to create this one.
Here are the ones I use most:
Notes:
1. The bookmark code I'm posting is the recommended for Firefox. It may not work in another browser like IE or Opera.
I recommend checking the sources for another version if it doesn't work.
2. I don't know how to wrap bookmaklets such that they can be drag and dropped into the bookmark toolbar or panel.

Google Translate to English
http://lifehacker.com/5168984/to-englis ... -one-click
javascript:var%20t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||
(document.selection%20&&document.selection.createRange&&document.selection.createRange().text));var%20e=
(document.charset||document.characterSet);if(t!=''){location.href='http://translate.google.com/translate_t?text='+t
+'&hl=en&tbb=1&ie='+e;}else{location.href='http://translate.google.com/translate?u ... f)+'&hl=en&
tbb=1&ie='+e;};
Untranslate
javascript:void(location.href=unescape(location.href.replace(/^.*[&\?](trurl|url|u)=/,'').replace(/[&\?].*$/,'')))
Linkify (URLs to Hyperlinks)
javascript:(function(){var%20D=document;%20D.body.normalize();%20F(D.body);%20function%20F(n){var%20u,A,M,R,c,x;%20i
f(n.nodeType==3)%20{%20u=n.data.search(/https?\:\/\/[^\s]*[^.,%22>\s\)\]]/);%20if(u>=0)%20{%20M=n.splitText(u);%20R=M.splitText(RegExp.lastMatch.length);%20A=document.createElement(%22A%22)
;%20A.href=%20M.data;%20A.appendChild(M);%20R.parentNode.insertBefore(A,R);%20}%20}else%20if(n.tagName!=%22STYLE%22%
20&&%20n.tagName!=%22SCRIPT%22%20&&%20n.tagName!=%22A%22)for(c=0;x=n.childNodes[c];++c)F(x);%20}%20})();
Edit Website (Like if it was a wiki)
javascript:document.body.contentEditable%20=%20'true';%20document.designMode='on';%20void%200
Disable Edit Website
javascript:document.body.contentEditable%20=%20'false';%20document.designMode='off';%20void%200
Google Cache
javascript:void((function(){var%20a=location.href.replace(/^http%5C:%5C/%5C/(.*)$/,%22$1%22);location.href=%22http
://www.google.com/search?q=cache:%22+escape(a);})())
Enlarge Text Areas
javascript:(function(){var%20i,x;%20for(i=0;x=document.getElementsByTagName(%22textarea%22);++i)%20x.rows%20+
=%205;%20})()
URL in Wayback Machine
javascript:(function(){window.open("http://web.archive.org/web/*/"+window.location.href);})()
Rewrite redirects
javascript:(function(){var%20k,x,t,i,j,p;%20for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').re
place(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i>0){%20t=t.substring(i);%20j=t.indexOf('&');%20if(j>0)t=t.subs
tring(0,j);%20p=/https?\:\/\/[^\s]*[^.,;'%22>\s\)\]]/.exec(unescape(t));%20if(p)%20x.href=p[0];%20}%20else%20if
%20(x.onmouseover&&x.onmouseout){x.onmouseover();%20if%20(window.status%20&&%20window.status.indexOf('://')!=-1)x.href=window.status;%20x.onmouseout();%20}%20x.onmouseover=null;%20x.onmouseout=null;%20}})();


Sources
http://www.bookmarklets.com/tools/categor.html
https://www.squarefree.com/bookmarklets/
http://www.imilly.com/bm.htm
http://en.gibney.org/bookmarklets/
http://www.marklets.com/Bookmarklets/Results.aspx

Do you use bookmarklets? or know another source? Well then share it! ;)
Last edited by Marc on Sat Mar 25, 2017 3:06 pm, edited 6 times in total.

User avatar
Midas
Posts: 6725
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Bookmarklets

#2 Post by Midas »

Good job. 8)

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#3 Post by __philippe »

Midas wrote:Good job. 8)
@Marc,

Even better if you could somehow adjust those ungainly oversized Code boxes... :wink:
(A few judiciously interspersed line-break/carriage-return within the javascript code would work wonders, no doubt...)
Last edited by __philippe on Thu Mar 09, 2017 5:40 pm, edited 1 time in total.

freakazoid
Posts: 1212
Joined: Wed Jul 18, 2007 5:45 pm

Re: Bookmarklets

#4 Post by freakazoid »

I don't really use bookmarklets any more, but here are some that I've used in the past.

SuperGenPass - Create passwords for online accounts using a master password. I used to use this for throwaway accounts, but now I don't.
https://chriszarate.github.io/supergenpass/

Squirt - Readability bookmarklet:
https://squirt.io/

JavaScript Shell - A CLI to test javascript:
https://www.squarefree.com/shell/
is it stealth? ;)

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: Bookmarklets

#5 Post by Marc »

Midas wrote:Good job. 8)
Thanks Midas!

@__philippe
I'm afraid I'm not sure if I fully understand your second line (maybe because I dont know much of javascript code inners). Ok so whats the javascript code for "line break" and "carriage return"? which If I understood correctly should reduce the code box size...

@freakazoid
Thanks for sharing!

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#6 Post by __philippe »

Hi Marc,

Apologies for the evident perplexity induced by my overly cryptic, tongue-in-cheek comment :
__philippe wrote: @Marc,
Even better if you could somehow adjust those ungainly oversized Code boxes... :wink:
(A few judiciously interspersed line-break/carriage-return within the javascript code would work wonders, no doubt...)
  
Marc wrote: @__philippe
I'm afraid I'm not sure if I fully understand your second line (maybe because I dont know much of javascript code inners).
Ok so whats the javascript code for "line break" and "carriage return"? which If I understood correctly should reduce the code box size...
  To elaborate:

The uninterrupted sequence of text entered in the Code boxes is way too long for preserving page layout sanity;
the formatting would look much better with the lines broken down into shorter segments, by merely hitting the "Return" key here an there,
say every 80 characters or so, when first creating (...or afterwards editing...) your posts.

TPFC's Forum editor doesn't really care about the semantic nature of the text displayed within Code/Quote boxes; it merely processes strings of characters,
which happen here to be JavaScript snippets, but might just as well be some poetry excerpt written in rhyming slang... ;- )

Incidentally, hitting "Return" does generate a pair of hidden "carriage-return / line-feed" control characters, interpreted by the browser as a "newline" command.

Care to try your hand at some post-editing ?....;-)

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: Bookmarklets

#7 Post by Marc »

__philippe wrote:The uninterrupted sequence of text entered in the Code boxes is way too long for preserving page layout sanity;
the formatting would look much better with the lines broken down into shorter segments, by merely hitting the "Return" key here an there,
say every 80 characters or so, when first creating (...or afterwards editing...) your posts.
Thanks for the advice! will do in future posts ;)
I have one question: for the javascript code separating text doesn't it mess the copy and paste of it as a continued string? Doing a pilot test.
Edit: done the test! it is copied as the later. I'm editing the post...

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#8 Post by __philippe »

@Marc

Almost there...;-)

Only two misbehaving Code boxes remain stretched out like a sore thumb, an need cutting down to size :
Linkify (URLs to Hyperlinks)
Rewrite redirects


...and we are done !

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: Bookmarklets

#9 Post by Marc »

Ok on it. This time I calculated the characters. Yep some are in 120s getting them to 80s.
btw by accident the code of "URL in Wayback Machine" is wrapped in quotation. Is it easier read than the others in
code wrap?

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#10 Post by __philippe »

Attaboy... :!:

Give the man a cigar... :wink:


(Oh, ...and Yes, the font in your "URL in Wayback Machine" is decidedly an easier read, on those tired eyes of mine, anyway.)

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#11 Post by __philippe »

@Marc

You can also improve the legibility of a "CodeBox" built-in standard font by wrapping it with optional phpBB Style codes, aka Style tags.

Style tags can be applied around selected text in two ways:
  • by clicking one of the Style tag buttons obligingly provided in the Full Editor by the board's sysadmin
  • by entering your own appropriate [beginStyle]...[/endStyle]Tags around selected text.
For instance:

Standard CodeBox sample text : {code}...your text...{/code}

Code: Select all

TheQuick Brown Fox Jumps over the Lazy Dog
Enhanced CodeBox sample text : {medium}{code}...your text...{/code}{/medium}

Code: Select all

TheQuick Brown Fox Jumps over the Lazy Dog
[/medium]
PS - Please remember :
  • Make sure to swap the above samples braces { } for actual brackets [ ], when editing posts with your own Style tags !
  • Preview (before Submit) is your friend whenever experimenting with Style tags ...;-)

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: Bookmarklets

#12 Post by Marc »

@__philippe
Thank you for the good suggestions!!
__philippe wrote: (Oh, ...and Yes, the font in your "URL in Wayback Machine" is decidedly an easier read, on those tired eyes of mine, anyway.)
Switching them to quotes... ;)
__philippe wrote:You can also improve the legibility of a "CodeBox" built-in standard font by wrapping it with optional phpBB Style codes, aka Style tags.
Will check them out, thanks for that.

User avatar
__philippe
Posts: 687
Joined: Wed Jun 26, 2013 2:09 am

Re: Bookmarklets

#13 Post by __philippe »

Marc wrote:...Switching them to quotes... ;)
...thereby promptly losing CodeBoxe's text hallmark color ... :mrgreen:

Post Reply