gist: 24257 Download_button fork
public
Description:
Ubiquity commands to search and bookmark with Google Bookmarks
Public Clone URL: git://gist.github.com/24257.git
ubiquity-google.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* 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;
   }
});

Owner

garyhodgson

Revisions