diff --git a/ner-edith.js b/ner-edith.js index 58f8756..d36a5f2 100644 --- a/ner-edith.js +++ b/ner-edith.js @@ -23,30 +23,27 @@ var urls = null; function setupInterface(data, file) { - function updateTable() { - - let editable_html = - ` - - `; + function updatePreview(nRow) { - $('#table-body').empty(); + if (urls == null) return; - function gotoLocation(evt) { - if (urls != null) { + let img_url = urls.data[data.data[nRow]['url_id']]['url'] - let nRow = parseInt($(evt.target).text()); + console.log(img_url); - let img_url = urls.data[data.data[nRow]['url_id']]['url'] + $("#preview").attr("src", img_url); + $("#preview-link").attr("href", img_url); + } - console.log(img_url); + function gotoLocation(evt) { - $("#preview").attr("src", img_url); - $("#preview-link").attr("href", img_url); + if (urls != null) { - return; - } + let nRow = parseInt($(evt.target).text()); + updatePreview(nRow) + } + else { let url_mapping_html = `
@@ -60,6 +57,7 @@ function setupInterface(data, file) { $("#tableregion").html(url_mapping_html); $("#btn-region").empty(); + $("#region-right").empty(); $('#goback').on('click', function(evt) { @@ -78,6 +76,16 @@ function setupInterface(data, file) { } ); } + } + + function updateTable() { + + let editable_html = + ` + + `; + + $('#table-body').empty(); $.each(data.data, function(nRow, el) { @@ -116,8 +124,43 @@ function setupInterface(data, file) { $("#table td:contains('I-TODO')").addClass('ner_todo'); $(".offset").on('click', gotoLocation); + + updatePreview(startIndex) + + if ($("#docpos").val() != startIndex) { + + $("#docpos").val(data.data.length - startIndex); + } } + let slider_pos = data.data.length - startIndex; + let slider_min = displayRows; + let slider_max = data.data.length; + + let range_html = + ` + + `; + + $("#region-right").html(range_html) + + $("#docpos").change( + function(evt) { + + if (startIndex == data.data.length - this.value) return; + + startIndex = data.data.length - this.value; + endIndex = startIndex + displayRows; + + console.log(startIndex); + + updateTable(); + }); + + $('#docpos').slider(); + let table_html = ` diff --git a/ner.edith.html b/ner.edith.html index db2a200..05cd511 100644 --- a/ner.edith.html +++ b/ner.edith.html @@ -7,6 +7,7 @@ integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> +