Skip to content

Instantly share code, notes, and snippets.

@matthewfl
Created June 7, 2009 02:08
Show Gist options
  • Save matthewfl/125106 to your computer and use it in GitHub Desktop.
Save matthewfl/125106 to your computer and use it in GitHub Desktop.
Domainr domain name lookup
function query (domain, obj) {
var url = "http://domai.nr/api/json/search?q="+domain
jQuery.get(url, null, function (j) {
j = Utils.decodeJson(j);
var text = "";
for(var a =0;a< j.results.length;a++) {
text += "<p style='color:";
text += j.results[a].availability == "taken" ? "red" : "green";
text += "'>";
text += j.results[a].domain + j.results[a].path;
text+= "</p>";
}
jQuery(obj).html(text);
});
}
CmdUtils.CreateCommand({
names: ["domainer"],
//takes: {"Domain name": noun_arb_text},
arguments: [{role: "Domain", nountype:noun_arb_text}],
preview: function(pblock, args) {
query(args.Domain.text, pblock);
//query(statusText.text, pblock);
},
execute: function(args) {
Utils.focusUrlInBrowser("http://domai.nr/"+args.Domain.text)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment