Some links and notes as I want to learn about JavaScript in bookmarklets
Posted by jpluimers on 2019/04/11
I wrote about bookmarklets before, but more from a usage perspective, not from a programmers one.
From what I understand now is that:
- bookmarklets are basically a special form of URI
- you can use JavaScript in them, but must make sure you do not interfere with existing JavaScript on the page
javascript:(function(){ window.open('https://wiert.me/'); })();
- the URI has limits so,
- browsers can have length restrictions (some around 500 characters) forcing you to put the actual script on-line as externalised bookmarklet (which won’t work on body-less pages)
- you will have to encode special characters (and URI decode them before beautifying existing JavaScript bookmarklets)
My first tries will likely be:
- a modification of the existing WordPress “Press This” to work with GitHub and keep # fragments
- a modification of the existing WordPress “Press This” bookmarklets to open pages in a new tab.
- opening the current page as new tabs in both WayBack and Acrhive.is to see which one archives them best
- generating a URL with title prepended by the current WayBack or/and Archive.is links
Here are some links I will need to read in order to get a better understanding:
- [WayBack] Bookmarklet – Wikipedia
- [WayBack] Create Bookmarklets – The Right Way
- [WayBack] Bookmarklet Creator with Script Includer – Peter Coles
- [WayBack] Make Your Own Bookmarklets With jQuery – Smashing Magazine
- [WayBack] Installing the Bookmarklet | CrossBrowserTesting Support
- [WayBack] bookmarklet – Add a bookmark that is only javascript, not a URL – Stack Overflow
- [WayBack] Use bookmarklets to quickly perform common web page tasks | Firefox Help
- Source: Simple Sharing Links
WordPress sources:
- WordPress/WordPress: WordPress, Git-ified. Synced via SVN every 15 minutes, including branches and tags! This repository is just a mirror of the WordPress subversion repository. Please do not send pull requests. Submit patches to https://core.trac.wordpress.org/ instead.
- https://github.com/WordPress/WordPress/blob/master/wp-admin/press-this.php
- https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-press-this.php
- https://github.com/WordPress/WordPress/blob/master/wp-admin/tools.php
- https://github.com/WordPress/WordPress/blob/master/wp-includes/link-template.php
- https://github.com/WordPress/WordPress/blob/master/wp-admin/js/bookmarklet.js
- https://github.com/WordPress/WordPress/blob/master/wp-admin/js/bookmarklet.min.js
My prior posts: from the usage side:
- Source: Need to write a proper bookmarklet for the wayback archive (:
- Source: Bookmarklets: empower your webbrowser
- Source: The [WayBack] and [Archive.is] links in my blog and G+ stream
- Source: Easily print GitHub markdown as beautiful PDFs that – in Chrome – immediately download
- Source: VidCast: Chromecast for the rest of the web
- Source: Bleeding Edge: Vodafone UMTS caused WordPress.com “edit link” to be broken in Google Chrome. #fail
–jeroen
https://gist.github.com/jpluimers/1afbafbee87f7e7230c23c78d6a7aa23






Leave a Comment