-
-
Save arikan/19280 to your computer and use it in GitHub Desktop.
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
CmdUtils.CreateCommand({ | |
name: "hello-world", | |
preview: "Displays a <i>salutary</i> greeting to the <h1>planet</h1>.", | |
execute: function() { | |
displayMessage( "Hello, World!" ); | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "date", | |
homepage: "http://azarask.in/", | |
author: { name: "Aza Raskin", email: "[email protected]"}, | |
contributors: ["Atul Varma"], | |
license: "MPL", | |
description: "Inserts today's date.", | |
help: "If you're in an editable text area, inserts today's date, formatted for the current locale.", | |
_date: function(){ | |
var date = new Date(); | |
return date.toLocaleDateString(); | |
}, | |
preview: function( pblock ) { | |
var msg = 'Inserts todays date: "<i>${date}</i>"'; | |
pblock.innerHTML = CmdUtils.renderTemplate( msg, {date: this._date()} ); | |
}, | |
execute: function() { | |
CmdUtils.setSelection( this._date() ); | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "map-me", | |
_getMapUrl: function() { | |
var loc = CmdUtils.getGeoLocation(); | |
var mapUrl = "http://maps.google.com/staticmap?"; | |
var params = { | |
center: loc.lat + "," + loc.long, | |
size: "500x400", | |
zoom: 14, | |
key: "ABQIAAAAGZ11mh1LzgQ8-8LRW3wEShQeSuJunOpTb3RsLsk00-MAdzxmXhQoiCd940lo0KlfQM5PeNYEPLW-3w" | |
}; | |
return mapUrl + jQuery.param( params ); | |
}, | |
preview: function( pblock ) { | |
var msg = "Inserts a map of your current location: <br/>"; | |
msg += "<img src='%s'/>".replace( /%s/, this._getMapUrl() ); | |
pblock.innerHTML = msg; | |
}, | |
execute: function( ) { | |
CmdUtils.getImageSnapshot( this._getMapUrl(), function(imgData) { | |
CmdUtils.setSelection( "<img src='" + imgData +"'/>"); | |
}) | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "echo", | |
takes: {"your shout": noun_arb_text}, | |
preview: function( pblock, theShout ) { | |
pblock.innerHTML = "Will echo: " + theShout.text; | |
}, | |
execute: function( theShout ) { | |
var msg = theShout.text + "... " + theShout.text + "......"; | |
displayMessage( msg ); | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "insert-email", | |
takes: {"person": noun_type_contact}, | |
preview: "Inserts someone's email address by name.", | |
execute: function( email ) { | |
CmdUtils.setSelection( email.text ); | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "tiny", | |
takes: {"url to shorten": noun_arb_text}, | |
preview: "Replaces the selected URL with a TinyUrl.", | |
execute: function( urlToShorten ) { | |
var baseUrl = "http://tinyurl.com/api-create.php"; | |
var params = {url: urlToShorten.text}; | |
jQuery.get( baseUrl, params, function( tinyUrl ) { | |
CmdUtils.setSelection( tinyUrl ); | |
}) | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "ss", | |
takes: {"kelime": noun_arb_text}, | |
url: "http://www.seslisozluk.com/?word=", | |
icon: "http://www.seslisozluk.com/favicon.ico", | |
preview: "Verilen kelimeye seslisozluk.com'de bakar.", | |
description: "Verilen kelimeye seslisozluk.com'de bakar.", | |
execute: function(girdi) { | |
Utils.openUrlInBrowser(this.url + girdi.text); | |
} | |
}) | |
CmdUtils.CreateCommand({ | |
name: "dd", | |
takes: {"kelime": noun_arb_text}, | |
url: "http://www.dugumkume.org/?s=", | |
icon: "http://www.dugumkume.org/favicon.ico", | |
preview: "Verilen kelimeyi Dugumkume.org'da arar.", | |
description: "Verilen kelimeyi Dugumkume.org'da arar.", | |
execute: function(girdi) { | |
Utils.openUrlInBrowser(this.url + girdi.text); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment