Grammalecte  Check-in [686fe8194d]

Overview
Comment:Permet de pouvoir utiliser Grammalecte sur twitter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | FixWebext
Files: files | file ages | folders
SHA3-256: 686fe8194da182ebe5a05dc94ad4622464dd0c17b277506772259382e378930c
User & Date: IllusionPerdu on 2017-10-28 01:16:36
Other Links: branch diff | manifest | tags
Context
2017-10-28
06:57
[fx] fix menu button size check-in: 625b15ea09 user: olr tags: fx, FixWebext
01:16
Permet de pouvoir utiliser Grammalecte sur twitter check-in: 686fe8194d user: IllusionPerdu tags: fx, FixWebext
00:22
Revert changement de taille du bouton (est super petit sur certain site) check-in: d5e30a5b87 user: IllusionPerdu tags: fx, FixWebext
Changes

Modified gc_lang/fr/webext/content_scripts/menu.js from [5464f752b2] to [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) => {