Overview
Comment: | [fx] gc panel: websites exception list for writing within page |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx |
Files: | files | file ages | folders |
SHA3-256: |
d33b55a9be857050d07f0e3f6ab60b7d |
User & Date: | olr on 2020-08-17 14:09:18 |
Other Links: | manifest | tags |
Context
2020-08-17
| ||
17:15 | [fr] ajustements check-in: b9e7b70689 user: olr tags: trunk, fr | |
14:09 | [fx] gc panel: websites exception list for writing within page check-in: d33b55a9be user: olr tags: trunk, fx | |
2020-08-16
| ||
10:33 | [fr] ajustements check-in: 1476def50f user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/config.ini from [7da15f3bb0] to [ea7393db43].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + | [args] lang = fr lang_name = French locales = fr_FR fr_BE fr_CA fr_CH fr_LU fr_BF fr_BJ fr_CD fr_CI fr_CM fr_MA fr_ML fr_MU fr_NE fr_RE fr_SN fr_TG country_default = FR name = Grammalecte implname = grammalecte # always use 3 numbers for version: x.y.z |
︙ |
Modified gc_lang/fr/webext/content_scripts/editor.js from [5de9b2b371] to [9139e703d3].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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 | + + + + + + + + + + + + + | // JavaScript // Editor for HTML page "use strict"; // Exception list var oGrammalecteExclusions = new Set([ "twitter.com" ]); var oGrammalecteMessages = { "no_text_area": "⛔ Aucun champ textuel défini. Les changements ne seront pas répercutés sur la zone d’où le texte a été extrait.", "format_warning": "❗ La zone de texte est un champ textuel enrichi. Les éléments de formatage direct (non textuels) sont susceptibles d’être effacés lors de la correction.", "excluded_site": "⛔ Renvoyer les corrections sur ce site s’avère difficile à cause des interférences possibles. La zone d’où a été extrait le texte ne sera pas modifiée. Vous pouvez copier le texte dans le presse-papiers avec le bouton 📋 ci-dessus." }; /* Text Editor */ var oGrammalecteTextEditor = { dParagraphs: new Map(), |
︙ | |||
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + | Editor for HTML page (Thunderbird or Iframe) */ class HTMLPageEditor { constructor (xWhat, xResultNode=null, bCheckSignature=true) { this.xWhat = xWhat; this.bIframe = false; this.bWrite = !oGrammalecteExclusions.has(document.location.host); //console.log(xWhat); if (xWhat.tagName && xWhat.tagName == "IFRAME") { // iframe this.xDocument = xWhat.contentWindow.document; this.bIframe = true; } else if (xWhat instanceof HTMLDocument) { |
︙ | |||
90 91 92 93 94 95 96 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + + - + + + + + | this.xResultNode = xResultNode; this.bResultInEvent = true; } this.lNode = []; this.bCheckSignature = bCheckSignature; this._lParsableNodes = ["P", "LI", "H1", "H2", "H3", "H4", "H5", "H6"]; this._lRootNodes = ["DIV", "UL", "OL"]; if (!this.bWrite) { // we don’t write back to the page |
︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | + + + | loadText (sText) { oGrammalecteTextEditor.loadText(sText); this.write(); } write () { if (!this.bWrite) { return; } for (let [i, sParagraph] of oGrammalecteTextEditor.getParagraphs()) { if (i < this.lNode.length) { this.lNode[iParagraph].textContent = sParagraph; } } } |
︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | 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 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | + - + + + - + + + + + + - - - - + + + + - | Editor for TextNode (Textarea or editable node) */ class TextNodeEditor { constructor (what, xResultNode=null) { this.xNode = null; this.bTextArea = false; this.bWrite = !oGrammalecteExclusions.has(document.location.host); this.bResultInEvent = false; // if true, the node content is not modified, but an event is dispatched on the node with the modified text this.xResultNode = null; // only useful for text analysed without node if (xResultNode instanceof HTMLElement) { this.xResultNode = xResultNode; this.bResultInEvent = true; } if (typeof(what) == "string") { // SIMPLE TEXT if (!this.xResultNode) { |
︙ | |||
268 269 270 271 272 273 274 275 276 277 278 279 280 281 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | + + + | _eraseNodeContent () { while (this.xNode.firstChild) { this.xNode.removeChild(this.xNode.firstChild); } } write () { if (!this.bWrite) { return; } if (this.xNode !== null) { if (this.bResultInEvent) { const xEvent = new CustomEvent("GrammalecteResult", { detail: JSON.stringify({ sType: "text", sText: oGrammalecteTextEditor.getText() }) }); this.xNode.dispatchEvent(xEvent); //console.log("[Grammalecte debug] Text sent to xNode via event:", xEvent.detail); } else if (this.bTextArea) { |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel.css from [a49b50b4b7] to [0ba5c9a9a4].
︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | - + - + | padding: 1px 10px; font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; font-size: 14px; font-weight: bold; text-align: center; cursor: pointer; } |
︙ | |||
211 212 213 214 215 216 217 | 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 | + + + + + - + + + + + + + + + + + | background-color: hsl(210, 40%, 82%); color: hsl(210, 20%, 30%); font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; font-size: 14px; } /* Clipboard animation */ div.grammalecte_clipboard_animation { animation: grammalecte-clipboard-animation 7s 1; |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel.js from [6b216971bf] to [01269ca544].
︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | - + | _createWaitIcon () { let xWaitIcon = oGrammalecte.createNode("div", {className: "grammalecte_spinner"}); return xWaitIcon; } _createCopyButton () { |
︙ | |||
249 250 251 252 253 254 255 256 257 258 259 260 261 262 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | + + + + + + + | this.xWaitIcon.style.visibility = "visible"; } stopWaitIcon () { this.bWorking = false; this.xWaitIcon.style.visibility = "hidden"; } highlightClipboardButton () { console.log("$$$$"); this.xClipboardButton.classList.remove("grammalecte_clipboard_animation"); this.xClipboardButton.classList.add("grammalecte_clipboard_animation"); console.log("$$$$"); } showMessage (sMessage, sActionMessage="", sActionName="") { this.xPanelMessageBlock.style.display = "block"; this.xPanelMessage.textContent = sMessage; if (sActionMessage) { this.xPanelMessageActionButton.textContent = sActionMessage; this.xPanelMessageActionButton.style.display = "block"; |
︙ |