This style was deleted by its author, banthaz@userstyles

Google Translate - In the Sidebar

Added by banthaz@userstyles, Created: Jun 01, 2012, Updated: Jan 27, 2013
No screenshot

Description:

Google Translate optimized for usage in the sidebar.

More info
The width of the page must be less than 37em for the style to take effect, so you can still use Google Translate as normal in a tab.

How to use Google Translate from the sidebar:
Alternative 1: Via a bookmark, set to open in the sidebar.
Alternative 2: Via some extension that can execute JavaScript code (like “keyconfig”, “Custom Buttons” and “FireGestures”) with the following code:
var sidebar = document.getElementById("sidebar");
var sidebarBox = document.getElementById("sidebar-box");
var sidebarSplitter = document.getElementById("sidebar-splitter");
var text = document.commandDispatcher.focusedWindow.getSelection().toString();
var url = "http://translate.google.se/?text="+text;
if(sidebar.contentDocument.location != "about:blank" &&
document.getElementById("sidebar-title").value == "Google Translate" &&
(!text || sidebar.contentDocument.getElementById("web-panels-browser").getAttribute("cachedurl") == url)) {
if(sidebarBox.hidden) {
document.getElementById("viewWebPanelsSidebar").setAttribute("checked","true");
sidebarBox.setAttribute("sidebarcommand", "viewWebPanelsSidebar");
sidebarBox.hidden = sidebarSplitter.hidden = false;
} else {
document.getElementById("viewWebPanelsSidebar").removeAttribute("checked");
sidebarBox.removeAttribute("sidebarcommand");
sidebarBox.hidden = sidebarSplitter.hidden = true;
content.focus();
}
} else {
openWebPanel("Google Translate", url);
sidebarBox.width = 250;
}
In the next to last line you can specify the width of sidebar when Google Translate is opened.
The script works like this:
If you have selected some text when invoking the script, Google Translate will be opened in the Sidebar, if not open already, and the selected text will transferred to the translation box. Otherwise, or if the selected text already had been translated, the sidebar will be hidden.
Thanks to dorando, the author of the keyconfig extension, who made the above script.

Jan 27 2013
Improved: The dictionary at the bottom is now vertical instead of horizontal.

Jan 22 2013
Fixed for site changes.

Jun 04 2012
Improved: Now hides more unnecessary things.

Jun 02 2012
First release.

Installs:
Applies to:
all URLs

Related styles:

WARNING: This webware is not functioning properly. Please enable javascript in your browser and try again.