Overview
Comment: | [fx] buttons to stop and restart the worker |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
7bf95d9332c59248aa8c7039e4f67ae7 |
User & Date: | olr on 2019-08-10 10:56:05 |
Other Links: | manifest | tags |
Context
2019-08-10
| ||
11:08 | [fr] version 1.3 check-in: e13493c3a8 user: olr tags: trunk, fr | |
10:56 | [fx] buttons to stop and restart the worker check-in: 7bf95d9332 user: olr tags: trunk, fx | |
2019-08-09
| ||
10:02 | [fx] new initialization for background and worker check-in: 0d2811ed48 user: olr tags: trunk, fx | |
Changes
Modified gc_lang/fr/webext/background.js from [3a97c6e44a] to [3876ecdef9].
︙ | |||
89 90 91 92 93 94 95 | 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 | - - + + + + + | }, getTimeSinceLastResponse: function () { // result in seconds return Math.floor((Date.now() - this.nLastTimeWorkerResponse) / 1000); }, |
︙ | |||
243 244 245 246 247 248 249 250 251 252 253 254 255 256 | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | + + + | case "resetOptions": case "textToTest": case "fullTests": case "setDictionary": case "setDictionaryOnOff": oWorkerHandler.xGCEWorker.postMessage(oRequest); break; case "restartWorker": oWorkerHandler.restart(dParam["nDelayLimit"]); break; case "openURL": browser.tabs.create({url: dParam.sURL}); break; case "openConjugueurTab": openConjugueurTab(); break; case "openLexiconEditor": |
︙ | |||
282 283 284 285 286 287 288 289 290 291 292 293 294 295 | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | + + + | case "parseFull": case "getListOfTokens": case "getSpellSuggestions": case "getVerb": oRequest.dInfo.iReturnPort = iPortId; // we pass the id of the return port to receive answer oWorkerHandler.xGCEWorker.postMessage(oRequest); break; case "restartWorker": oWorkerHandler.restart(dParam["nDelayLimit"]); break; case "openURL": browser.tabs.create({url: dParam.sURL}); break; case "openConjugueurTab": openConjugueurTab(); break; case "openConjugueurWindow": |
︙ | |||
438 439 440 441 442 443 444 445 446 447 448 449 450 451 | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | + + + + + + | browser.tabs.query({ currentWindow: true, active: true }).then((lTabs) => { for (let xTab of lTabs) { console.log(xTab); browser.tabs.sendMessage(xTab.id, {sActionRequest: sCommand}); } }, showError); } function sendCommandToAllTabs (sCommand) { for (let [iTab, xTabPort] of dConnx.entries()) { xTabPort.postMessage({sActionDone: sCommand, result: null, dInfo: null, bEnd: false, bError: false}); } } function openLexiconEditor (sName="__personal__") { if (nTabLexiconEditor === null) { if (bChrome) { browser.tabs.create({ url: browser.extension.getURL("panel/lex_editor.html") }, onLexiconEditorOpened); |
︙ |
Modified gc_lang/fr/webext/content_scripts/init.js from [7c53e8429c] to [ac4bcaf91a].
︙ | |||
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | + + + + + + | oGrammalecte.observePage(); break; case "parseAndSpellcheck": if (!bEnd) { oGrammalecte.oGCPanel.addParagraphResult(result); } else { oGrammalecte.oGCPanel.stopWaitIcon(); oGrammalecte.oGCPanel.endTimer(); } break; case "parseAndSpellcheck1": oGrammalecte.oGCPanel.refreshParagraph(dInfo.sParagraphId, result); break; case "parseFull": // TODO break; case "getListOfTokens": if (!bEnd) { oGrammalecte.oGCPanel.addListOfTokens(result); } else { oGrammalecte.oGCPanel.stopWaitIcon(); oGrammalecte.oGCPanel.endTimer(); } break; case "getSpellSuggestions": oGrammalecte.oGCPanel.oTooltip.setSpellSuggestionsFor(result.sWord, result.aSugg, result.iSuggBlock, dInfo.sErrorId); break; case "getVerb": if (dInfo.bStart) { oGrammalecte.oGCPanel.conjugateWith(result.oVerb, result.oConjTable); } else { oGrammalecte.oGCPanel.displayConj(result.oConjTable); } break; case "workerRestarted": oGrammalecte.oGCPanel.stopWaitIcon(); oGrammalecte.oGCPanel.showMessage("Le serveur grammatical a été arrêté et relancé."); break; /* Commands received from the context menu (Context menu are initialized in background) */ // Grammar checker commands case "grammar_checker_editable": if (oGrammalecte.xRightClickedNode !== null) { |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel.css from [f3523dcadb] to [20920fbe90].
︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | + + + + + + + + + + + + + + | border-top: 2px solid; border-bottom: 2px solid; border-color: hsl(60, 90%, 50%); color: hsl(60, 10%, 40%); font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; font-size: 14px; hyphens: auto; } div#grammalecte_panel_message_action_button { margin: 10px; padding: 4px 10px; border-radius: 5px; background-color: hsl(30, 100%, 50%); color: hsl(30, 60%, 95%); font-size: 14px; font-weight: bold; cursor: pointer; } div#grammalecte_panel_message_close_button:hover { background-color: hsl(0, 100%, 60%); color: hsl(0, 50%, 100%); } div#grammalecte_panel_message_close_button { float: right; margin: 0 0 10px 10px; padding: 2px 5px; border-radius: 5px; background-color: hsl(60, 90%, 50%); |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel.js from [89f0e2b95b] to [dcdee26109].
︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | + + | _createMesssageBlock () { this.xPanelMessageBlock = oGrammalecte.createNode("div", {id: "grammalecte_panel_message_block"}); let xPanelMessageCloseButton = oGrammalecte.createNode("div", {id: "grammalecte_panel_message_close_button", textContent: "×"}); xPanelMessageCloseButton.onclick = () => { this.hideMessage() }; this.xPanelMessageBlock.appendChild(xPanelMessageCloseButton); this.xPanelMessage = oGrammalecte.createNode("div", {id: "grammalecte_panel_message"}); this.xPanelMessageActionButton = oGrammalecte.createNode("div", {id: "grammalecte_panel_message_action_button"}); this.xPanelMessageBlock.appendChild(this.xPanelMessage); this.xPanelMessageBlock.appendChild(this.xPanelMessageActionButton); } insertIntoPage () { if (this.bShadow) { oGrammalecte.createStyle("content_scripts/panel.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_gc.css", null, this.xShadow); oGrammalecte.createStyle("content_scripts/panel_lxg.css", null, this.xShadow); |
︙ | |||
245 246 247 248 249 250 251 | 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 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | - + + + + + + + + + + + + + + + + + + + + + + + + + + | } stopWaitIcon () { this.bWorking = false; this.xWaitIcon.style.visibility = "hidden"; } |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [da6d34e941] to [40afa5917c].
︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | + | this.xGCPanelContent.appendChild(this.xParagraphList); this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false); this.oTooltip = new GrammalecteTooltip(this.xParent, this.xGCPanelContent); this.xPanelContent.appendChild(this.xGCPanelContent); this.xNode = null; this.oTextControl = new GrammalecteTextControl(); this.bAutoRefresh = false; this.nLastResult = 0 // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xPanelContent.appendChild(this.xLxgPanelContent); // Conjugueur this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"}); this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML; // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in <content_scripts/html_src.js> |
︙ | |||
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 | 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 | + + | } start (what) { this.oTooltip.hide(); this.bWorking = false; this.clear(); this.hideMessage(); this.resetTimer(); if (typeof(what) === "string") { // text this.xNode = null; this.oTextControl.setText(what); } else if (what.nodeType && what.nodeType === 1) { // node this.xNode = what; this.oTextControl.setNode(this.xNode); } else { // error oGrammalecte.oMessageBox.showMessage("[BUG] Analyse d’un élément inconnu…"); console.log("Grammalecte [bug]:", what); } } recheckAll () { this.oTooltip.hide(); this.showEditor(); this.clear(); this.startWaitIcon(); this.resetTimer(); xGrammalectePort.postMessage({ sCommand: "parseAndSpellcheck", dParam: {sText: this.oTextControl.getText(), sCountry: "FR", bDebug: false, bContext: false}, dInfo: ((this.xNode) ? {sTextAreaId: this.xNode.id} : {}) }); } |
︙ | |||
216 217 218 219 220 221 222 223 224 225 226 227 228 229 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | + | oGrammalecte.clearRightClickedNode(); this.xPanel.style.display = "none"; this.oTextControl.clear(); } addParagraphResult (oResult) { try { this.resetTimer(); if (oResult && (oResult.sParagraph.trim() !== "" || oResult.aGrammErr.length > 0 || oResult.aSpellErr.length > 0)) { let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_paragraph_block"}); // actions let xActionsBar = oGrammalecte.createNode("div", {className: "grammalecte_paragraph_actions"}); xActionsBar.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_check" + oResult.iParaNum, className: "grammalecte_paragraph_button grammalecte_green", textContent: "↻", title: "Réanalyser…"}, {para_num: oResult.iParaNum})); xActionsBar.appendChild(oGrammalecte.createNode("div", {id: "grammalecte_hide" + oResult.iParaNum, className: "grammalecte_paragraph_button grammalecte_red", textContent: "×", title: "Cacher", style: "font-weight: bold;"})); // paragraph |
︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | + + + + + + + + + + + + + + + + | this.xParagraphList.appendChild(xNodeDiv); } } catch (e) { showError(e); } } resetTimer () { this.nLastResult = Date.now(); window.clearTimeout(this.nTimer); this.nTimer = window.setTimeout( oGrammalecte.oGCPanel.showMessage.bind(this), 5000, "Le serveur grammatical semble ne plus répondre.", "Arrêter et relancer le serveur grammatical.", "restartWorker" ); } endTimer () { window.clearTimeout(this.nTimer); } recheckParagraph (iParaNum) { let sParagraphId = "grammalecte_paragraph" + iParaNum; let xParagraph = this.xParent.getElementById(sParagraphId); this.blockParagraph(xParagraph); let sText = this.purgeText(xParagraph.textContent); xGrammalectePort.postMessage({ |
︙ |
Modified gc_lang/fr/webext/panel/main.html from [f78802d907] to [a554c7efb8].
︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | + | </div> </section> <!-- #sc_options_page --> <section id="test_page" class="page"> <div id="test_cmd"> <h1>ZONE DE TEST</h1> <p>Section de contrôle pour le développement du logiciel…</p> <div id="restart_worker" class="button blue fright">Redémarrer le worker</div> <p id="link_testpage" class="link" data-url="https://grammalecte.net/test.html">Page de test</p> <textarea id="text_to_test" rows="10"></textarea> <div id="fulltests_button" class="button blue">Tests complets</div> <div id="text_to_test_button" class="button green fright">Analyser</div> </div> <pre id="tests_result"></pre> </section> <!-- #test_page --> |
︙ |
Modified gc_lang/fr/webext/panel/main.js from [42d1c08018] to [3c0ad50206].
︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | + + + + + + + | } else if (xElem.id == "dic_personal_button") { browser.runtime.sendMessage({ sCommand: "openLexiconEditor", dParam: { "dictionary": "__personal__"}, dInfo: {} }); } else if (xElem.id == "restart_worker") { browser.runtime.sendMessage({ sCommand: "restartWorker", dParam: { "nDelayLimit": 3 }, dInfo: {} }); } } else if (xElem.className.startsWith("select")) { showPage(xElem.dataset.page); }/* else if (xElem.tagName === "A") { openURL(xElem.getAttribute("href")); }*/ }, |
︙ |