rrichards
10/18/2009 - 9:49 AM

gistfile1.js

CmdUtils.CreateCommand({
  name: "search-domain-name",
  icon: "http://instantdomainsearch.com/favicon.ico",
  author: {name: "Pratham Kumar", email: "pratham@pratham.name"},
  description: "Checks availabilty of the domain name with com/net/org TLDs.",
	homepage: "http://pratham.name/",
  takes: {"example.com": noun_arb_text},

  preview: function (html, q) {
    var params = {name: q.text};
    html.innerHTML = 'Searching for <b>'+q.text+'</b>';

    jQuery.get ('http://instantdomainsearch.com/services/rest/', params, function (data) {
      data = eval ('('+data+')');
      var name = data ['name'];

      html.innerHTML = name + ' - <a style="color:'+(data ['com'] == 'a' ? 'green' : 'red')+'" href="http://'+name+'.com/">com</b> <a href="http://'+name+'.net/" style="color:'+(data ['net'] == 'a' ? 'green' : 'red')+'">net</a> <a href="http://'+name+'.org/" style="color:'+(data ['org'] == 'a' ? 'green' : 'red')+'">org</a>';
    });
  }
})