@@ -25,6 +25,8 @@ var $newProjectAndClearAll = $('#newProjectAndClearAll'),
25
25
$buttonSaveTerms = $ ( '#button-save-terms' ) ,
26
26
$buttonSaveNer = $ ( '#button-save-ner' ) ,
27
27
$buttonSaveProjectFileList = $ ( '#button-save-project-file-list' ) ,
28
+ $buttonSaveAlltermsXml = $ ( '#button-save-allterms-xml' ) ,
29
+ $buttonSaveParceXml = $ ( '#button-save-parce-xml' ) ,
28
30
$upload_button = $ ( '#upload-button' ) ,
29
31
$sents_from_text = $ ( '#sents_from_text' ) ,
30
32
$sortSelect = $ ( '#sort-select' ) ;
@@ -229,6 +231,35 @@ $recapOverviewButton.change(function () {
229
231
$textContent . text ( '' ) ;
230
232
} ) ;
231
233
234
+ $buttonSaveAlltermsXml . click ( function ( ) {
235
+ if ( localStorage . getItem ( "alltermsxml-for-last-file" ) ) {
236
+ downloadLink = document . createElement ( "a" ) ;
237
+ // Make sure that the link is not displayed
238
+ downloadLink . style . display = "none" ;
239
+ // Add the link to your DOM
240
+ document . body . appendChild ( downloadLink ) ;
241
+ let blob = new Blob ( [ localStorage . getItem ( "alltermsxml-for-last-file" ) ] , { type : "octet/stream" } ) ,
242
+ url = window . URL . createObjectURL ( blob ) ;
243
+ downloadLink . href = url ;
244
+ downloadLink . download = 'allterms.xml' ;
245
+ downloadLink . click ( ) ;
246
+ }
247
+ } )
248
+
249
+ $buttonSaveParceXml . click ( function ( ) {
250
+ if ( localStorage . getItem ( "parcexml-for-last-file" ) ) {
251
+ downloadLink = document . createElement ( "a" ) ;
252
+ // Make sure that the link is not displayed
253
+ downloadLink . style . display = "none" ;
254
+ // Add the link to your DOM
255
+ document . body . appendChild ( downloadLink ) ;
256
+ let blob = new Blob ( [ localStorage . getItem ( "parcexml-for-last-file" ) ] , { type : "octet/stream" } ) ,
257
+ url = window . URL . createObjectURL ( blob ) ;
258
+ downloadLink . href = url ;
259
+ downloadLink . download = 'parce.xml' ;
260
+ downloadLink . click ( ) ;
261
+ }
262
+ } )
232
263
233
264
$buttonSaveTerms . click ( function ( ) {
234
265
let arrayOfValuesOfYploadResultList = $ ( "#uploadResultList option" ) . map ( function ( ) { return this . value ; } ) . get ( ) . join ( '\n' ) ,
@@ -369,6 +400,11 @@ function fetchFileToRecapService() {
369
400
// add to local storage recap of this file for #projectFileList
370
401
localStorage [ uniqueUploadFilename ] = JSON . stringify ( resJSON ) ;
371
402
403
+ // add to local storage allterms.xml of the last uploaded file
404
+ localStorage [ "alltermsxml-for-last-file" ] = result ;
405
+ // add to local storage allterms.xml of this file for #projectFileList selection
406
+ localStorage [ uniqueUploadFilename + "-alltermsxml" ] = result ;
407
+
372
408
for ( let elementKnownTxtJson of resJSON . termsintext . exporterms . term ) {
373
409
termsWithIndexDict [ elementKnownTxtJson . tname ] = resJSON . termsintext . exporterms . term . indexOf ( elementKnownTxtJson ) ; // for dictionary structure
374
410
if ( Array . isArray ( elementKnownTxtJson . sentpos ) ) {
@@ -407,6 +443,11 @@ function fetchFileToRecapService() {
407
443
dom = new DOMParser ( ) . parseFromString ( result , "text/xml" ) ;
408
444
resParceJSON = xmlToJson ( dom ) ;
409
445
446
+ // add to local storage parce.xml of the last uploaded file
447
+ localStorage [ "parcexml-for-last-file" ] = result ;
448
+ // add to local storage parce.xml of this file for #projectFileList selection
449
+ localStorage [ uniqueUploadFilename + "-parcexml" ] = result ;
450
+
410
451
for ( let sentElement of resParceJSON . text . sentence ) {
411
452
412
453
if ( sentElement . hasOwnProperty ( 'ner' ) ) {
@@ -632,6 +673,10 @@ function forProjectFileListClickAndEnterPressEvents() {
632
673
633
674
if ( localStorage . getItem ( $projectFileList . prop ( 'value' ) ) ) {
634
675
676
+ if ( localStorage . getItem ( $projectFileList . prop ( 'value' ) + "-alltermsxml" ) ) {
677
+ localStorage [ "alltermsxml-for-last-file" ] = localStorage . getItem ( $projectFileList . prop ( 'value' ) + "-alltermsxml" )
678
+ }
679
+
635
680
resJSON = JSON . parse ( localStorage . getItem ( $projectFileList . prop ( 'value' ) ) ) ;
636
681
// add to local storage recap of the last uploaded file
637
682
localStorage [ "recapForLastFile" ] = JSON . stringify ( resJSON ) ;
0 commit comments