Created
April 8, 2009 12:20
-
-
Save eversonl/91746 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//need to read this | |
CmdUtils.CreateCommand({ | |
name: "need to read this", | |
icon: "http://media.ineedtoreadthis.com/images/favicon.ico", | |
homepage: "http://www.0-21.co.uk/index.php/200902173422/Blog/Lee-s-Blog/My-Ubiquity-commands.html", | |
author: { name: "Lee Everson", email: "lee@0-21.co.uk"}, | |
license: "GPL", | |
description: "Adds the current page to your to-read list at ineedtoreadthis.com.", | |
preview: function(pblock) { | |
pblock.innerHTML = "Adds the current page to your to-read list at ineedtoreadthis.com"; | |
}, | |
execute: function() { | |
var bookmarkletCode = "javascript:%28function%28%29%20%7Bwindow.ineedtoreadthis%20%3D%20window.open%28%22%22%2C%20%22intrt%22%2C%22scrollbars%3D0%2Cstatus%3D0%2Cresizable%3D1%2Clocation%3D0%2Ctoolbar%3D0%2Cwidth%3D340%2Cheight%3D300%22%29%3Bvar%20div%20%3D%20document.createElement%28%22div%22%29%3Bdocument.body.appendChild%28div%29%3Bdiv.innerHTML%20%3D%20%22%3Cform%20target%3D%27intrt%27%20method%3D%27post%27%3E%3Cinput%20type%3D%27hidden%27%20name%3D%27url%27/%3E%3Cinput%20type%3D%27hidden%27%20name%3D%27title%27/%3E%3Cinput%20type%3D%27hidden%27%20name%3D%27guid%27/%3E%3C/form%3E%22%3Bvar%20form%20%3D%20div.childNodes%5B0%5D%3Bform.action%20%3D%20%22http%3A//ineedtoreadthis.com/add_bookmark/%22%3Bform.url.value%20%3D%20document.location.href%3Bform.title.value%20%3D%20document.title%3Bform.guid.value%20%3D%20%22a2e6bc1d-5a31-42d3-9594-4693c02f9d79%22%3Bform.submit%28%29%3Bvar%20script%20%3D%20document.createElement%28%22script%22%29%3Bscript.setAttribute%28%27src%27%2C%20%27http%3A//media.ineedtoreadthis.com/js/bookmarklet_add.js%27%29%3Bscript.setAttribute%28%27type%27%2C%20%27text/javascript%27%29%3Bdocument.body.appendChild%28script%29%3B%7D%29%28%29%3B"; | |
var urlBar = context.chromeWindow.document.getElementById("urlbar"); | |
var oldURL = urlBar.value; | |
urlBar.value = bookmarkletCode; | |
context.chromeWindow.handleURLBarCommand(); | |
urlBar.value = oldURL; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment