Script Summary: It's a little translator(English->Chinese), with double clicking or selecting the word, you can get the translated result from Google Translate, meanwhile, you don't have to leave the current page you're browsing. I'm sure this script is faster than some GUI applications :)
- With double clicking / selecting words or sentences on the web page, SimpleTranslator will translate the target and give you result.
- Using alt+q can turn ON/OFF translator. Current default STATE is OFF, please press alt+q to turn it ON when you need it.
- By pressing alt+i, you can input the word you want to look up freely.
Currently, only supports English to Chinese, but you can modify the code to let it fit you needs.
Rewrite the code since Google's translated format has been changed.
- IMPORTANT Set default STATE to OFF, you can press alt+q to turn on translator when you need it. The reason why I do this is because SimpleTranslator maybe inconvenient when you're gonna copy something from the web page.
- By pressing alt+i, you can look up words by your inputs.
- Refactored code
- Added a new feature to turn ON/OFF translator (by pressing alt+q)
- Updated display area css style.
- Fixed NS_ERROR_ILLEGAL_VALUE issue.
- Updated getting window selection part code to make it easier.
- Refactored display area code to make reusable.
It's inconvenient when you want to copy a piece of text. (This only means pure english sentences) A possible way to solve this is to give a way to turn off/on the translator (For example, Alt+x will switch the translator's state).DONE Add a test to see whether the selected area is all non-english words.DONE Add css to make the style of display area consistent, because current implementation depends on the css setting of host page.DONE Add looking up word by user inputDONE