Created
February 4, 2009 16:11
-
-
Save edbond/58174 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
/* This is a template command */ | |
CmdUtils.CreateCommand({ | |
name: "Yandex.Slovari", | |
icon: "http://lingvo.yandex.ru/favicon.ico", | |
homepage: "http://slovari.yandex.ru/", | |
author: { name: "Eduard Bondarenko", email: "[email protected]"}, | |
license: "GPL", | |
description: "Translate selection on yandex slovari", | |
help: "Input text for translation", | |
takes: {"word": noun_arb_text}, | |
preview: function( pblock, word ) { | |
// load page | |
var url="http://lingvo.yandex.ru/en?text="+word.text+"&st_translate=on"; | |
jQuery.get(url, function(yhtml) { | |
//CmdUtils.log(yhtml); | |
var article = jQuery( ".lingvo-article:first", yhtml ); | |
//CmdUtils.log(article); | |
if (article.length > 0) { | |
pblock.innerHTML = article[0].innerHTML; | |
}; | |
}); | |
}, | |
execute: function(word) { | |
Utils.openUrlInBrowser("http://lingvo.yandex.ru/en?text="+word.text+"&st_translate=on"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment