Commit cd19e8a9 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

add buttons for “metadata” and for “svg”

parent 0dced294
......@@ -243,6 +243,11 @@ h3 {
height: 80%;
}
#export-modal {
max-height: 80%;
height: 80%;
}
#exportResult tr:nth-child(even) {
background-color: #dddddd;
}
......@@ -297,3 +302,6 @@ h3 {
transform: scale(1.8);
}
#sentence-txt {
margin-top: 0pt;
}
......@@ -139,10 +139,22 @@ $(document).ready(function() {
$('#cluster-span').hide();
}
});
});
// ==================================================================================
function fill_metadata(meta) {
if (meta.length == 0) {
$('#meta-panel').hide();
} else {
html = ""
meta.forEach(item => {
html += '<p><b>' + item.key + ' = </b>' + item.value + '</p>\n';
});
$('#metadata').html(html);
$('#meta-panel').show();
}
}
// ==================================================================================
function set_default() {
first_group = current_data["groups"][0];
......@@ -565,18 +577,24 @@ function load_cluster_file() {
$("#next-results").prop('disabled', true);
} else if (fields[0] == '<PAUSE>') {
$("#next-results").prop('disabled', false);
} else if (fields[0] == '<ITEM>') {
$("#results-list").append('<li class="item" id="list-' + result_nb + '"><a>' + fields[2] + '</a></li>');
url = './data/' + current_request_id + '/' + fields[1];
$('#list-' + result_nb).click({
url: url,
i: result_nb,
coord: fields[3],
sentence: fields[4],
audio: fields[5]
}, display_picture);
result_nb++;
update_progress_num();
} else {
try {
var obj = JSON.parse(lines[i]);
$("#results-list").append('<li class="item" id="list-' + result_nb + '"><a>' + obj.sent_id + '</a></li>');
url = './data/' + current_request_id + '/' + obj.filename;
$('#list-' + result_nb).click({
url: url,
i: result_nb,
coord: obj.shift,
sentence: obj.sentence,
audio: obj.audio,
meta: obj.meta,
}, display_picture);
result_nb++;
update_progress_num();
} catch (err) {
console.log("Ignore line: " + i);
}
}
}
update_view();
......@@ -612,6 +630,10 @@ function display_picture(event) {
}, "fast");
current_view = event.data.i;
fill_metadata(event.data.meta);
$("#svg-link").attr("href", event.data.url);
update_progress_num();
}
......@@ -1086,6 +1108,18 @@ function toggle_folder_icon(arg) {
}
}
// ==================================================================================
function toggle_metadata_icon() {
let icon = $("#md-icon");
if ($("#md").hasClass("collapsed")) {
icon.removeClass("glyphicon-chevron-right");
icon.addClass("glyphicon-chevron-down");
} else {
icon.removeClass("glyphicon-chevron-down");
icon.addClass("glyphicon-chevron-right");
}
}
// ==================================================================================
function set_ud() {
$("#tables").show();
......
......@@ -212,17 +212,13 @@
<div class="row">
<div class="col-md-3">
<div id="results-navig">
<button class="btn btn-primary btn-results" id="next-results" onclick="javascript:next_results()">Get more results</button>
<button class="btn btn-primary btn-results" id="next-results" onclick="javascript:next_results()">More results</button>
<br />
<button class="btn btn-primary btn-results" onclick="javascript:first_svg()"></button>
<button class="btn btn-primary btn-results" onclick="javascript:previous_svg()"></button>
<span class="btn-results" style="font-size: 150%" id="progress-num"></span>
<button class="btn btn-primary btn-results" onclick="javascript:next_svg()"></button>
<button class="btn btn-primary btn-results" onclick="javascript:last_svg()"></button>
<button type="button" id="conll-button" class="btn btn-primary tooltip-desc" onclick="javascript:one_conll()" style="float: right;">
CoNLL
<span href="" class="glyphicon glyphicon-export"></span>
</button>
<ul id="results-list"></ul>
</div>
</div>
......@@ -268,6 +264,36 @@
<div id="display-sentence" style="display: none;">
<div id="passage-text" class="passage">
<div id="meta-panel" class="panel panel-default" style="margin-bottom:4px;">
<a id="md" onclick="toggle_metadata_icon()" data-toggle="collapse" href="#collapse1" class="collapsed">
<button class="btn btn-primary btn-sm">Metadata
<span id="md-icon" class="glyphicon glyphicon-chevron-right"> </span>
</button>
</a>
<button type="button" id="conll-button" class="btn btn-primary btn-sm tooltip-desc" onclick="javascript:one_conll()">
CoNLL
<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
<span href="" class="glyphicon glyphicon-export"></span>
</button>
</a>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div id="metadata" class="panel-body">
</div>
</div>
<h4 id="sentence-txt"></h4>
</div>
</div>
......@@ -342,17 +368,17 @@
</div>
</div>
<!-- modal for conll export -->
<div id="conllModal" 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>
</div>
<div class="modal-body">
<textarea id="conllResult" rows="25" readonly="" />
</div>
<!-- modal for conll export -->
<div id="conllModal" 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>
</div>
<div class="modal-body">
<textarea id="conllResult" rows="25" readonly="" />
</div>
</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