MediaWiki:Gadget-toplinksDropdown.less

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
// prevent this from doing anything on Special:Preferences; JS doesn't load on that
// page, so users will be unable to access the personal links that are display: none'd

body:not(.mw-special-Preferences) {

    // hide these with css first so there's no jump after js loads
    #pt-mytalk,
    #pt-preferences,
    #pt-watchlist,
    #pt-mycontris,
    #pt-logout {
        display: none;
    }

    // username link
    #p-personal #pt-userpage {
        float: right;
        position: relative;
        order: 1; // fix ordering with skintoggles/events/news buttons

        // needs large padding (not margin) to increase hover target
        padding: .75em 0;
        margin: -0.15em 1em .1em;
        background-position: left center;
    }

    #pt-userpage {

        // dropdown stuff
        .pt-userpage-dropdown {
            display: none;
            background: #fff;
            border: 1px solid #e4eaee;
            padding: 1em;
            box-shadow: 0 0.25rem 0.35rem -0.25rem rgba(0,0,0,0.3);

            position: absolute;
            top: 2.5em;
            right: 0;
            z-index: 10;

            // pointy triangle
            &::before {
                content: '';
                position: absolute;
                border: 8px solid transparent;
                border-top: 0;
                border-bottom: 8px solid #e4eaee;
                top: -8px;
                right: 10px;
            }

            &::after {
                content: '';
                position: absolute;
                border: 11px solid transparent;
                border-top: 0;
                border-bottom: 11px solid #ffffff;
                top: -6.5px;
                right: 7px;
            }

            ul {
                padding: 0;
            }

            li {
                display: block; // undo the display: none
                width: 100%;
                font-size: 1.1em;
                margin: 0;
            }

            // make link span entire dropdown
            li a {
                display: block;
                padding: .5em 1em;
                box-sizing: border-box;

                &:hover {
                    background: #f9fafa;
                    border-radius: .25em;
                    text-decoration: none;
                }

            }

        }

        // show dropdown on username hover
        &:hover .pt-userpage-dropdown {
            display: block;
        }

    }

    // new talk page message
    #pt-mytalk .mw-echo-alert {
        color: #6bc71f;
        background: none;
        font-weight: bold;
    }

}

// dark mode
.wgl-darkmode:not(.mw-special-Preferences) {

    #pt-userpage .pt-userpage-dropdown {
        background: #313e59;
        border-color: #596e96;

        &::before {
            border-bottom-color: #596e96;
        }

        &::after {
            border-bottom-color: #313e59;
        }

        li a:hover {
            background: #29354e;
        }

    }


}