Index: gc_lang/fr/webext/content_scripts/init.js ================================================================== --- gc_lang/fr/webext/content_scripts/init.js +++ gc_lang/fr/webext/content_scripts/init.js @@ -127,11 +127,11 @@ } }, createMessageBox: function () { if (this.oMessageBox === null) { - this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte", 400, 250); + this.oMessageBox = new GrammalecteMessageBox("grammalecte_message_box", "Grammalecte"); this.oMessageBox.insertIntoPage(); } }, startGCPanel: function (xNode=null) { @@ -156,11 +156,11 @@ }, showMessage: function (sMessage) { this.createMessageBox(); this.oMessageBox.show(); - this.oMessageBox.addMessage(sMessage); + this.oMessageBox.setMessage(sMessage); }, getPageText: function () { let sPageText = document.body.innerText; let nPos = sPageText.indexOf("__grammalecte_panel__"); Index: gc_lang/fr/webext/content_scripts/message_box.css ================================================================== --- gc_lang/fr/webext/content_scripts/message_box.css +++ gc_lang/fr/webext/content_scripts/message_box.css @@ -2,19 +2,25 @@ CSS Message box for Grammalecte */ .grammalecte_message_box { + position: fixed; padding: 0; margin: 0; - position: fixed; + top: 50%; + left: 50%; + width: 400px; + margin-left: -200px; + margin-left: -100px; + min-height: 100px; box-sizing: content-box; - z-index: 2147483641; /* maximum is 2147483647: https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index */ - border: 2px solid hsl(210, 10%, 50%); + z-index: 2147483647; /* maximum is 2147483647: https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index */ + border: 2px solid hsl(210, 50%, 50%); border-radius: 10px 10px 10px 10px; - background-color: hsl(210, 0%, 100%); - color: hsl(0, 0%, 0%); + background-color: hsl(210, 50%, 50%); + color: hsl(0, 10%, 92%); font-family: "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; box-shadow: 0 0 2px 1px hsla(210, 50%, 50%, .5); line-height: normal; text-shadow: none; text-decoration: none; @@ -26,14 +32,14 @@ } .grammalecte_message_box_bar { position: sticky; width: 100%; - background-color: hsl(210, 0%, 90%); + background-color: hsl(210, 50%, 50%); border-radius: 10px 10px 0 0; - border-bottom: 1px solid hsl(210, 10%, 80%); - color: hsl(210, 10%, 4%); + border-bottom: 1px solid hsl(210, 50%, 47%); + color: hsl(0, 10%, 92%); font-size: 20px; } .grammalecte_message_box_title { padding: 10px 20px; } @@ -43,23 +49,14 @@ } .grammalecte_message_box_invisible_marker { position: absolute; /*visibility: hidden;*/ font-size: 6px; - color: hsl(210, 0%, 90%); /* same color than panel_bar background */ + color: hsl(210, 50%, 50%); /* same color than panel_bar background */ } .grammalecte_message_box_content { - position: absolute; - min-width: 100%; height: calc(100% - 55px); /* panel height - title_bar */ - overflow: auto; -} - -.grammalecte_message_box_message { - margin: 10px; - padding: 10px; - border-radius: 5px; - background-color: hsl(0, 50%, 40%); + padding: 20px; color: hsl(0, 50%, 96%); - font-size: 20px; + font-size: 18px; } Index: gc_lang/fr/webext/content_scripts/message_box.js ================================================================== --- gc_lang/fr/webext/content_scripts/message_box.js +++ gc_lang/fr/webext/content_scripts/message_box.js @@ -4,18 +4,15 @@ "use strict"; class GrammalecteMessageBox { - constructor (sId, sTitle, nWidth, nHeight) { + constructor (sId, sTitle) { this.sId = sId; - this.nWidth = nWidth; - this.nHeight = nHeight; this.xMessageBoxBar = oGrammalecte.createNode("div", {className: "grammalecte_message_box_bar"}); this.xMessageBoxContent = oGrammalecte.createNode("div", {className: "grammalecte_message_box_content"}); this.xMessageBox = this._createPanel(sTitle); - this.center(); } _createPanel (sTitle) { try { let xMessageBox = oGrammalecte.createNode("div", {id: this.sId, className: "grammalecte_message_box"}); @@ -24,11 +21,10 @@ let xTitle = oGrammalecte.createNode("div", {className: "grammalecte_panel_title"}); xTitle.appendChild(this._createLogo()); xTitle.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_label", textContent: sTitle})); this.xMessageBoxBar.appendChild(xTitle); xMessageBox.appendChild(this.xMessageBoxBar); - xMessageBox.appendChild(this.xMessageBoxContent); return xMessageBox; } catch (e) { showError(e); @@ -64,19 +60,13 @@ hide () { this.xMessageBox.style.display = "none"; this.clear(); } - addMessage (sMessage) { - this.xMessageBoxContent.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_message_box_message", textContent: sMessage})); + setMessage (sMessage) { + this.xMessageBoxContent.textContent = sMessage; } clear () { - while (this.xMessageBoxContent.firstChild) { - this.xMessageBoxContent.removeChild(this.xMessageBoxContent.firstChild); - } - } - - center () { - this.xMessageBox.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;`; + this.xMessageBoxContent.textContent = ""; } }