Index: gc_lang/fr/webext/content_scripts/gc_content.js ================================================================== --- gc_lang/fr/webext/content_scripts/gc_content.js +++ gc_lang/fr/webext/content_scripts/gc_content.js @@ -48,11 +48,11 @@ super(...args); this.aIgnoredErrors = new Set(); this.xContentNode = createNode("div", {id: "grammalecte_gc_panel_content"}); this.xParagraphList = createNode("div", {id: "grammalecte_paragraph_list"}); this.xContentNode.appendChild(this.xParagraphList); - this.xContentNode.addEventListener("click", onGrammalecteGCPanelClick, false); + this.xPanelContent.addEventListener("click", onGrammalecteGCPanelClick, false); this.oTooltip = new GrammalecteTooltip(this.xContentNode); this.xPanelContent.appendChild(this.xContentNode); this.oTAC = new GrammalecteTextAreaControl(); } Index: gc_lang/fr/webext/content_scripts/panels_content.js ================================================================== --- gc_lang/fr/webext/content_scripts/panels_content.js +++ gc_lang/fr/webext/content_scripts/panels_content.js @@ -6,16 +6,16 @@ console.log("[Content script] Panel creator"); class GrammalectePanel { - constructor (sId, sTitle, nWidth, nHeight, bMovable=true) { + constructor (sId, sTitle, nWidth, nHeight, bFlexible=true) { this.sId = sId; this.sContentId = sId+"_content"; this.nWidth = nWidth; this.nHeight = nHeight; - this.bMovable = bMovable; + this.bFlexible = bFlexible; this.xPanelContent = createNode("div", {className: "grammalecte_panel_content"}); this.xWaitIcon = this._createWaitIcon(); this.xPanelNode = this._createPanel(sTitle); this.center(); } @@ -39,17 +39,15 @@ } _createButtons () { let xButtonLine = createNode("div", {className: "grammalecte_panel_commands"}); xButtonLine.appendChild(this.xWaitIcon); - if (this.bMovable) { - xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut")); - xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche")); - xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer")); - xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite")); - xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas")); - } + xButtonLine.appendChild(this._createMoveButton("stickToTop", "¯", "Coller en haut")); + xButtonLine.appendChild(this._createMoveButton("stickToLeft", "«", "Coller à gauche")); + xButtonLine.appendChild(this._createMoveButton("center", "•", "Centrer")); + xButtonLine.appendChild(this._createMoveButton("stickToRight", "»", "Coller à droite")); + xButtonLine.appendChild(this._createMoveButton("stickToBottom", "_", "Coller en bas")); xButtonLine.appendChild(this._createCloseButton()); return xButtonLine; } _createWaitIcon () { @@ -86,32 +84,34 @@ hide () { this.xPanelNode.style.display = "none"; } center () { - let nHeight = window.innerHeight-100; + let nHeight = (this.bFlexible) ? window.innerHeight-100 : this.nHeight; this.xPanelNode.style = `top: 50%; left: 50%; width: ${this.nWidth}px; height: ${nHeight}px; margin-top: -${nHeight/2}px; margin-left: -${this.nWidth/2}px;`; } stickToLeft () { - let nHeight = window.innerHeight-100; + let nHeight = (this.bFlexible) ? window.innerHeight-100 : this.nHeight; this.xPanelNode.style = `top: 50%; left: -2px; width: ${this.nWidth}px; height: ${nHeight}px; margin-top: -${nHeight/2}px;`; } stickToRight () { - let nHeight = window.innerHeight-100; + let nHeight = (this.bFlexible) ? window.innerHeight-100 : this.nHeight; this.xPanelNode.style = `top: 50%; right: -2px; width: ${this.nWidth}px; height: ${nHeight}px; margin-top: -${nHeight/2}px;`; } stickToTop () { - let nWidth = Math.floor(window.innerWidth/2); - this.xPanelNode.style = `top: -2px; left: 50%; width: ${nWidth}px; height: ${Math.floor(window.innerHeight*0.45)}px; margin-left: -${nWidth/2}px;`; + let nWidth = (this.bFlexible) ? Math.floor(window.innerWidth/2) : this.nWidth; + let nHeight = (this.bFlexible) ? Math.floor(window.innerHeight*0.45) : this.nHeight; + this.xPanelNode.style = `top: -2px; left: 50%; width: ${nWidth}px; height: ${nHeight}px; margin-left: -${nWidth/2}px;`; } stickToBottom () { - let nWidth = Math.floor(window.innerWidth/2); - this.xPanelNode.style = `bottom: -2px; left: 50%; width: ${nWidth}px; height: ${Math.floor(window.innerHeight*0.45)}px; margin-left: -${nWidth/2}px;`; + let nWidth = (this.bFlexible) ? Math.floor(window.innerWidth/2) : this.nWidth; + let nHeight = (this.bFlexible) ? Math.floor(window.innerHeight*0.45) : this.nHeight; + this.xPanelNode.style = `bottom: -2px; left: 50%; width: ${nWidth}px; height: ${nHeight}px; margin-left: -${nWidth/2}px;`; } reduce () { // todo }