Overview
Comment: | [fx] object Panel, movable panels |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | fx | webext2 |
Files: | files | file ages | folders |
SHA3-256: |
877eb2d93c13b3a75cb0949f3f9a8847 |
User & Date: | olr on 2017-08-13 09:57:55 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-13
| ||
10:52 | [fx] small adjustments check-in: 4be617efb4 user: olr tags: fx, webext2 | |
09:57 | [fx] object Panel, movable panels check-in: 877eb2d93c user: olr tags: fx, webext2 | |
2017-08-12
| ||
18:14 | [fx] text formatter ui + misc adjustements check-in: 8260f10330 user: olr tags: fx, webext2 | |
Changes
Modified gc_lang/fr/webext/content_scripts/content_panels.css from [57d765e57a] to [d5f576988d].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | .grammalecte_wrapper_button { display: inline-block; padding: 0 5px; margin-left: 5px; background-color: hsl(210, 50%, 60%); border-radius: 2px; cursor: pointer; } /* Panels */ .grammalecte_panel { padding: 0; margin: 0; position: fixed; | > > > > > > < < | | | | > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 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 | .grammalecte_wrapper_button { display: inline-block; padding: 0 5px; margin-left: 5px; background-color: hsl(210, 50%, 60%); border-radius: 2px; color: hsl(210, 0%, 96%); cursor: pointer; } .grammalecte_wrapper_button:hover { background-color: hsl(210, 50%, 55%); box-shadow: 0 0 1px 1px hsl(210, 50%, 20%); color: hsl(210, 0%, 100%); } /* Panels */ .grammalecte_panel { padding: 0; margin: 0; position: fixed; z-index: 100; border: 10px solid hsl(210, 0%, 0%); border-radius: 10px; background-color: hsl(210, 20%, 100%); color: hsl(210, 10%, 4%); font-family: "Trebuchet MS", "Liberation Sans", sans-serif; box-shadow: 0 0 4px 2px hsl(210, 0%, 50%); } .grammalecte_panel_bar { position: sticky; width: 100%; background-color: hsl(210, 0%, 90%); border-bottom: 1px solid hsl(210, 10%, 80%); font-size: 20px; } .grammalecte_panel_title { padding: 10px 20px; } .grammalecte_panel_label { display: inline-block; padding: 0 10px; } .grammalecte_panel_commands { float: right; } .grammalecte_move_button { display: inline-block; padding: 2px 5px; background-color: hsl(180, 80%, 50%); font-size: 22px; font-weight: bold; color: hsl(210, 0%, 100%); text-align: center; cursor: pointer; } .grammalecte_close_button { display: inline-block; padding: 2px 10px; background-color: hsl(0, 80%, 50%); font-size: 22px; font-weight: bold; color: hsl(210, 0%, 100%); text-align: center; cursor: pointer; } .grammalecte_panel_content { height: calc(100% - 45px); /* panel height - title_bar */ overflow: auto; } /* Text Formatter */ #grammalecte_tf_options { display: flex; padding: 10px; } #grammalecte_tf_options .underline:hover { background-color: hsl(210, 10%, 86%); border-radius: 2px; |
︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 147 148 149 150 151 | float: left; } #grammalecte_tf_options label { font-size: 13px; } #grammalecte_tf_options .grammalecte_tf_result { float: right; font-size: 13px; } #grammalecte_tf_actions { background-color: hsl(120, 10%, 92%); padding: 15px; border-top: 1px solid hsl(120, 20%, 86%); | > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | float: left; } #grammalecte_tf_options label { font-size: 13px; } #grammalecte_tf_options .grammalecte_tf_result { float: right; margin-right: 3px; font-size: 13px; } #grammalecte_tf_actions { background-color: hsl(120, 10%, 92%); padding: 15px; border-top: 1px solid hsl(120, 20%, 86%); |
︙ | ︙ | |||
159 160 161 162 163 164 165 | font-size: 16px; font-weight: bold; text-align: center; cursor: pointer; } #grammalecte_tf_reset { | | > > > > > > > > | | 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 | font-size: 16px; font-weight: bold; text-align: center; cursor: pointer; } #grammalecte_tf_reset { background-color: hsl(210, 100%, 50%); color: hsl(210, 0%, 100%); } #grammalecte_tf_progressbar { width: 250px; } #grammalecte_tf_time_res { width: 40px; padding: 5px 10px; width: 25px; } #grammalecte_tf_apply { background-color: hsl(150, 100%, 50%); color: hsl(150, 0%, 100%); } #grammalecte_progressbarbox { display: inline-block; padding: 10px 20px; } |
Modified gc_lang/fr/webext/content_scripts/modify_page.js from [c571bd6bb2] to [fe1ea1f90c].
︙ | ︙ | |||
11 12 13 14 15 16 17 | console.log("[Content script] Start"); let nTadId = null; let nWrapper = 0; | | | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | console.log("[Content script] Start"); let nTadId = null; let nWrapper = 0; let oConjPanel = null; let oTFPanel = null; let oLxgPanel = null; let oGCPanel = null; function showError (e) { console.error(e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } function wrapTextareas () { |
︙ | ︙ | |||
91 92 93 94 95 96 97 | catch (e) { showError(e); } } function createConjPanel () { console.log("Conjugueur"); | | | | | | | | | | > | | | | | | | < | > | 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 | catch (e) { showError(e); } } function createConjPanel () { console.log("Conjugueur"); if (oConjPanel !== null) { oConjPanel.show(); } else { // create the panel oConjPanel = new GrammalectePanel("grammalecte_conj_panel", "Conjugueur", 600, 600); oConjPanel.insertIntoPage(); } } function createTFPanel (xTextArea) { console.log("Formateur de texte"); if (oTFPanel !== null) { oTFPanel.show(); } else { // create the panel oTFPanel = new GrammalectePanel("grammalecte_tf_panel", "Formateur de texte", 800, 600, false); oTFPanel.logInnerHTML(); oTFPanel.setContent(createTextFormatter(xTextArea)); oTFPanel.insertIntoPage(); } } function createLxgPanel (xTextArea) { console.log("Lexicographe"); if (oLxgPanel !== null) { oLxgPanel.show(); } else { // create the panel oLxgPanel = new GrammalectePanel("grammalecte_lxg_panel", "Lexicographe", 500, 700); oLxgPanel.insertIntoPage(); } } function createGCPanel (oErrors) { console.log("Correction grammaticale"); if (oGCPanel !== null) { oGCPanel.show(); } else { // create the panel oGCPanel = new GrammalectePanel("grammalecte_gc_panel", "Correcteur", 500, 700); oGCPanel.setContent(document.createTextNode(JSON.stringify(oErrors))); oGCPanel.insertIntoPage(); } } /* Simple message */ |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/panel_creator.js from [dcb12b523e] to [bfa5c54a5e].
1 2 3 4 5 6 | // JavaScript // Panel creator "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 | // JavaScript // Panel creator "use strict"; console.log("[Content script] Panel creator"); class GrammalectePanel { constructor (sId, sTitle, nWidth, nHeight, bMovable=true) { this.sId = sId; this.sContentId = sId+"_content"; this.nWidth = nWidth; this.nHeight = nHeight; this.bMovable = bMovable; this.xContentNode = createNode("div", {id: this.sContentId, className: "grammalecte_panel_content"}); this.xPanelNode = this._createPanel(sTitle); this.center(); } _createPanel (sTitle) { try { let xPanel = createNode("div", {id: this.sId, className: "grammalecte_panel"}); let xBar = createNode("div", {className: "grammalecte_panel_bar"}); xBar.appendChild(this._createButtons()); let xTitle = createNode("div", {className: "grammalecte_panel_title"}); xTitle.appendChild(createLogo()); xTitle.appendChild(createNode("div", {className: "grammalecte_panel_label", textContent: "Grammalecte · " + sTitle})); xBar.appendChild(xTitle); xPanel.appendChild(xBar); //xPanel.appendChild(createNode("div", {className: "grammalecte_empty_space_under_title_bar"})); xPanel.appendChild(this.xContentNode); return xPanel; } catch (e) { showError(e); } } _createButtons () { let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"}); if (this.bMovable) { xButtonLine.appendChild(this._createMoveButtonTop()); xButtonLine.appendChild(this._createMoveButtonLeft()); xButtonLine.appendChild(this._createMoveButtonMiddle()); xButtonLine.appendChild(this._createMoveButtonRight()); xButtonLine.appendChild(this._createMoveButtonBottom()); } xButtonLine.appendChild(this._createCloseButton()); return xButtonLine; } _createMoveButtonLeft () { let xButton = createNode("div", {className: "grammalecte_move_button", textContent: "‹"}); xButton.onclick = function () { this.stickToLeft(); }.bind(this); return xButton; } _createMoveButtonMiddle () { let xButton = createNode("div", {className: "grammalecte_move_button", textContent: "·"}); xButton.onclick = function () { this.center(); }.bind(this); return xButton; } _createMoveButtonRight () { let xButton = createNode("div", {className: "grammalecte_move_button", textContent: "›"}); xButton.onclick = function () { this.stickToRight(); }.bind(this); return xButton; } _createMoveButtonTop () { let xButton = createNode("div", {className: "grammalecte_move_button", textContent: "^"}); xButton.onclick = function () { this.stickToTop(); }.bind(this); return xButton; } _createMoveButtonBottom () { let xButton = createNode("div", {className: "grammalecte_move_button", textContent: "ˇ"}); xButton.onclick = function () { this.stickToBottom(); }.bind(this); return xButton; } _createCloseButton () { let xButton = createNode("div", {className: "grammalecte_close_button", textContent: "×"}); xButton.onclick = function () { this.hide(); }.bind(this); // better than writing “let that = this;” before the function? return xButton; } setContent (xNode) { this.xContentNode.appendChild(xNode); } insertIntoPage () { document.body.appendChild(this.xPanelNode); } show () { this.xPanelNode.style.display = "block"; } hide () { this.xPanelNode.style.display = "none"; } center () { this.xPanelNode.style = `top: 50%; left: 50%; width: ${this.nWidth}px; height: ${this.nHeight}px; margin-top: -${this.nHeight/2}px; margin-left: -${this.nWidth/2}px;`; } stickToLeft () { let nHeight = window.innerHeight-100; this.xPanelNode.style = `top: 50%; left: -10px; width: ${this.nWidth}px; height: ${nHeight}px; margin-top: -${nHeight/2}px;`; } stickToRight () { let nHeight = window.innerHeight-100; this.xPanelNode.style = `top: 50%; right: -10px; width: ${this.nWidth}px; height: ${nHeight}px; margin-top: -${nHeight/2}px;`; } stickToTop () { let nWidth = Math.floor(window.innerWidth/2); this.xPanelNode.style = `top: -10px; left: 50%; width: ${nWidth}px; height: ${Math.floor(window.innerHeight*0.45)}px; margin-left: -${nWidth/2}px;`; } stickToBottom () { let nWidth = Math.floor(window.innerWidth/2); this.xPanelNode.style = `bottom: -10px; left: 50%; width: ${nWidth}px; height: ${Math.floor(window.innerHeight*0.45)}px; margin-left: -${nWidth/2}px;`; } reduce () { // todo } logInnerHTML () { // for debugging console.log(this.xPanelNode.innerHTML); } } /* Common functions */ function createNode (sType, oAttr) { |
︙ | ︙ |
Modified gc_lang/fr/webext/content_scripts/text_formatter.js from [bc3379ab0f] to [95eb537b32].
︙ | ︙ | |||
54 55 56 57 58 59 60 | xColumn2.appendChild(xMisc); xColumn2.appendChild(xStruct); xOptions.appendChild(xColumn1); xOptions.appendChild(xColumn2); // Actions let xActions = createNode("div", {id: "grammalecte_tf_actions"}); xActions.appendChild(createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_button", style: "background-color: hsl(210, 50%, 50%)"})); | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | xColumn2.appendChild(xMisc); xColumn2.appendChild(xStruct); xOptions.appendChild(xColumn1); xOptions.appendChild(xColumn2); // Actions let xActions = createNode("div", {id: "grammalecte_tf_actions"}); xActions.appendChild(createNode("div", {id: "grammalecte_tf_reset", textContent: "Par défaut", className: "grammalecte_button", style: "background-color: hsl(210, 50%, 50%)"})); xActions.appendChild(createNode("progress", {id: "grammalecte_tf_progressbar"})); xActions.appendChild(createNode("span", {id: "grammalecte_tf_time_res"})); xActions.appendChild(createNode("div", {id: "grammalecte_tf_apply", textContent: "Appliquer", className: "grammalecte_button", style: "background-color: hsl(180, 50%, 50%)"})); //xActions.appendChild(createNode("div", {id: "grammalecte_infomsg", textContent: "blabla"})); // create result xTFNode.appendChild(xOptions); xTFNode.appendChild(xActions); } catch (e) { |
︙ | ︙ |