Created
February 6, 2009 18:34
-
-
Save dcinzona/59538 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: "wiodsearch", | |
takes: {"query": noun_arb_text}, | |
icon: "http://s.wordpress.org/favicon.ico?2", | |
homepage: "http://wiod.us/", | |
author: {name: "Gustavo Tandeciarz", email: "dcinzona@gmail.com"}, | |
license: "MPL,GPL", | |
description: "Search WIOD Blog", | |
help: "Enter search", | |
execute: function(directObject) | |
{ | |
var url = "http://wiod.us/search/{QUERY}" | |
var urlString = url.replace("{QUERY}", directObject.text); | |
Utils.openUrlInBrowser(urlString); | |
}, | |
preview: function(pblock, directObject) | |
{ | |
searchText = jQuery.trim(directObject.text); | |
if(searchText.length <= 0) | |
{ | |
pblock.innerHTML = "Search WIOD Blog"; | |
return; | |
} | |
var previewTemplate = "Search WIOD Blog for ${query}"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
} | |
}); | |
CmdUtils.CreateCommand( | |
{ | |
name: "wiodposts", | |
takes: {"number of posts": noun_arb_text}, | |
icon: "http://s.wordpress.org/favicon.ico?2", | |
homepage: "http://wiod.us/", | |
author: {name: "Gustavo Tandeciarz", email: "dcinzona@gmail.com"}, | |
license: "MPL,GPL", | |
description: "Displays Posts in wiod.us", | |
help: "Show Posts", | |
execute: function(directObject) | |
{ | |
var url = "http://wiod.us/?ub=posts&n={QUERY}"; | |
var numposts = directObject.text; | |
var baseurl = url.replace("{QUERY}", numposts); | |
jQuery.get( baseurl, function( data ) { | |
CmdUtils.setSelection( trim(data) ); }) | |
}, | |
preview: function(pblock, directObject) | |
{ | |
var url = "http://wiod.us/?ub=posts&n={QUERY}"; | |
var numposts = jQuery.trim(directObject.text); | |
if(numposts.length<=0) | |
numposts = '4'; | |
var baseurl = url.replace("{QUERY}", numposts); | |
jQuery.get( baseurl, function( data ) { | |
pblock.innerHTML = data;}); | |
} | |
}); | |
CmdUtils.CreateCommand( | |
{ | |
name: "wiodauthors", | |
icon: "http://s.wordpress.org/favicon.ico?2", | |
homepage: "http://wiod.us/", | |
author: {name: "Gustavo Tandeciarz", email: "dcinzona@gmail.com"}, | |
license: "MPL,GPL", | |
description: "Displays Posts in wiod.us", | |
help: "Show Posts", | |
execute: function(directObject) | |
{ | |
var url = "http://wiod.us/?ub=authors"; | |
jQuery.get( url, function( data ) { | |
CmdUtils.setSelection( trim(data) ); }) | |
}, | |
preview: function(pblock, directObject) | |
{ | |
var url = "http://wiod.us/?ub=authors"; | |
jQuery.get( url, function( data ) { | |
pblock.innerHTML = data; | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment