Skip to content

Instantly share code, notes, and snippets.

@jasherai
Created February 24, 2009 11:25
Show Gist options
  • Save jasherai/69520 to your computer and use it in GitHub Desktop.
Save jasherai/69520 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand(
{
name: "mac",
takes: {"function": noun_arb_text},
icon: "http://standards.ieee.org/favicon.ico",
homepage: "http://standards.ieee.org/index.html",
author: {name: "Dragomir Manolov", email: "usmiv4o@gmail.com"},
license: "FREE",
description: "Search mac adress functions",
help: "Select a mac adress last octet function",
execute: function(directObject)
{
var url = "http://standards.ieee.org/cgi-bin/ouisearch?{QUERY}"
var str=directObject.text;
str= str.slice(0,8);
str= str.replace(":","-")
str = str.replace(":","-");
var urlString = url.replace("{QUERY}", str);
Utils.openUrlInBrowser(urlString);
},
preview: function(pblock, directObject)
{
searchText = jQuery.trim(directObject.text);
if(searchText.length <= 0)
{
pblock.innerHTML = "Search mac function";
return;
}
var previewTemplate = "Search mac <b>${query}</b>";
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