Commit 8fe815ba authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Variables naming, migration to Vue

parent 0220555d
......@@ -290,7 +290,7 @@ h3 {
height: 200%;
}
#conllResult {
#code_viewer {
width: 100%;
height: 100%;
resize: none;
......
......@@ -246,7 +246,7 @@ function init_navbar() {
// ==================================================================================
function tuto() {
set_ud();
app.mode = "syntax";
// Change background of selecte group
$(".group").removeClass("active");
......@@ -725,7 +725,7 @@ function download() {
}
// ==================================================================================
function one_conll() {
function show_conll() {
var data = {
request: "CONLL",
id: current_request_id,
......@@ -745,8 +745,8 @@ function one_conll() {
if (conll == 'ERROR') {
direct_error("Disconnected");
} else {
$("#conllResult").html(conll);
$('#conllModal').modal('show');
$("#code_viewer").html(conll);
$('#code_modal').modal('show');
}
},
error: function(x) {
......@@ -756,13 +756,13 @@ function one_conll() {
}
// ==================================================================================
function one_code() {
$("#conllResult").html(app.code);
$('#conllModal').modal('show');
function show_code() {
$("#code_viewer").html(app.code);
$('#code_modal').modal('show');
}
// ==================================================================================
function copy_conll() {
$("#conllResult").select()
function code_copy() {
$("#code_viewer").select()
document.execCommand('copy');
}
......@@ -1010,9 +1010,9 @@ function update_group() {
// update labels of checkboxes
if (current_group == "semantics") {
set_amr();
app.mode = "semantics";
} else {
set_ud();
app.mode = "syntax";
}
// sidebar open and button visible
......@@ -1142,27 +1142,6 @@ function toggle_metadata_icon() {
}
// ==================================================================================
function set_ud() {
$("#tables").show();
$("#xpos-option").show();
$("#upos-option").show();
$("#lemma-option").show();
$("#add_feats-option").show();
$("#add_feats-label").show();
$("#export-button").show();
}
// ==================================================================================
function set_amr() {
$("#tables").hide();
$("#xpos-option").hide();
$("#upos-option").hide();
$("#lemma-option").hide();
$("#add_feats-option").hide();
$("#add_feats-label").hide();
$("#export-button").hide();
}
function common_prefix_length(s1, s2) {
var i = 0;
while (s1[i] == s2[i] && s1[i] != undefined) {
......@@ -1171,6 +1150,7 @@ function common_prefix_length(s1, s2) {
return (i);
}
// ==================================================================================
// taken from: https://rosettacode.org/wiki/Levenshtein_distance#JavaScript
function levenshtein(a, b) {
var t = [],
......
......@@ -11,6 +11,8 @@ var app = new Vue({
meta: {},
code: "",
mode: "",
},
});
......
......@@ -121,7 +121,7 @@
<button type="button" id="validation" class="btn btn-primary" style="float: right; display: none;">
Validation
</button>
<button type="button" id="tables" class="btn btn-primary" style="float: right;">
<button v-if="mode=='syntax'" type="button" id="tables" class="btn btn-primary" style="float: right;">
Relation tables
</button>
</h2>
......@@ -162,22 +162,22 @@
</div>
<p>
<label id="lemma-option">
<label v-if="mode=='syntax'">
<input type="checkbox" id="lemma-box" checked> lemma
</label>
<label id="upos-option">
<label v-if="mode=='syntax'">
&nbsp;&nbsp;
<input type="checkbox" id="upos-box" checked> upos
</label>
<label id="xpos-option">
<label v-if="mode=='syntax'">
&nbsp;&nbsp;
<input type="checkbox" id="xpos-box"> xpos
</label>
<label>
<label v-if="mode=='syntax'">
&nbsp;&nbsp;
<input type="checkbox" id="features-box" checked> features </input>
</label>
<label>
<label v-if="mode=='syntax'">
&nbsp;&nbsp;
<input type="checkbox" id="tf-wf-box"> textform/wordform </input>
<span href="" class="glyphicon glyphicon-question-sign tooltip-desc" id="tf-wf-tooltip"></span>
......@@ -200,7 +200,7 @@
<p>
<button class="btn btn-primary" id="submit-pattern" onclick="javascript:search_pattern()" style="margin-right:10px">Search</button>
<button class="btn btn-primary tooltip-desc" id="save-button" onclick="javascript:save_pattern()" style="margin-right:10px">Save</button>
<button class="btn btn-primary tooltip-desc" id="export-button" onclick="javascript:run_export()" style="margin-right:10px">Export</button>
<button class="btn btn-primary tooltip-desc" v-if="mode=='syntax'" id="export-button" onclick="javascript:run_export()" style="margin-right:10px">Export</button>
</p>
<p>
......@@ -297,10 +297,16 @@
<a v-if='doc_url != ""' class="btn btn-primary btn-sm tooltip-desc" :href="doc_url" target="_blank">Doc <span class="glyphicon glyphicon-link"></span></a>
<button type="button" id="conll-button" class="btn btn-primary btn-sm tooltip-desc" onclick="javascript:one_conll()">
<button v-if="mode=='syntax'" type="button" id="conll-button" class="btn btn-primary btn-sm tooltip-desc" onclick="javascript:show_conll()">
CoNLL
<span href="" class="glyphicon glyphicon-export"></span>
</button>
<button v-if="mode=='semantics'" type="button" id="code-button" class="btn btn-primary btn-sm tooltip-desc" onclick="javascript:show_code()">
Code
<span href="" class="glyphicon glyphicon-export"></span>
</button>
<a id="svg-link" target="_blank" href="">
<button type="button" class="btn btn-sm btn-primary tooltip-desc">
SVG
......@@ -392,15 +398,15 @@
</div>
<!-- modal for conll export -->
<div id="conllModal" class="modal">
<div id="code_modal" class="modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<button type="button" class="btn btn-primary" style="width:100%" onclick="javascript:copy_conll()">Copy in clipboard</button>
<button type="button" class="btn btn-primary" style="width:100%" onclick="javascript:code_copy()">Copy in clipboard</button>
</div>
<div class="modal-body">
<textarea id="conllResult" rows="25" readonly=""></textarea>
<textarea id="code_viewer" rows="25" readonly=""></textarea>
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment