CmdUtils.CreateCommand({
name: "anidb",
icon: "http://static.anidb.net/favicon.ico",
author: { name: "belgabor" },
license: "GPL",
description: "Search anidb.net for animes, groups, producers, users or in your mylist.",
help: "Type 'anidb (searchtopic) [in (animes, groups, producers, users or mylist)].",
takes: {"input": noun_arb_text},
modifiers:{"in": new CmdUtils.NounType("search-category",["Anime","Groups","Producers","Users","MyList"])},
preview: function( pblock, input ) {
pblock.innerHTML = "Search AniDB.net";
},
execute: function(directObj, modifiers) {
var dblist = "animelist";
var topic = directObj.text;
if (modifiers.in && modifiers.in.text) {
var cat = modifiers.in.text.toLowerCase();
switch (cat) {
case 'groups':
dblist = "grouplist";
break;
case 'producers':
dblist = "producerlist";
break;
case 'users':
dblist = "userlist";
break;
case 'mylist':
dblist = "mylist";
break;
}
}
var params = Utils.paramsToString({
"do.search": "search",
"adb.search": topic,
"show": dblist
});
var url='http://anidb.net/perl-bin/animedb.pl' + params;
Utils.openUrlInBrowser(url);
}
});