Skip to content

Instantly share code, notes, and snippets.

@okj579
Created December 14, 2008 22:36
Show Gist options
  • Save okj579/35818 to your computer and use it in GitHub Desktop.
Save okj579/35818 to your computer and use it in GitHub Desktop.
Dict.cc German-English Dictionary Ubiquity Command
CmdUtils.CreateCommand({
name: "dictcc",
author: {name: "Owen", email: "okj579@gmail.com"},
icon: "http://www.dict.cc/favicon.ico",
description: "Translates between English and German using the http://www.dict.cc dictionary.<br>Übersetzt ins Englisch und Deutsch mit das http://www.dict.cc Wörterbuch.",
help: "Type a word in German or English to get multiple translations. Press enter to go to the dict.cc page. Try 'dictcc hello'<br>Tippen Sie ein Wort auf Deutsch oder Englisch mehrfach Übersetzungen zu sehen. Tippen Sie die Eingabetaste zu die dict.cc Seite zu gehen. Versuchen Sie 'dictcc hallo'",
takes: {"word": noun_arb_text},
preview: function(preview, input) {
preview.innerHTML = "Translates between English and German<br>Übersetzt ins Englisch und Deutsch";
if(input.text) {
preview.innerHTML = "Loading...<br>Laden...";
url = "http://www8.dict.cc/?s=" + input.text;
Utils.ajaxGet(url, function(xml) {
CmdUtils.loadJQuery( function(jQuery) {
var text = "<table cellpadding=5 cellspacing=0><tr><td width=50%><u><b>English</b></u></td><td></td><td width=50%><u><b>Deutsch</b></u></td></tr><tr><td width=50%>";
var text = text + jQuery(xml).find("#tr1 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr1 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr2 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr2 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr3 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr3 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr4 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr4 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr5 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr5 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr6 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr6 .td7nl:last").text();
var text = text + "</td></tr><tr><td width=50%>"
var text = text + jQuery(xml).find("#tr7 .td7nl:first").text();
var text = text + "</td><td></td><td width=50%>"
var text = text + jQuery(xml).find("#tr7 .td7nl:last").text();
var text = text + "</td></tr></table>"
preview.innerHTML = "Translates between English and German<br>Übersetzt ins Englisch und Deutsch<br><br>" + text;
});
});
}
},
execute: function(input) {
Utils.openUrlInBrowser("http://www.dict.cc/?s=" + input.text);
}
});
CmdUtils.CreateCommand({
name: "dictcc-conjugation",
author: {name: "Owen", email: "okj579@gmail.com"},
icon: "http://www.dict.cc/favicon.ico",
description: "Gives the conjugation and inflections of a German word using the http://www.dict.cc dictionary.<br>Zeigt die Konjugation und Beugungen eines deutschen Wortes mit das http://dict.cc Wörterbuch",
help: "Type a word in German to get it's conjugation. Press enter to go to the dict.cc page. Try 'dictcc-conjugation machen'.<br>Tippen Sie ein Deutsches Wort seine Konjugation zu sehen. Tippen Sie die Eingabetaste zu die dict.cc seite zu gehen. Versuchen Sie 'dictcc-conjugation machen'",
takes: {"word": noun_arb_text},
preview: function(preview, input) {
if(input.text) {
preview.innerHTML = "Gives the conjugation and inflections of " + input.text + ".<br>Zeigt die Konjugation von " + input.text + ".";
} else {
preview.innerHTML = "Gives the conjugation and inflections of a German verb.<br>Zeigt die Konjugation und Beugungen eines deutschen Wortes.";
}
},
execute: function(input) {
Utils.openUrlInBrowser("http://www.dict.cc/deutsch/" + input.text + ".html");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment