# HG changeset patch # User Atul Varma # Date 1237530641 25200 # Node ID a2715827c482c997cdad3dfcaa17cd75529a3b1f Origination. diff -r 000000000000 -r a2715827c482 wowhead/results.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wowhead/results.html Thu Mar 19 23:30:41 2009 -0700 @@ -0,0 +1,14 @@ + + + + + Preview Content + + +
+ + + + + diff -r 000000000000 -r a2715827c482 wowhead/results.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wowhead/results.js Thu Mar 19 23:30:41 2009 -0700 @@ -0,0 +1,21 @@ +function showResults(data) { + var names = data[1]; + var meta = data[7]; + var list = $(""); + for (var i = 0; i < names.length; i++) { + var name = names[i]; + var item_meta = meta[i]; + var id = item_meta[1]; + var quality = item_meta[3]; + var link = $(''); + link.text(name); + list.append(link); + link.wrap("
  • "); + } + $("#results").html(list); +} + +SAMPLE_RESULTS = ["sword", ["Bastard Sword (Item)", "Chromatic Sword (Item)", "Commoner's Sword (Item)", "Crude Bastard Sword (Item)", "Feeble Sword (Item)", "Long Bastard Sword (Item)", "Shadowhide Two-handed Sword (Item)", "Sword of Decay (Item)", "Sword of the Night Sky (Item)", "Well-used Sword (Item)"], [], [], [], [], [], [[3, 1194, "INV_Sword_06", 1], [3, 1604, "INV_Sword_22", 2], [3, 1511, "INV_Sword_04", 0], [3, 1412, "INV_Sword_06", 0], [3, 1413, "INV_Sword_04", 0], [3, 1830, "INV_Sword_06", 0], [3, 1460, "INV_Sword_46", 2], [3, 1727, "INV_Sword_26", 3], [3, 2035, "INV_Sword_20", 2], [3, 1008, "INV_Sword_04", 1]]]; + +//$(window).ready(function() { showResults(SAMPLE_RESULTS); }); diff -r 000000000000 -r a2715827c482 wowhead/wowhead.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wowhead/wowhead.html Thu Mar 19 23:30:41 2009 -0700 @@ -0,0 +1,12 @@ + + + + + + Wowhead Ubiquity Command + + +Hi there. + + diff -r 000000000000 -r a2715827c482 wowhead/wowhead.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wowhead/wowhead.js Thu Mar 19 23:30:41 2009 -0700 @@ -0,0 +1,31 @@ +/* This is a template command. */ +CmdUtils.CreateCommand({ + name: "wowhead", + icon: "http://www.wowhead.com/favicon.png", + homepage: "http://www.wowhead.com/", + author: {name: "Your Name", email: "you@example.com"}, + license: "GPL", + description: "A short description of your command", + help: "How to use your command", + takes: {"input": /.*/}, + previewUrl: Utils.url({uri: "results.html", base: feed.id}), + preview: function(pblock, input) { + var url = ("http://www.wowhead.com/?search=" + encodeURI(input.text) + + "&opensearch"); + CmdUtils.previewAjax(pblock, { + url: url, + dataType: "text", + error: function() { + pblock.innerHTML = "Sorry, an error occurred."; + }, + success: function(data) { + var scriptTag = pblock.ownerDocument.createElement("script"); + scriptTag.textContent = "showResults(" + data + ");"; + pblock.appendChild(scriptTag); + } + }); + }, + execute: function(input) { + displayMessage("You selected: " + input.text); + } +});