Overview
Comment: | [fx] update: community dictionaries (draft) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | fx | comdic |
Files: | files | file ages | folders |
SHA3-256: |
92e25df2da16f8e8c6a1dda0a44acb1d |
User & Date: | olr on 2018-12-13 10:41:40 |
Other Links: | branch diff | manifest | tags |
Context
2018-12-17
| ||
15:32 | [fx] dictionaries selection (update) check-in: d784ee1493 user: olr tags: fx, comdic | |
2018-12-13
| ||
10:41 | [fx] update: community dictionaries (draft) check-in: 92e25df2da user: olr tags: fx, comdic | |
2018-12-12
| ||
11:02 | [fx] lexicon editor: ui rework -> save button always visible check-in: 46191a94a9 user: olr tags: fx, comdic | |
Changes
Modified gc_lang/fr/webext/background.js from [cd2d827524] to [963b50e25b].
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 | openConjugueurTab(); break; case "openLexiconEditor": openLexiconEditor(dParam["dictionary"]); break; case "openDictionaries": openDictionaries(); default: console.log("[background] Unknown command: " + sCommand); console.log(oRequest); } //sendResponse({response: "response from background script"}); } | > | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | openConjugueurTab(); break; case "openLexiconEditor": openLexiconEditor(dParam["dictionary"]); break; case "openDictionaries": openDictionaries(); break; default: console.log("[background] Unknown command: " + sCommand); console.log(oRequest); } //sendResponse({response: "response from background script"}); } |
︙ | ︙ | |||
285 286 287 288 289 290 291 | browser.contextMenus.create({ id: "rightClickLxgEditableNode", title: "Lexicographe (zone de texte)", contexts: ["editable"] }); browser.contextMenus.create({ id: "rightClickGCEditableNode", title: "Correction grammaticale (zone de texte)", contexts: ["editable"] }); browser.contextMenus.create({ id: "separator_editable", type: "separator", contexts: ["editable"] }); // Page browser.contextMenus.create({ id: "rightClickLxgPage", title: "Lexicographe (page)", contexts: ["all"] }); // on all parts, due to unwanted selection browser.contextMenus.create({ id: "rightClickGCPage", title: "Correction grammaticale (page)", contexts: ["all"] }); browser.contextMenus.create({ id: "separator_page", type: "separator", contexts: ["all"] }); | | > > | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | browser.contextMenus.create({ id: "rightClickLxgEditableNode", title: "Lexicographe (zone de texte)", contexts: ["editable"] }); browser.contextMenus.create({ id: "rightClickGCEditableNode", title: "Correction grammaticale (zone de texte)", contexts: ["editable"] }); browser.contextMenus.create({ id: "separator_editable", type: "separator", contexts: ["editable"] }); // Page browser.contextMenus.create({ id: "rightClickLxgPage", title: "Lexicographe (page)", contexts: ["all"] }); // on all parts, due to unwanted selection browser.contextMenus.create({ id: "rightClickGCPage", title: "Correction grammaticale (page)", contexts: ["all"] }); browser.contextMenus.create({ id: "separator_page", type: "separator", contexts: ["all"] }); // Tools browser.contextMenus.create({ id: "conjugueur_window", title: "Conjugueur [fenêtre]", contexts: ["all"] }); browser.contextMenus.create({ id: "conjugueur_tab", title: "Conjugueur [onglet]", contexts: ["all"] }); browser.contextMenus.create({ id: "dictionaries", title: "Dictionnaires", contexts: ["all"] }); browser.contextMenus.create({ id: "lexicon_editor", title: "Éditeur lexical", contexts: ["all"] }); // Rescan page browser.contextMenus.create({ id: "separator_rescan", type: "separator", contexts: ["editable"] }); browser.contextMenus.create({ id: "rescanPage", title: "Rechercher à nouveau les zones de texte", contexts: ["editable"] }); browser.contextMenus.onClicked.addListener(function (xInfo, xTab) { // xInfo = https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/contextMenus/OnClickData |
︙ | ︙ | |||
331 332 333 334 335 336 337 338 339 340 341 342 343 344 | // conjugueur case "conjugueur_window": openConjugueurWindow(); break; case "conjugueur_tab": openConjugueurTab(); break; // rescan page case "rescanPage": let xPort = dConnx.get(xTab.id); xPort.postMessage({sActionDone: "rescanPage"}); break; default: console.log("[Background] Unknown menu id: " + xInfo.menuItemId); | > > > > > > | 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | // conjugueur case "conjugueur_window": openConjugueurWindow(); break; case "conjugueur_tab": openConjugueurTab(); break; case "lexicon_editor": openLexiconEditor(); break; case "dictionaries": openDictionaries(); break; // rescan page case "rescanPage": let xPort = dConnx.get(xTab.id); xPort.postMessage({sActionDone: "rescanPage"}); break; default: console.log("[Background] Unknown menu id: " + xInfo.menuItemId); |
︙ | ︙ | |||
355 356 357 358 359 360 361 | switch (sCommand) { case "conjugueur_tab": openConjugueurTab(); break; case "conjugueur_window": openConjugueurWindow(); break; | | > > > | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | switch (sCommand) { case "conjugueur_tab": openConjugueurTab(); break; case "conjugueur_window": openConjugueurWindow(); break; case "lexicon_editor": openLexiconEditor(); break; case "dictionaries": openDictionaries(); break; } }); /* Tabs */ |
︙ | ︙ |
Modified gc_lang/fr/webext/manifest.json from [756d794e19] to [928cff8b51].
︙ | ︙ | |||
77 78 79 80 81 82 83 | ], "run_at": "document_idle" } ], "commands": { "conjugueur_tab": { | | < < | < < | | < > | > > | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ], "run_at": "document_idle" } ], "commands": { "conjugueur_tab": { "suggested_key": { "default": "Ctrl+Shift+6" }, "description": "Ouvre le conjugueur dans un onglet" }, "conjugueur_window": { "suggested_key": { "default": "Ctrl+Shift+7" }, "description": "Ouvre le conjugueur dans une fenêtre" }, "lexicon_editor": { "suggested_key": { "default": "Ctrl+Shift+8" }, "description": "Ouvre l’éditeur lexical" }, "dictionaries": { "suggested_key": { "default": "Ctrl+Shift+9" }, "description": "Ouvre le gestionnaire de dictionnaires communautaires" } }, "web_accessible_resources": [ "content_scripts/panel.css", "content_scripts/panel_tf.css", "content_scripts/panel_gc.css", |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/dictionaries.css from [70a29e3245] to [0c9b2a7354].
1 | /* | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /* CSS Document White Design par Olivier R. */ * { margin: 0; padding: 0; } img { border: none; } /* Generic classes */ .fleft { float: left; } .fright { float: right; } .center { text-align: center; } .right { text-align: right; } .left { text-align: left; } .justify { text-align: justify; } .hidden { display: none; } .clearer { clear: both; font-size: 0; height: 0; } body { background: hsl(0, 0%, 100%) url(../img/lines.png); font: normal 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; color: #505050; } .inbox { width: 800px; margin: 20px auto 10px auto; padding: 10px 30px 30px 30px; background: hsl(0, 0%, 100%); border: 2px solid hsl(210, 0%, 90%); border-radius: 20px; } h1 { margin: 5px 0 5px 0; color: hsl(210, 50%, 50%); font: bold 30px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; text-align: center; } h2 { margin: 5px 0 2px 0; color: hsl(0, 50%, 50%); font: bold 20px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; } h3 { margin: 3px 0 2px 0; color: hsl(210, 50%, 50%); font: bold 16px "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; } /* Main buttons */ .columns { display: flex; } ul { margin-left: 30px; } input[type=text].large { display: inline-block; width: 250px; padding: 5px 10px; border: 2px solid hsl(0, 0%, 80%); border-radius: 3px; height: 24px; background: transparent; font: normal 20px Tahoma, "Ubuntu Condensed"; color: hsl(0, 0%, 20%); } input[type=text].medium { display: inline-block; width: 175px; padding: 2px 5px; border: 2px solid hsl(0, 0%, 80%); border-radius: 3px; height: 20px; background: transparent; font: normal 18px Tahoma, "Ubuntu Condensed"; color: hsl(0, 0%, 20%); } input[placeholder] { color: hsl(0, 0%, 50%); } /* Table */ #wait_progress { width: 100%; height: 4px; } table { border: 1px solid hsl(210, 10%, 50%); width: 100%; } th { padding: 5px 10px; border-left: 1px solid hsl(210, 10%, 90%); text-align: left; } td { padding: 0 10px; vertical-align: top; } .delete_entry { cursor: pointer; font-weight: bold; color: hsl(0, 100%, 50%); } .select_entry { cursor: pointer; background-color: hsl(120, 50%, 30%); color: hsl(120, 50%, 100%); border-radius: 3px; text-align: center; } |
Modified gc_lang/fr/webext/panel/dictionaries.html from [7c18aaae72] to [3adf55a33c].
︙ | ︙ | |||
8 9 10 11 12 13 14 | <body> <div class="inbox"> <h1>Dictionnaires communautaires</h1> | < | < | < < < < > | | < < < < < < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <body> <div class="inbox"> <h1>Dictionnaires communautaires</h1> <h2>Dictionnaires sélectionnés</h2> <p id="dictionaries_list">[Aucun]<p> <h2>Dictionnaires disponibles sur le serveur de Grammalecte</h2> <progress id="wait_progress" value="0"></progress> <table id="dictionaries_table"> </table> </div> <script src="../grammalecte/graphspell/helpers.js"></script> <script src="../grammalecte/graphspell/char_player.js"></script> <script src="../grammalecte/graphspell/str_transform.js"></script> <script src="../grammalecte/graphspell/ibdawg.js"></script> <script src="../grammalecte/graphspell/spellchecker.js"></script> <script src="dictionaries.js"></script> </body> </html> |
Modified gc_lang/fr/webext/panel/dictionaries.js from [0a699fc4f2] to [c2ba6f2836].
1 2 3 4 | // JavaScript "use strict"; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | // JavaScript "use strict"; // Chrome don’t follow the W3C specification: // https://browserext.github.io/browserext/ let bChrome = false; if (typeof(browser) !== "object") { var browser = chrome; bChrome = true; } /* Common functions */ function showError (e) { console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } function createNode (sType, oAttr, oDataset=null) { try { let xNode = document.createElement(sType); Object.assign(xNode, oAttr); if (oDataset) { Object.assign(xNode.dataset, oDataset); } return xNode; } catch (e) { showError(e); } } class Table { constructor (sNodeId, lColumn, sProgressBarId, sResultId="", bDeleteButtons=true, bActionButtons) { this.sNodeId = sNodeId; this.xTable = document.getElementById(sNodeId); this.nColumn = lColumn.length; this.lColumn = lColumn; this.xProgressBar = document.getElementById(sProgressBarId); this.xNumEntry = document.getElementById(sResultId); this.iEntryIndex = 0; this.lEntry = []; this.nEntry = 0; this.bDeleteButtons = bDeleteButtons; this.bActionButtons = bActionButtons; this._createHeader(); this.listen(); } _createHeader () { let xRowNode = createNode("tr"); if (this.bDeleteButtons) { xRowNode.appendChild(createNode("th", { textContent: "·", width: "12px" })); } for (let sColumn of this.lColumn) { xRowNode.appendChild(createNode("th", { textContent: sColumn })); } this.xTable.appendChild(xRowNode); } clear () { while (this.xTable.firstChild) { this.xTable.removeChild(this.xTable.firstChild); } this.lEntry = []; this.nEntry = 0; this.iEntryIndex = 0; this._createHeader(); this.showEntryNumber(); } fill (lFlex) { this.clear(); if (lFlex.length > 0) { this.xProgressBar.max = lFlex.length; this.xProgressBar.value = 1; for (let lData of lFlex) { this._addRow(lData); this.xProgressBar.value += 1; } this.xProgressBar.value = this.xProgressBar.max; } this.lEntry = lFlex; this.nEntry = lFlex.length; this.showEntryNumber(); } addEntries (lFlex) { this.lEntry.push(...lFlex); for (let lData of lFlex) { this._addRow(lData); } this.nEntry += lFlex.length; this.showEntryNumber(); } showEntryNumber () { if (this.xNumEntry) { this.xNumEntry.textContent = this.nEntry; } } _addRow (lData) { let xRowNode = createNode("tr", { id: this.sNodeId + "_row_" + this.iEntryIndex }); if (this.bDeleteButtons) { xRowNode.appendChild(createNode("td", { textContent: "×", className: "delete_entry", title: "Effacer cette entrée" }, { id_entry: this.iEntryIndex })); } for (let data of lData) { xRowNode.appendChild(createNode("td", { textContent: data })); } if (this.bActionButtons) { xRowNode.appendChild(createNode("td", { textContent: "+", className: "select_entry", title: "Sélectionner/Désélectionner cette entrée" }, { id_entry: this.iEntryIndex })); } this.xTable.appendChild(xRowNode); this.iEntryIndex += 1; } listen () { if (this.bDeleteButtons || this.bActionButtons) { this.xTable.addEventListener("click", (xEvent) => { this.onTableClick(xEvent); }, false); } } onTableClick (xEvent) { try { let xElem = xEvent.target; if (xElem.className) { switch (xElem.className) { case "delete_entry": this.deleteRow(xElem.dataset.id_entry); break; case "select_entry": this.selectEntry(xElem.dataset.id_entry); break; } } } catch (e) { showError(e); } } deleteRow (iEntry) { this.lEntry[parseInt(iEntry)] = null; if (document.getElementById(this.sNodeId + "_row_" + iEntry)) { document.getElementById(this.sNodeId + "_row_" + iEntry).style.display = "none"; } this.nEntry -= 1; this.showEntryNumber(); if (this.sNodeId == "lexicon_table") { showElement("save_button", "inline-block"); } } selectEntry (iEntry) { let sRowId = this.sNodeId + "_row_" + iEntry; document.getElementById(sRowId).style.backgroundColor = "hsl(120, 50%, 90%)"; } getEntries () { return this.lEntry.filter((e) => e !== null); } } const oDicTable = new Table("dictionaries_table", ["Nom", "Créé par", "Entrées", "Description"], "wait_progress", "", false, true); oDicTable.fill([ ["Ambre", "Inconnu", "240", "Univers des Princes d’Ambre (de Roger Zelazny)"], ["Malaz", "Inconnu", "2340", "Univers du Livre des Martyrs (de Steven Erikson)"], ["Pudlard", "Inconnu", "1440", "Univers d’Harry Potter de XXXX"], ["Dune", "Inconnu", "2359", "Univers de Dune (de Frank Herbert)"], ["StarWars", "Inconnu", "4359", "Univers de Star Wars (de George Lucas)"] ]); |
Modified gc_lang/fr/webext/panel/lex_editor.js from [3aa49a5401] to [e8232416a9].
︙ | ︙ | |||
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 | this.sName = sName; let oJSON = oDictHandler.getDictionary(sName); if (oJSON) { this.parseDict(oJSON); } else { oLexiconTable.clear(); this.setDictData(0, "[néant]"); } }, parseDict: function (oJSON) { try { this.oIBDAWG = new IBDAWG(oJSON); } catch (e) { console.error(e); this.setDictData(0, "#Erreur. Voir la console."); return; } let lEntry = []; for (let aRes of this.oIBDAWG.select()) { lEntry.push(aRes); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); }, import: function () { let xInput = document.getElementById("import_input"); let xFile = xInput.files[0]; let xURL = URL.createObjectURL(xFile); let sJSON = helpers.loadFile(xURL); | > > | 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 | this.sName = sName; let oJSON = oDictHandler.getDictionary(sName); if (oJSON) { this.parseDict(oJSON); } else { oLexiconTable.clear(); this.setDictData(0, "[néant]"); hideElement("save_button"); } }, parseDict: function (oJSON) { try { this.oIBDAWG = new IBDAWG(oJSON); } catch (e) { console.error(e); this.setDictData(0, "#Erreur. Voir la console."); return; } let lEntry = []; for (let aRes of this.oIBDAWG.select()) { lEntry.push(aRes); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); hideElement("save_button"); }, import: function () { let xInput = document.getElementById("import_input"); let xFile = xInput.files[0]; let xURL = URL.createObjectURL(xFile); let sJSON = helpers.loadFile(xURL); |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/main.html from [1b3aaac6d0] to [05a014ebfd].
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | <h2>Raccourcis clavier</h2> <p class="shortcut">CTRL+MAJ+6</p> <p class="shortcut_label">Conjugueur (dans un onglet)</p> <p class="shortcut">CTRL+MAJ+7</p> <p class="shortcut_label">Conjugueur (dans une fenêtre)</p> <p class="shortcut">CTRL+MAJ+8</p> <p class="shortcut_label">Éditeur lexical</p> </section> <!-- #ui_options_page --> <section id="gc_options_page" class="page"> <h1>OPTIONS GRAMMATICALES</h1> <div id="grammar_options"> ${webextOptionsHTML} </div> | > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | <h2>Raccourcis clavier</h2> <p class="shortcut">CTRL+MAJ+6</p> <p class="shortcut_label">Conjugueur (dans un onglet)</p> <p class="shortcut">CTRL+MAJ+7</p> <p class="shortcut_label">Conjugueur (dans une fenêtre)</p> <p class="shortcut">CTRL+MAJ+8</p> <p class="shortcut_label">Éditeur lexical</p> <p class="shortcut">CTRL+MAJ+9</p> <p class="shortcut_label">Dictionnaires communautaires</p> </section> <!-- #ui_options_page --> <section id="gc_options_page" class="page"> <h1>OPTIONS GRAMMATICALES</h1> <div id="grammar_options"> ${webextOptionsHTML} </div> |
︙ | ︙ | |||
112 113 114 115 116 117 118 | <p><input type="checkbox" id="main_dic" data-dictionary="main" checked disabled="disabled" /> <label for="main_dic">Dictionnaire principal</label></p> <p class="option_description">Environ 83 000 entrées, 500 000 flexions.<br/>Ni éditable, ni désactivable.<br/>Ce dictionnaire est créé à partir du dictionnaire orthographique pour Firefox et LibreOffice, conçu sur le <a id="link_grammalecte" class="link" data-url="http://grammalecte.net/home.php?prj=fr">site de Grammalecte</a>.</p> </div> <div class="option_section" id="community_dic_box"> <p><input type="checkbox" id="community_dic" data-dictionary="community" /> <label for="community_dic">Dictionnaire communautaire</label></p> <p class="option_description">Ce dictionnaire est créé et édité via l’éditeur lexical et est sauvegardé sur un serveur en ligne accessible à tous les membres.</p> <div class="button_row"> | < > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | <p><input type="checkbox" id="main_dic" data-dictionary="main" checked disabled="disabled" /> <label for="main_dic">Dictionnaire principal</label></p> <p class="option_description">Environ 83 000 entrées, 500 000 flexions.<br/>Ni éditable, ni désactivable.<br/>Ce dictionnaire est créé à partir du dictionnaire orthographique pour Firefox et LibreOffice, conçu sur le <a id="link_grammalecte" class="link" data-url="http://grammalecte.net/home.php?prj=fr">site de Grammalecte</a>.</p> </div> <div class="option_section" id="community_dic_box"> <p><input type="checkbox" id="community_dic" data-dictionary="community" /> <label for="community_dic">Dictionnaire communautaire</label></p> <p class="option_description">Ce dictionnaire est créé et édité via l’éditeur lexical et est sauvegardé sur un serveur en ligne accessible à tous les membres.</p> <div class="button_row"> <div class="dic_button" id="dic_community_button">Éditer</div> <div class="dic_button" id="dictionaries_button">Dictionnaires en ligne</div> </div> </div> <div class="option_section" id="personal_dic_box"> <p><input type="checkbox" id="personal_dic" data-dictionary="personal" /> <label for="personal_dic">Dictionnaire personnel</label></p> <p class="option_description">Ce dictionnaire est créé et édité via l’éditeur lexical et n’est pas partagé.</p> <div class="button_row"> <div class="dic_button" id="dic_personal_button">Éditer</div> |
︙ | ︙ |