Created
November 3, 2009 16:03
-
-
Save ba3r/225153 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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