jonathan.soeder
3 Sep 2008, 12:52 PM
UPDATE: Devnull submitted a much better looking version. Here it is below:
CmdUtils.CreateCommand({
name: "ext2-docs",
icon: "http://extjs.com/favicon.ico",
description: "Searches the Ext 2.x API documentation",
help: "Enter a full or partial name of the Ext class you are looking for",
takes: {
"class": noun_arb_text
},
preview: function(pblock, directObject){
var searchTerm = directObject.text;
var pTemplate = "Searches Ext for <b>${query}</b>";
var pData = {
query: searchTerm
};
pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);
var url = "http://ajax.googleapis.com/ajax/services/search/web";
var params = {
v: "1.0",
q: "site:http://extjs.com/deploy/dev/docs/output/ " + searchTerm
};
jQuery.get(url, params, function(data){
var numToDisplay = 3;
var results = data.responseData.results.splice(0, numToDisplay);
var matches;
for (var i in results) {
if (matches = results[i].unescapedUrl.match(/http:\/\/extjs.com\/deploy\/dev\/docs\/output\/(.*)\.html$/)) {
results[i].unescapedUrl = "http://extjs.com/deploy/dev/docs/?class=" + matches[1];
}
}
pblock.innerHTML = CmdUtils.renderTemplate({
file: "google-search.html"
}, {
results: results
});
}, "json");
},
execute: function(theClass){
var URL = "http://www.google.com/search?q=site:http://extjs.com/deploy/dev/docs/output/ " + theClass.text;
Utils.openUrlInBrowser(URL);
}
Thanks to the poster who posted an ubiquity command to search the Ext Forums for showing me the way. I added the above command so that I can reference the documentation to an Ext class by simply hitting alt-space and then typing "ext-docs Ext.form.FormPanel".
There might be an easier way to pull up something with prettier output. I'm looking into it.
CmdUtils.CreateCommand({
name: "ext2-docs",
icon: "http://extjs.com/favicon.ico",
description: "Searches the Ext 2.x API documentation",
help: "Enter a full or partial name of the Ext class you are looking for",
takes: {
"class": noun_arb_text
},
preview: function(pblock, directObject){
var searchTerm = directObject.text;
var pTemplate = "Searches Ext for <b>${query}</b>";
var pData = {
query: searchTerm
};
pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);
var url = "http://ajax.googleapis.com/ajax/services/search/web";
var params = {
v: "1.0",
q: "site:http://extjs.com/deploy/dev/docs/output/ " + searchTerm
};
jQuery.get(url, params, function(data){
var numToDisplay = 3;
var results = data.responseData.results.splice(0, numToDisplay);
var matches;
for (var i in results) {
if (matches = results[i].unescapedUrl.match(/http:\/\/extjs.com\/deploy\/dev\/docs\/output\/(.*)\.html$/)) {
results[i].unescapedUrl = "http://extjs.com/deploy/dev/docs/?class=" + matches[1];
}
}
pblock.innerHTML = CmdUtils.renderTemplate({
file: "google-search.html"
}, {
results: results
});
}, "json");
},
execute: function(theClass){
var URL = "http://www.google.com/search?q=site:http://extjs.com/deploy/dev/docs/output/ " + theClass.text;
Utils.openUrlInBrowser(URL);
}
Thanks to the poster who posted an ubiquity command to search the Ext Forums for showing me the way. I added the above command so that I can reference the documentation to an Ext class by simply hitting alt-space and then typing "ext-docs Ext.form.FormPanel".
There might be an easier way to pull up something with prettier output. I'm looking into it.