Overview
Comment: | [fx] WebExt: ui options for buttons/menus inserted into pages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | fx | webext3 |
Files: | files | file ages | folders |
SHA3-256: |
38e8cfe68d2c944c5d2b655c652ecd2e |
User & Date: | olr on 2017-10-17 14:56:50 |
Other Links: | branch diff | manifest | tags |
Context
2017-10-17
| ||
19:01 | [fx] WebExt: update context menu picture check-in: 4b8ba24195 user: olr tags: fx, webext3 | |
14:56 | [fx] WebExt: ui options for buttons/menus inserted into pages check-in: 38e8cfe68d user: olr tags: fx, webext3 | |
2017-10-16
| ||
20:40 | [fx] WebExt: use “this” check-in: 114adc8ee9 user: olr tags: fx, webext3 | |
Changes
Modified gc_lang/fr/webext/background.js from [bec0f2d48c] to [f6d1815bfa].
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 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 | + + + + + + + + + + - + - - - - + - - - - - - - | console.log(e.data); } } catch (e) { showError(e); } }; function initUIOptions (dSavedOptions) { if (!dSavedOptions.hasOwnProperty("ui_options")) { browser.storage.local.set({"ui_options": { textarea: true, editablenode: false }}); } } function initGrammarChecker (dSavedOptions) { let dOptions = (dSavedOptions.hasOwnProperty("gc_options")) ? dSavedOptions.gc_options : null; xGCEWorker.postMessage({ sCommand: "init", dParam: {sExtensionPath: browser.extension.getURL(""), dOptions: dOptions, sContext: "Firefox"}, dInfo: {} }); } function init () { if (bChrome) { browser.storage.local.get("gc_options", initGrammarChecker); browser.storage.local.get("ui_options", initUIOptions); return; } |
︙ |
Modified gc_lang/fr/webext/content_scripts/init.js from [bcc9b2fa7e] to [f35577f091].
︙ | |||
61 62 63 64 65 66 67 | 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 | + + + + + + - - - - - - - + + + + + + + + + + + - - + - - - - - + + + + + + - | }, clearRightClickedNode: function () { this.xRightClickedNode = null; }, createMenus: function () { if (bChrome) { browser.storage.local.get("ui_options", this._createMenus.bind(this)); return; } browser.storage.local.get("ui_options").then(this._createMenus.bind(this), showError); }, |
︙ | |||
285 286 287 288 289 290 291 | 294 295 296 297 298 299 300 | - | /* Start */ oGrammalecte.listenRightClick(); oGrammalecte.createMenus(); |
Modified gc_lang/fr/webext/panel/main.css from [4ea20bf8f5] to [f3d95db8cd].
︙ | |||
151 152 153 154 155 156 157 | 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 178 179 | - + - + + - + - + | border-top: 1px solid hsl(210, 20%, 88%); font-size: 14px; } /* Help */ |
︙ | |||
228 229 230 231 232 233 234 | 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 | + + + + + - + - + - + | #dictionaries_info { margin: 10px 0; padding: 10px; border-radius: 3px; background-color: hsl(0, 50%, 40%); color: hsl(0, 10%, 96%); } /* Options */ |
︙ |
Modified gc_lang/fr/webext/panel/main.html from [fa3b6b6a69] to [c86119170f].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - + | <header id="menu"> <nav> <header id="logo"> <img src="../img/logo-32.png"> </header> <ul> <li class="select" data-page="home_page"><i class="select fa fa-star icon" data-page="home_page"></i></li> |
︙ | |||
46 47 48 49 50 51 52 | 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 | - + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + - + - + - + - + - + - + - + - + | <p class="center"><img id="link_sponsor2" class="link border" src="../img/Algoo_logo.png" alt="Algoo" data-url="https://www.algoo.fr/?from=grammalecte-fx" /></p> <p id="link_othersponsors" class="link center" data-url="http://grammalecte.net/?thanks"> et tous ceux qui l’ont soutenu </p> </div> </section> <!-- #home_page --> |
︙ |
Modified gc_lang/fr/webext/panel/main.js from [4bafd8a9dd] to [499d5a46ec].
︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | + + + | } else if (xElem.id.startsWith("option_")) { browser.runtime.sendMessage({ sCommand: "setOption", dParam: {sOptName: xElem.dataset.option, bValue: xElem.checked}, dInfo: {} }); } else if (xElem.id.startsWith("ui_option_")) { storeUIOptions(); } else if (xElem.id.startsWith("link_")) { browser.tabs.create({url: xElem.dataset.url}); } } else if (xElem.className.startsWith("select")) { showPage(xElem.dataset.page); }/* else if (xElem.tagName === "A") { |
︙ | |||
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 | 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 178 179 180 181 182 183 184 185 186 187 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | xNodePage.style.display = "none"; } // show the selected one document.getElementById(sPageName).style.display = "block"; if (sPageName == "gc_options_page") { setGCOptionsFromStorage(); } else if (sPageName == "ui_options_page") { setUIOptionsFromStorage(); } } catch (e) { showError(e); } } function showTestResult (sText) { document.getElementById("tests_result").textContent = sText; } /* UI options */ function setUIOptionsFromStorage () { if (bChrome) { browser.storage.local.get("ui_options", setUIOptions); return; } let xPromise = browser.storage.local.get("ui_options"); xPromise.then(setUIOptions, showError); } function setUIOptions (dOptions) { if (!dOptions.hasOwnProperty("ui_options")) { console.log("no ui options found"); return; } dOptions = dOptions.ui_options; for (let sOpt in dOptions) { if (document.getElementById("ui_option_"+sOpt)) { document.getElementById("ui_option_"+sOpt).checked = dOptions[sOpt]; } } } function storeUIOptions () { browser.storage.local.set({"ui_options": { textarea: ui_option_textarea.checked, editablenode: ui_option_editablenode.checked }}); } /* GC options */ function setGCOptionsFromStorage () { if (bChrome) { browser.storage.local.get("gc_options", _setGCOptions); return; } let xPromise = browser.storage.local.get("gc_options"); xPromise.then(_setGCOptions, showError); |
︙ |