Create a gist now

Instantly share code, notes, and snippets.

@ftherese /x
Created Jan 24, 2009

What would you like to do?
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 = "Found on <b>Hulu</b>";
for( var i=0; i<=4; i++ ) {
pblock.innerHTML += "<div style='display: block; margin-bottom: 10px; clear: both;' > " + " <a style='color: blue; font-size: 14px;' href='" + jQuery("table td h3 a", tempElement).eq(i).attr("href") + "'><img style='float:left; margin-right: 10px; border:thin solid white; " + jQuery("table td h3 img", tempElement).eq(i).attr("style") + "' src='" + jQuery("table td h3 img", tempElement).eq(i).attr("src") + "' />" + jQuery("table td h3 img",tempElement).eq(i).attr("alt") + "</a></div></br>";
//pblock.innerHTML += jQuery("table td h3",tempElement).eq(i).html() + jQuery("table td h4",tempElement).eq(i).html() + "<p></p>" ;
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment