Created
September 1, 2008 00:45
-
-
Save hayamiz/8246 to your computer and use it in GitHub Desktop.
This file contains 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
// Ubiquity plugin | |
// ALC(eijiro) | |
var eijiro_waitqueue = []; | |
var word_var = { | |
_name: "search word", | |
suggest: function( text, html ) { | |
var suggestions = [CmdUtils.makeSugg(text)]; | |
if(window.foxytunesGetCurrentTrackTitle){ | |
suggestions.push(CmdUtils.makeSugg(window.foxytunesGetCurrentTrackTitle())); | |
} | |
return suggestions; | |
} | |
}; | |
CmdUtils.CreateCommand({ | |
name: "eijiro", | |
takes: {word: word_var}, | |
icon: "http://eow.alc.co.jp/favicon.ico", | |
author: {name: "Y. Hayamizu", email: "[email protected]"}, | |
preview: function(pblock, directObject) { | |
while(eijiro_waitqueue.length > 0){ | |
Utils.clearTimeout(eijiro_waitqueue.shift()); | |
} | |
eijiro_waitqueue.push( | |
Utils.setTimeout(function(){ | |
searchText = jQuery.trim(directObject.text); | |
pblock.innerHTML = "<p><img src=\"http://unicus.ddo.jp/loading.gif\"> Waiting search result : \"" + searchText + "\"" | |
jQuery.get("http://unicus.ddo.jp/eijiro.cgi?query=" + encodeURIComponent(searchText), function(response){ | |
pblock.innerHTML = response.toString(); | |
pblock.style.color = "black"; | |
pblock.style.background = "white"; | |
}); | |
}, 1000)); | |
}, | |
execute: function(directObject){ | |
searchText = jQuery.trim(directObject.text); | |
Utils.openUrlInBrowser("http://eow.alc.co.jp/" + encodeURIComponent(searchText) + "/UTF-8/"); | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment