Overview
Comment: | [fx] update: lexicon editor |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
898b80959d1c38c3c92085bc01004032 |
User & Date: | olr on 2018-02-06 16:08:07 |
Other Links: | manifest | tags |
Context
2018-02-07
| ||
13:57 | [graphspell][bug] dawg: conversion to binary string check-in: a25340628a user: olr tags: trunk, graphspell | |
2018-02-06
| ||
16:08 | [fx] update: lexicon editor check-in: 898b80959d user: olr tags: trunk, fx | |
10:25 | [fx] lexicon editor: focus on main input check-in: 5fd6e26506 user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/panel/lex_editor.css from [d5d2b73a16] to [37248071c7].
︙ | ︙ | |||
218 219 220 221 222 223 224 | .button_block { margin: 5px 0px; background-color: hsl(210, 10%, 90%); border-radius: 5px; padding: 15px; } | | | | > | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | .button_block { margin: 5px 0px; background-color: hsl(210, 10%, 90%); border-radius: 5px; padding: 15px; } #save_button, #export_button, #import_button { display: none; float: right; padding: 2px 10px; background-color: hsl(150, 50%, 50%); color: hsl(150, 0%, 100%); border-radius: 3px; cursor: pointer; } #export_button, #import_button { display: block; margin-left: 5px; background-color: hsl(210, 50%, 50%); color: hsl(210, 0%, 100%); } #build_progress { display: none; width: 100%; } th { padding: 5px 10px; border-left: 1px solid hsl(210, 10%, 90%); text-align: left; } td { padding: 0 10px; } .delete_entry { cursor: pointer; font-weight: bold; color: hsl(0, 100%, 50%); } |
Modified gc_lang/fr/webext/panel/lex_editor.html from [13b3afd3c6] to [d6d066177a].
︙ | ︙ | |||
274 275 276 277 278 279 280 281 282 283 | <div id="save_button" class="fright"> Enregistrer </div> <h3>Lexique</h3> <p>Nombre d’entrées ajoutées : <i id="num_added_entries">0</i>.</p> <p>Nombre d’entrées supprimées : <i id="num_deleted_entries">0</i>.</p> <p>Nombre d’entrées : <i id="num_entries">0</i>.</p> <h3>Dictionnaire enregistré</h3> <p>Dernière sauvegarde : <i id="save_date">néant</i>.</p> <p>Nombre d’entrées : <i id="num_entries_saved">0</i>.</p> | > > > > > > > < < < < < < < < | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | <div id="save_button" class="fright"> Enregistrer </div> <h3>Lexique</h3> <p>Nombre d’entrées ajoutées : <i id="num_added_entries">0</i>.</p> <p>Nombre d’entrées supprimées : <i id="num_deleted_entries">0</i>.</p> <p>Nombre d’entrées : <i id="num_entries">0</i>.</p> <p><progress id="build_progress" value="0"></p> <div id="export_button" class="fright"> Exporter </div> <div id="import_button" class="fright"> Importer </div> <h3>Dictionnaire enregistré</h3> <p>Dernière sauvegarde : <i id="save_date">néant</i>.</p> <p>Nombre d’entrées : <i id="num_entries_saved">0</i>.</p> </div> <p id="no_elem_line">Aucun élément.</p> <table id="table"> |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/lex_editor.js from [20e67d8d6d] to [84567c7948].
︙ | ︙ | |||
206 207 208 209 210 211 212 | for (let [sFlexion, sLemma, sTags] of lFlex) { xTable.appendChild(this.createRowNode(n, sFlexion, sLemma, sTags)); n += 1; } } else { this.showElement("no_elem_line"); } | < | < < < < < < < < < < < < | < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | for (let [sFlexion, sLemma, sTags] of lFlex) { xTable.appendChild(this.createRowNode(n, sFlexion, sLemma, sTags)); n += 1; } } else { this.showElement("no_elem_line"); } this.updateData(); }, clearTable: function () { let xTable = document.getElementById("table"); while (xTable.firstChild) { xTable.removeChild(xTable.firstChild); } }, onTableClick: function (xEvent) { try { let xElem = xEvent.target; if (xElem.className) { if (xElem.className == "delete_entry") { this.deleteEntry(xElem.dataset.id_entry); } } } catch (e) { showError(e); } }, addEntriesToTable: function (n, lFlex) { let xTable = document.getElementById("table"); if (lFlex.length > 0) { if (document.getElementById("no_elem_line").style.display !== "none") { this.hideElement("no_elem_line"); xTable.appendChild(this.createTableHeader()); } for (let [sFlexion, sLemma, sTags] of lFlex) { xTable.appendChild(this.createRowNode(n, sFlexion, sLemma, sTags)); n += 1; } } this.updateData(); }, deleteEntry: function (iEntry) { oLexicon.deleteEntry(iEntry); this.hideElement("row_"+iEntry); this.showElement("save_button"); this.updateData(); }, updateData: function () { document.getElementById("num_added_entries").textContent = oLexicon.nAddedEntries; document.getElementById("num_deleted_entries").textContent = oLexicon.nDeletedEntries; document.getElementById("num_entries").textContent = oLexicon.nEntries; }, setDictData: function (nEntries, sDate) { document.getElementById("num_entries_saved").textContent = nEntries; document.getElementById("save_date").textContent = sDate; } } const oFlexGen = { |
︙ | ︙ | |||
487 488 489 490 491 492 493 | } const oLexicon = { lFlexion: [], | | < < | < < | < | | | | | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > > > > > > | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | } const oLexicon = { lFlexion: [], nEntries: 0, nDeletedEntries: 0, nAddedEntries: 0, load: function () { if (bChrome) { browser.storage.local.get("lexicon", this._load); return; } let xPromise = browser.storage.local.get("lexicon"); xPromise.then(this._load.bind(this), showError); }, _load: function (dResult) { if (dResult.hasOwnProperty("lexicon")) { this.lFlexion = dResult.lexicon.lEntry; oWidgets.setDictData(this.lFlexion, dResult.lexicon.sDate); oWidgets.displayTable(this.lFlexion); } if (this.lFlexion.length > 0) { oWidgets.showElement("export_button"); } else { oWidgets.hideElement("export_button"); } }, addFlexions: function (lFlex) { let n = lFlex.length; for (let aFlex of lFlex) { this.lFlexion.push(aFlex); } this.nAddedEntries += n; this.nEntries += n; oWidgets.addEntriesToTable(n, lFlex); }, deleteEntry: function (iEntry) { this.lFlexion[parseInt(iEntry)] = null; this.nDeletedEntries++; this.nEntries--; }, resetData: function () { this.nAddedEntries = 0; this.nDeletedEntries = 0; this.nEntries = this.lFlexion.length; }, save: function () { oWidgets.hideElement("save_button"); let lEntry = []; for (let e of this.lFlexion) { if (e !== null) { lEntry.push(e); } } let sDate = this._getDate(); browser.storage.local.set({ "lexicon": {"lEntry": lEntry, "sDate": sDate} }); this.lFlexion = lEntry; this.build(); this.resetData(); oWidgets.displayTable(this.lFlexion); oWidgets.updateData(); oWidgets.setDictData(lEntry.length, sDate); }, _getDate: function () { let oDate = new Date(); let sMonth = (oDate.getMonth() + 1).toString(); // Because JS always sucks somehow. if (sMonth.length == 1) sMonth = "0" + sMonth; let sDay = (oDate.getDay() < 10) ? "0"+oDate.getDay() : oDate.getDay(); return `${oDate.getFullYear()}-${sMonth}-${sDay} (${oDate.getHours()}:${oDate.getMinutes()})`; }, build: function () { oWidgets.showElement("build_progress"); let xProgressNode = document.getElementById("build_progress"); let oDAWG = new DAWG(this.lFlexion, "Français - dictionnaire personnel", "S", xProgressNode); oWidgets.hideElement("build_progress"); let lMorph = oDAWG.morph("finis"); console.log(lMorph); }, export: function () { let xBlob = new Blob(['{ "app": "grammalecte", "data": ' + JSON.stringify(this.lFlexion) + ' }'], {type: 'application/json'}); let sURL = URL.createObjectURL(xBlob); |
︙ | ︙ |
Modified graphspell-js/dawg.js from [2837f59006] to [af3f047637].
︙ | ︙ | |||
130 131 132 133 134 135 136 | // build lWord.sort(); if (xProgressBarNode) { xProgressBarNode.value = 0; xProgressBarNode.max = lWord.length; } | | < | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | // build lWord.sort(); if (xProgressBarNode) { xProgressBarNode.value = 0; xProgressBarNode.max = lWord.length; } let i = 1; for (let aEntry of lWord) { this.insert(aEntry); if (xProgressBarNode) { xProgressBarNode.value = i; i += 1; } } this.finish(); |
︙ | ︙ |