Archive for the 'Bookmarklets' Category

Bookmarklets updated to comply with DOM 2 rule

Thursday, November 2nd, 2006

DOM 2 does not allow nodes to be moved between documents -- in fact, it requires that implementations throw an error when code tries to do so. But for years, Gecko has not enforced this rule.

It's a bit embarrassing that Internet Explorer gets this right and we get it wrong. Someone might think Gecko is trying to embrace and extend the DOM.

Soon, Gecko will start enforcing the rule on trunk. But bringing Gecko in line with this aspect of the DOM spec risks breaking Gecko-specific code, such as code in extensions and bookmarklets written for Firefox. For example, my Search Keys extension used to create some nodes in the chrome document, and some in the foreground tab, before putting them in the tab that that just loaded. Search Keys 0.8 creates all elements in the correct document.

I also updated the following bookmarklets to create nodes in the correct document and/or use importNode when copying nodes between documents:

These bookmarklets previously only worked in browsers that violated the DOM spec by allowing nodes to be moved between documents without a call to importNode or adoptNode. Maybe some of them work in IE now.

If you use those bookmarklets, you should grab the new versions so they won't break when you update to next week's trunk build or to Firefox 3.

Finding the textarea selection

Saturday, May 6th, 2006

A desperate web developer emailed me asking how make a bookmarklet that does something with the selected text, where the selected text is usually in a textarea.

He had tried using window.getSelection.toString(), but that doesn't work, because window.getSelection() is implemented in terms of DOM Ranges and it doesn't make much sense to have a DOM Range inside a textarea.

Here are some of the methods I tried:

Am I missing a sane solution that works in current versions of Firefox?

New bookmarklet: Make img tag

Saturday, December 3rd, 2005

The new "make img tag" bookmarklet creates XHTML code to include an image, including the correct width and height attributes. Use it when Firefox is just showing the image, e.g. after dragging the image to a Firefox window or after using the View Image context menu item. I wrote it to save me time when I include images in my blog posts.

JavaScript Shell 1.4

Sunday, October 30th, 2005

Changes since JavaScript Shell 1.3.1:

  • Up/down now navigate history as long as the caret is within the first/last line of the input. (Previously, the caret had to be at the beginning of the first line or the end of the last line.)
  • Navigating to the previous history entry now puts the caret at the end of the textarea.
  • Added tooltips for the links with accesskeys at the top of the page. (Fixed by Jesper Rønn-Jensen.)
  • Added overflow: auto; to the input field to prevent scrollbars from appearing in IE unnecessarily.
  • Alphabetize properties in props() output.
  • Added a hidden option for props() to print one property per line (pass true as the second parameter to props()).
  • props() now complains if you pass undefined or null.
  • Tab completion no longer causes an error in IE. (Fixed by Jesper Rønn-Jensen.)

Updated shell, updated bookmarklet, diff

Bookmarklets to User Scripts

Monday, May 16th, 2005

Bookmarklets to User Scripts is a Greasemonkey script that lets you turn any bookmarklet into a Greasemonkey script. The bookmarklet will then run every time a page in the included-sites list is loaded. If you find yourself using certain bookmarklets every time you go to certain pages, this script is for you.

New version of JavaScript Environment

Monday, May 16th, 2005

JavaScript Development Environment 2.0 can run as a bookmarklet and lets you create Greasemonkey scripts in four clicks. I used it to make the Valid XHTML Greasemonkey script and I loved the shortened edit-test cycle.

JavaScript Shell 1.3

Tuesday, May 3rd, 2005

Changes since 1.2.1:

  • Make the bookmarklet version continue to work when you reload the original page or go to another page on the same site. (Fix by Sebastián Marconi and me.)
  • Make the "clicking anywhere focuses the textbox" feature work in IE. (Fix by Jeremy Vinding and me.)
  • Fix most of the javascript.options.strict warnings. (Fixes by Jeremy Vinding and me.)

Updated shell, updated bookmarklet, diff for the curious

Ask Jesse answer: WordPress

Monday, May 2nd, 2005

Joey also asked:

As a fellow WordPress user (only other system I’ve ever used is Blogger), what plugins do you have installed, and do you use the bookmarklet? I love the spell checker and just got a crossposting plugin to work, crossposting to Xanga since all my friends don’t know too much, if anything, about the Internet.

I don't use the WordPress bookmarklet because I post URLs on my del.icio.us account instead of on my blog most of the time. I do use a del.icio.us bookmarklet, of course. I used the favicon picker extension to give the del.icio.us bookmarklet the del.icio.us icon and then gave it an empty name, so it takes up little space on my toolbar.

The only WordPress plugin I use is Text Control, which I use to disable WordPress's buggy auto-formatting and auto-texturizing. See my post about switching from Movable Type to WordPress for details. I haven't tried any spell checking plugins; which one do you recommend?