sr (owner)

Fork Of

gist: 7616 by al3x Ubiquity commands for bit.l...

Revisions

gist: 7870 Download_button fork
public
Public Clone URL: git://gist.github.com/7870.git
Embed All Files: show embed
JavaScript #
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
60
61
62
63
64
65
66
67
68
69
CmdUtils.CreateCommand({
  name: "bitly",
  takes: {"url to shorten": noun_arb_text},
  preview: "Replaces the selected URL with a bit.ly-shortened URL.",
  description: "Replaces the selected URL with a bit.ly-shortened URL.",
  icon: "http://bit.ly/favicon.png",
  execute: function( urlToShorten ) {
    var baseUrl = "http://bit.ly/api";
    var params = {url: urlToShorten.text};
    jQuery.get(baseUrl, params, function(shortenedUrl) {
      CmdUtils.setSelection(shortenedUrl);
    })
  }
})
 
CmdUtils.CreateCommand({
  name: "zap",
  description: "Discards the current page's stylesheets.",
  execute: function() {
    var doc = Application.activeWindow.activeTab.document;
    var newSS, styles='* { background: white ! important; color: black !important } :link, :link * { color: #0000EE !important } :visited, :visited * { color: #551A8B !important }';
 
    newSS = doc.createElement('link');
    newSS.rel = 'stylesheet';
    newSS.href = 'data:text/css,' + escape(styles);
    doc.getElementsByTagName("head")[0].appendChild(newSS);
  }
})
 
CmdUtils.CreateCommand({
  name: "subscribe",
  description: "Subscribes to the current site's feed in Google Reader.",
  icon: "http://www.google.com/reader/ui/573007822-app-icon-32.png",
  execute: function() {
    var doc = Application.activeWindow.activeTab.document;
    Utils.openUrlInBrowser('http://www.google.com/reader/view/feed/'+encodeURIComponent(doc.location.href));
  }
})
 
CmdUtils.CreateCommand({
  name: "instapaper",
  description: "Adds the current page to your Instapaper for later reading.",
  icon: "http://instapaper.com/favicon.png",
  execute: function() {
    var d = Application.activeWindow.activeTab.document,
    w = window,
    s = context.focusedWindow.getSelection(),
    l = d.location,
    e = encodeURIComponent,
    f = 'http://www.instapaper.com/b',
    p = '?v=4&k=PUTYOURBOOKMARKLETKEYHERE&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s),
    u = f + p;
 
    CmdUtils.getHiddenWindow().open(u, 't', 'toolbar=0,resizable=0,status=1,width=250,height=150');
  }
})
 
CmdUtils.CreateCommand({
  name: "yep",
  description: "Imports the current page as PDF in Yep.",
  execute: function() {
    var doc = Application.activeWindow.activeTab.document;
    var sel = context.focusedWindow.getSelection();
    var url = 'yep:url='+encodeURIComponent(doc.location.href)+'&title='+encodeURIComponent(doc.title)+'&tags='+encodeURIComponent(sel);
    openUrl(url);
  }
})