Skip to content

Instantly share code, notes, and snippets.

@cgardner
Created April 15, 2009 16:19
Show Gist options
  • Save cgardner/95883 to your computer and use it in GitHub Desktop.
Save cgardner/95883 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand(
{
name: "drupal-module",
takes: {"function": noun_arb_text},
icon: "http://drupal.org/misc/favicon.ico",
homepage: "http://craig-gardner.com",
author: {name: "Craig Gardner", email: "craig.s.gardner@gmail.com"},
license: "MPL,GPL",
description: "Quickly access Drpual modules",
help: "Enter the name of a Drupal module",
execute: function(directObject)
{
var url = "http://drupal.org/project/{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 = "Find a Drupal Project";
return;
}
var previewTemplate = "Load the ${query} Drupal module";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment