Grammalecte  Diff

Differences From Artifact [5464f752b2]:

To Artifact [0a15c1c9ea]:


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
        this.sMenuId = "grammalecte_menu" + nMenu;
        this.xButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_main_button", textContent: " "});
        this.xButton.onclick = () => { this.switchMenu(); };
        this.xButton.style.zIndex = (xNode.style.zIndex.search(/^[0-9]+$/) !== -1) ? (parseInt(xNode.style.zIndex) + 1).toString() : xNode.style.zIndex;
        this.xMenu = this._createMenu();

        let style = window.getComputedStyle(this.xNode);
        this.topMargin = -1 * (8 + parseInt(style.marginBottom.replace('px', ''), 10));






        this._insertAfter(this.xButton);
        this.xButton.style.marginTop = this.topMargin + 'px';

        this._insertAfter(this.xMenu);
        this.xMenu.style.marginTop = (this.topMargin + 8) + 'px';

        this._createListenersOnReferenceNode();
    }

    _insertAfter (xNewNode) {
        this.xNode.parentNode.insertBefore(xNewNode, this.xNode.nextSibling);
    }

    _createListenersOnReferenceNode () {
        this.xNode.addEventListener('focus', (e) => {
            this.xButton.style.display = "block";
        });
        this.xNode.addEventListener('blur', (e) => {







|

>
>
>
>
>
|
|

|
|




|
|







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
        this.sMenuId = "grammalecte_menu" + nMenu;
        this.xButton = oGrammalecte.createNode("div", {className: "grammalecte_menu_main_button", textContent: " "});
        this.xButton.onclick = () => { this.switchMenu(); };
        this.xButton.style.zIndex = (xNode.style.zIndex.search(/^[0-9]+$/) !== -1) ? (parseInt(xNode.style.zIndex) + 1).toString() : xNode.style.zIndex;
        this.xMenu = this._createMenu();

        let style = window.getComputedStyle(this.xNode);
        let topMargin = -1 * (8 + parseInt(style.marginBottom.replace('px', ''), 10));

        let insAfterThis = this.xNode;
        if ( document.location.host == "twitter.com" && this.xNode.classList.contains('rich-editor')){
            insAfterThis = this.xNode.parentNode;
        }

        this._insertAfter(this.xButton, insAfterThis);
        this.xButton.style.marginTop = topMargin + 'px';

        this._insertAfter(this.xMenu, insAfterThis);
        this.xMenu.style.marginTop = (topMargin + 8) + 'px';

        this._createListenersOnReferenceNode();
    }

    _insertAfter (xNewNode, xReferenceNode) {
        xReferenceNode.parentNode.insertBefore(xNewNode, xReferenceNode.nextSibling);
    }

    _createListenersOnReferenceNode () {
        this.xNode.addEventListener('focus', (e) => {
            this.xButton.style.display = "block";
        });
        this.xNode.addEventListener('blur', (e) => {