-
-
Save jasherai/69520 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: "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