Skip to content

Instantly share code, notes, and snippets.

@ftherese
Created January 23, 2009 14:54
Show Gist options
  • Save ftherese/51033 to your computer and use it in GitHub Desktop.
Save ftherese/51033 to your computer and use it in GitHub Desktop.
makeSearchCommand({
name: "hulu",
synonyms: ["video"],
url: "http://www.hulu.com/videos/search?query={QUERY}",
icon: "http://www.hulu.com/favicon.ico",
description: "Searches <a href=\"http://www.hulu.com\">Hulu</a> for videos matching your words.",
preview: function( pblock, thing ) {
if (thing.text < 1) {pblock.innerHTML = "Search <b>Hulu</b>"; return;}
jQuery.get(this.url.replace("{QUERY}", thing.text),
function (doc)
{var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "table");
tempElement.innerHTML = doc;
// I know there must be a better way of accomplishing the following, but I am an absolute newbie when it comes to jQuery. Help would be appreciated.
pblock.innerHTML = jQuery("table td h3",tempElement).html() + jQuery("table td h4",tempElement).html() + "<p></p>" + jQuery("table td h3",tempElement).eq(2).html() + jQuery("table td h4",tempElement).eq(2).html() + "<p></p>" + jQuery("table td h3",tempElement).eq(3).html() + jQuery("table td h4",tempElement).eq(3).html() + "<p></p>" + jQuery("table td h3",tempElement).eq(4).html() + jQuery("table td h4",tempElement).eq(4).html();
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment