-
-
Save sr/7870 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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); | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment