Created
February 24, 2009 02:37
-
-
Save brianhanifin/69358 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: "trim", | |
synonyms: ["tr.im"], | |
icon: "http://tr.im/favicon.ico", | |
description: "Replaces the selected URL with a <a href=\"http://tr.im\">tr.im</a> shortened URL.", | |
//help: "how to use your command", | |
homepage: "http://code.brianhanifin.com/", | |
author: { name: "Brian J. Hanifin", email: "[email protected]"}, | |
license: "GPL", | |
takes: {"input": noun_type_url}, | |
preview: "Replaces the selected URL with a shortened tr.im URL.", | |
execute: function( input ) { | |
var baseUrl = "http://tr.im/api/trim_url.json"; | |
var params = { | |
url: input.text | |
}; | |
jQuery.get( baseUrl, params, function( results ) { | |
results = Utils.decodeJson( results ); | |
CmdUtils.setSelection( results.url ); | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment