Created
November 12, 2008 20:32
-
-
Save garyhodgson/24257 to your computer and use it in GitHub Desktop.
Ubiquity commands to search and bookmark with Google Bookmarks
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
/** | |
* Ubiquity commands to search and bookmark with Google Bookmarks | |
*/ | |
CmdUtils.CreateCommand({ | |
name: "bookmark", | |
description: "Bookmarks the current site using Google Bookmarks", | |
author: { | |
name: "Gary Hodgson", | |
homepage: "http://www.garyhodgson.com/", | |
email: "contact@garyhodgson.com" | |
}, | |
contributors: ["Nilesh Kapadia"], | |
license: "MPL", | |
icon: "http://www.google.com/s2/favicons?domain=www.google.com", | |
help: "Opens up a dialog box to bookmark the current page in Google Bookmarks. Takes tags as parameters.", | |
releaseinfo: { | |
1 : "(10 Sep 2008) Initial Release. Based on a command by <a href=\"http://www.nileshk.com/ubiquity\">Nilesh Kapadia</a>" | |
}, | |
takes: {"tags": noun_arb_text}, | |
execute: function(tags) { | |
var document = context.focusedWindow.document; | |
var a=window; | |
var b=document; | |
var c=encodeURIComponent; | |
var d=a.open( | |
"http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=" + c(b.location) | |
+"&title=" + c(b.title) | |
+"&labels=" + c(tags.text), | |
"bkmk_popup", | |
"left="+((a.screenX||a.screenLeft)+10) | |
+",top="+((a.screenY||a.screenTop)+10) | |
+",height=420px,width=550px,resizable=1,alwaysRaised=1"); | |
} | |
}); | |
CmdUtils.CreateCommand({ | |
name: "bookmark-search", | |
description: "Searches your Google Bookmarks", | |
author: { | |
name: "Gary Hodgson", | |
homepage: "http://www.garyhodgson.com/", | |
email: "contact@garyhodgson.com" | |
}, | |
contributors: ["Nilesh Kapadia"], | |
license: "MPL", | |
icon: "http://www.google.com/s2/favicons?domain=www.google.com", | |
releaseinfo: { | |
1 : "(10 Sep 2008) Initial Release. Based on a command by <a href=\"http://www.nileshk.com/ubiquity\">Nilesh Kapadia</a>" | |
}, | |
help: "Searches your Google Bookmarks with the provided search terms.", | |
takes: {"search terms": noun_arb_text}, | |
execute: function(terms) { | |
var doc = Application.activeWindow.activeTab.document; | |
var en=encodeURIComponent; | |
var urlTerms = en(terms.text).replace(/%20/g, "+"); | |
// TODO handle selections | |
doc.location.href = "http://www.google.com/bookmarks/find?q=" + urlTerms; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment