diff options
author | Patrick Simianer <p@simianer.de> | 2016-03-10 15:53:03 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2016-03-10 15:53:03 +0100 |
commit | 238e4d13617b167d83bc5f701aa1538411870163 (patch) | |
tree | 58300f76e21a411f723dbd0ad8231939742ca7d9 /js | |
parent | 86959b66e35fdf0d8ed059271029d8b44a8c7608 (diff) |
js: bugfixes and additions (auto scrolling ...)
Diffstat (limited to 'js')
-rw-r--r-- | js/interface.js | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/js/interface.js b/js/interface.js index 3341575..c946e0c 100644 --- a/js/interface.js +++ b/js/interface.js @@ -61,23 +61,36 @@ var pause = function () var paused = document.getElementById("paused"); var button = document.getElementById("pause_button"); var next_button = document.getElementById("next"); + var reset_button = document.getElementById("reset_button"); var target_textarea = document.getElementById("target_textarea") var initialized = document.getElementById("init"); if (paused.value == 0) { button.innerHTML = "Unpause"; paused.value = 1; - next.setAttribute("disabled", "disabled"); - target_textarea.setAttribute("disabled", "disabled"); + next_button.setAttribute("disabled", "disabled"); + reset_button.setAttribute("disabled", "disabled"); Timer.pause(); + if (ui_type=='g') { + $("#derivation_editor").fadeTo(200,0.1); + DE_ui_lock=true; + } + else target_textarea.setAttribute("disabled", "disabled"); } else { button.innerHTML = "Pause"; paused.value = 0; - next.removeAttribute("disabled"); - if (initialized.value != "") { - target_textarea.removeAttribute("disabled"); - } + next_button.removeAttribute("disabled"); + reset_button.removeAttribute("disabled", "disabled"); Timer.unpause(); + if (ui_type=='g') { + $("#derivation_editor").fadeTo(200,1); + DE_ui_lock=false; + } + else { + if (initialized.value != "") { + target_textarea.removeAttribute("disabled"); + } + } } } @@ -127,7 +140,7 @@ var working = function () target_textarea.setAttribute("disabled", "disabled"); document.getElementById("reset_button").setAttribute("disabled", "disabled"); - DE_locked = true; + DE_ui_lock = true; } function not_working(fadein=true) { @@ -159,7 +172,7 @@ function not_working(fadein=true) document.getElementById("pause_button").removeAttribute("disabled"); document.getElementById("reset_button").removeAttribute("disabled"); - DE_locked = false; + DE_ui_lock = false; } /* @@ -406,7 +419,6 @@ var request_and_process_next = function () $("#next").html("Next"); $("#oov_tgt0").focus(); not_working(false); - DE_locked = true; // translation mode } else { @@ -458,6 +470,7 @@ var request_and_process_next = function () // load data into graphical UI if (ui_type == "g") { + DE_ui_lock = false; DE_init(); var x = $.trim(JSON.parse(DE_extract_data())["target"].join(" ")); last_post_edit.value = x; @@ -514,3 +527,10 @@ $().ready(function() } }); + +function scroll(event) { + var x = event.clientX; + var xPercentage = x / screen.width; + window.scrollTo(xPercentage * width, 0); +} + |