Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/goshen-chrome/onpage/onpage.js')
-rw-r--r--contrib/goshen-chrome/onpage/onpage.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/goshen-chrome/onpage/onpage.js b/contrib/goshen-chrome/onpage/onpage.js
new file mode 100644
index 000000000..046cade28
--- /dev/null
+++ b/contrib/goshen-chrome/onpage/onpage.js
@@ -0,0 +1,25 @@
+// This is run inside the scope of a page, and so we have direct access to the
+// page's HTML from here.
+
+(function (window) {
+
+ if (typeof window._goshen !== 'undefined') {
+ console.warn("_goshen unable to initialize!");
+ return;
+ } else {
+ window._goshen = {};
+ }
+
+ // We can now request the contents of window.
+
+ window.addEventListener('keyup', function(ev) {
+ // This is a bit heavy-handed, and we almost assuredly don't need to be
+ // capturing every keyup event. But it's lightweight, and serves as a
+ // decent proof of concept.
+ if (ev.altKey && ev.keyCode == 84) {
+ // They pressed Alt+T. Call _goshen's get-text function!
+ window._goshen._cg.selectMode();
+ }
+ });
+
+})(this);