Skip to content

Commit

Permalink
highlight detected language
Browse files Browse the repository at this point in the history
  • Loading branch information
miau1 committed Oct 22, 2019
1 parent 2b952c5 commit b0a4d6f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions static/fix_language.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function translate() {
$("#status").text("");
$("#translation").css("font-style", "normal");
$("#translation").text(data.result);

highlight_detected(data.source);
});
return false;
} else {
Expand All @@ -33,6 +35,14 @@ function translate() {
}
}

function highlight_detected(source) {
if ($("#selected-source").attr("language") == "DL") {
$(".source-languages").css({"background-color": "", "border": "1px solid black"});
$("#source-language-cell").find("[language=DL]").css("background-color", "#D8D8D8");
$("#source-language-cell").find("[language="+source+"]").css({"border": "2px dashed black", "background-color": "#D8D8D8"});
}
}

$("#translate").on("click", function() {
translate();
});
Expand All @@ -51,12 +61,3 @@ $(".source-languages").on("click", function() {
let sourcelang = $(this).attr("language");
let targetlang = $("#selected-target").attr("language");
});

$(".target-languages").on("click", function() {
$(".target-languages").css("background-color", "");
$(".target-languages").attr("id", "");
$(this).css("background-color", "#D8D8D8");
$(this).attr("id", "selected-target");
let sourcelang = $("#selected-source").attr("language");
let targetlang = $(this).attr("language");
});

0 comments on commit b0a4d6f

Please sign in to comment.