FreeStyler / linuxmint.com.ru improvements

// ==UserScript==
// @namespace    linuxmint.com.ru_improvements
// @name         linuxmint.com.ru improvements
// @description  Adding chat button to top panel
// @version      0.0.4
// @license      GPL-2.0-only
// @author       FreeStyler
// @copyright    2018, FreeStyler (https://openuserjs.org//users/FreeStyler)
// @supportURL   mailto:zanygamer@gmail.com
// @include      *linuxmint.com.ru/
// @match        *linuxmint.com.ru/
// @updateURL    https://openuserjs.org/meta/FreeStyler/linuxmint.com.ru_improvements.meta.js
// @downloadURL  https://openuserjs.org/install/FreeStyler/linuxmint.com.ru_improvements.user.js
// @grant        none
// @run-at       document-end
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// ==/UserScript==

(function ($, undefined) {
    $(function () {

        'use strict';

        var
            cl = console.log,
            isset = function (e){ return typeof e == 'undefined' ? false : true;},
            LANG = navigator.language,
            chat_setted = false,
            $chat,
        endvar;

        //if(LANG == 'en-US') LANG = 'en';
        LANG = 'en';
        if(LANG == 'ru-RU') LANG = 'ru';

        function setChat(){

            let $chat = $('#chat-body');
            if(!$chat.length) return;

            $chat.hide().appendTo($('body')).css({position: 'fixed', left: 0, top: 0, zIndex: 99});

            $('.headerbar-menu').append(`<li title='Показать/Скрыть чат' id=chat_show class="av-big-icon-only av-always-visible"><a href="#" role="chat_show" class="chad"><i class="zmdi zmdi-comment-more"></i></a></li>`);
            //https://linuxmint.com.ru/app.php/chat
            $('#chat_show').on('click', function(){
                if($chat.css('display') === 'none')
                    $chat.fadeIn();
                else
                    $chat.fadeOut();
            });

            $('.ic-input').append('<a did=hide_chat href="#" class="chat-button ic-small" title="Скрыть чат"><i class="zmdi zmdi-triangle-down"></i></a>');
            $('.ic-input').append('<a did=to_chat href="#" class="chat-button ic-small" title="На страницу чата" style="position: relative;    left: -22px;    top: 26px;    transform: rotate(-90deg);"><i class="zmdi zmdi-triangle-down"></i></a>');

            $('a[did=hide_chat]').on('click', ()=>{
                $chat.fadeOut();
            });

            $('a[did=to_chat]').on('click', ()=>{
                location.href = 'https://linuxmint.com.ru/app.php/chat';
            });
        }

        if(/chat\?mode=archive/.test(location.href)) return;

        setChat();

    });
})(window.jQuery.noConflict(true));