Skip to content

Instantly share code, notes, and snippets.

@ba3r
Created November 3, 2009 16:03
Show Gist options
  • Save ba3r/225153 to your computer and use it in GitHub Desktop.
Save ba3r/225153 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
names: ["input"],
icon: "http://desktop.google.com/favicon.ico",
description: "Visual Search",
author: {name: "Michael Baer", homepage: "http://twitter.com/synapsos"},
license: "GPL",
homepage: "http://images.google.com/",
arguments: {object_query: noun_arb_text},
preview: function (html, q) {
var params = {q: q.object.text,
imgtype: "photo",
imgsz: "m"};
html.innerHTML = "Google Image Search for <b>"+q.object.text+"</b>";
if (q.object.text == "")
return;
jQuery.get ('http://images.google.com/images', params, function (data) {
var regex = new RegExp ("dyn.setResults...\"[^\"]*\",\"[^\"]*\",\"([^\"]*)\",\"([^\"]*)\"", "gi");
line = regex.exec (data);
html.innerHTML = '<div style="height:125px"><img src="http://tbn0.google.com/images?q=tbn:'+line [1]+":"+line [2]+'"></div><br>';
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment