if (CmdUtils.parserVersion == 2)

CmdUtils.makeSearchCommand({
    names: ["search Urban Dictionary", "urban-dictionary-search"],
    author: {name: "Timofei Shatrov", email: "timofei.shatrov@gmail.com"},
    description: "Looks up in Urban Dictionary",
    icon: "http://www.urbandictionary.com/favicon.ico",
    url:"http://www.urbandictionary.com/define.php?term={QUERY}",
    preview: function( pblock, args ) {
    var thing = args.object;
    if (thing.text < 1) {pblock.innerHTML = "Search <b>Urban Dictionary</b>"; return;}
    CmdUtils.previewGet(pblock, this.url.replace("{QUERY}", thing.text),
      function (doc)
       {var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "div");
        tempElement.innerHTML = doc;
        var definition = jQuery("td.text:first div.definition",tempElement).html();
        var examples = jQuery("td.text:first div.example",tempElement).html();
     
        pblock.innerHTML = "<div class='definition'>"+definition+"</div><br/>" +
          "<div class='example' style='font-style:italic'>"+examples+"</div>";         
    })
  },
    previewDelay: 500
});

else

CmdUtils.makeSearchCommand({
  name: "urban-dictionary-search",
  author: {name: "Timofei Shatrov", email: "timofei.shatrov@gmail.com"},
  description: "Looks up in Urban Dictionary",
  icon: "http://www.urbandictionary.com/favicon.ico",
  url:"http://www.urbandictionary.com/define.php?term={QUERY}",
  preview: function( pblock, thing ) {
    if (thing.text < 1) {pblock.innerHTML = "Search <b>Urban Dictionary</b>"; return;}
    CmdUtils.previewGet(pblock, this.url.replace("{QUERY}", thing.text),
      function (doc)
       {var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "div");
        tempElement.innerHTML = doc;
        var definition = jQuery("td.text:first div.definition",tempElement).html();
        var examples = jQuery("td.text:first div.example",tempElement).html();
     
        pblock.innerHTML = "<div class='definition'>"+definition+"</div><br/>" +
          "<div class='example' style='font-style:italic'>"+examples+"</div>";         
    })
  },
  previewDelay: 500
});


