User:JustLeafy/global.js

//__NOWYSIWYG__ \ \ table.wikiacontribs {\ border: 2px solid #a5a4a3;\ width: 100%;\ }\ table.wikiacontribs th {\ background: #dcdbd8;\ text-align: -webkit-center;\ display: table-cell;\ width: auto;\ padding: 26px;\ }\ section#wikiacontribs {\ width: 175% !important;   left: 12% !important;\ }\ @media screen and (min-width: 700px ) {\ section#wikiacontribs {\ width: 74% !important;   left: 5% !important;\ }\ }\ .spindashspinlikeyourlifedependsonit::after {\ background: url(https://slot1-images.wikia.nocookie.net/__cb1510749070/common/skins/common/images/ajax.gif);\ content: \' \';\ width: 16px;\ height: 17px;\ position: absolute;\ zoom: 3;\ }\ table.wikiacontribs td {\ padding: 17px;\ border-bottom: 2px solid #dbdad8;\ }\ section.modalWrapper#wikiacontribs {\ position: absolute;\ top: 20px !important;\ left: 12% !important;\ margin: 0 !important;\ }\ section#wikiacontribs .modalContent {\ height: calc(50pc) !important;\ overflow: scroll;\ }\ section#wikiacontribs h1 {\ font-family: fantasy;\ font-size: 40px;\ text-align: center;\ }\ ', {                   id: "wikiacontribs", callback: function { $('.searchlog').on('keydown', function(key) {                           if (key.keyCode === 13) {                                checkUserStats(key.target.value, 0);                            } else {                                $.get("/api.php?action=query&list=allusers&aufrom=" + key.target.value + "&format=json", function(response) { $('#searchloglist option').remove; response.query.allusers.forEach(function(d, v) {                                       $('#searchloglist').append('' + d.name + " ");                                    }) });                           }                        })                        $('#cleanlist').on('click', function {                            $('.wikiacontribs tr:not(.headers)').remove                        }) function checkUserStats(d, v) { document.getElementsByClassName("headerstats")[0].classList.add("spindashspinlikeyourlifedependsonit"); $.get("/api.php", {                               action: "query",                                list: "users",                                ususers: d,                                usprop: "groups|editcount|gender|registration",                                format: "json"                            }, function(second) {                                if (second.query.users === [] || second.error || !second.query.users[0] ) {                                    console.log(d);                                    return $('table.wikiacontribs').append(" " + d + " does not exist.  ");                                }                                var cells = ' ';                                $.ajax({ url: "/api.php", data: { action: "query", list: "usercontribs", ucuser: d,                                       format: "json" },                                   method: "GET", format: "JSON", }).always(function(third) { $.get("https://services.wikia.com/user-attribute/user/" + second.query.users[0].userid, function(forth) {                                       cells += " " + second.query.users[0].userid + " ";                                        if (forth._embedded && forth._embedded.properties) {                                            forth._embedded.properties.forEach(function(b) { if (b.name == "avatar") { return cells += "  "; }                                           })                                        }                                        if (!cells.match(/ ";                                        }                                        cells += "" + second.query.users[0].name + " (talk) • (profile) ";                                        cells += " " + second.query.users[0].gender + " ";                                        cells += " " + second.query.users[0].groups.join(", ") + " "; cells += " " + second.query.users[0].editcount + " "; if (third.query && third.query.usercontribs[0]) { var date = new Date(third.query.usercontribs[0].timestamp); var interval = Date.parse(new Date) - date; var seconds = Math.floor((interval / 1000) % 60); var minutes = Math.floor((interval / 1000 / 60) % 60); var hours = Math.floor((interval / (1000 * 60 * 60)) % 24); var days = Math.floor(interval / (1000 * 60 * 60 * 24)); cells += "" + (date.getMonth + 1) + "/" + date.getDate.toString + "/" + (date.getFullYear) + " "; } else { cells += " null "; }                                       var date = new Date(second.query.users[0].registration); cells += " " + (date.getMonth + 1) + "/" + date.getDate.toString + "/" + (date.getFullYear) + " "; cells += " "; return $('table.wikiacontribs').append(cells); });                                   setTimeout(function { document.getElementsByClassName("headerstats")[0].classList.remove("spindashspinlikeyourlifedependsonit"); }, 5000)                               })                            })                        }                        $('#wikiacontribs #initiate').on('click', function { var offsetgm = 0; function gmAPI(offsetgm) { $.ajax({                                   url: "/api.php",                                    data: {                                        action: "query",                                        list: "groupmembers",                                        gmgroups: $('input.gmrights').val === "" ? 'bureaucrat|sysop' : $('input.gmrights').val,                                        gmlimit: 500,                                        gmoffeset: offsetgm,                                        format: "json"                                    },                                    method: "GET",                                    format: "JSON",                                }).always(function(response) {                                    if (response.user == []) {                                        return $('.wikiacontribs').append("No users found "); }                                   response.users.forEach(function(d, v) {                                        checkUserStats(d.name, v);                                        if (response.users.length == v && response["query-continue"]) {                                            gmAPI(response["query-continue"].groupmembers.gmoffeset);                                        }                                    }) });                           }                            gmAPI(offsetgm);                        }); $('button.wikia-button.gmusercheck').on('click', function {                           $.showCustomModal('', '  #userrightsbatch{width:auto !important;height:auto !important} ', { id: "userrightsbatch", buttons: [{ id: "startuserbatchscript", message: "Start Batch" }],                               callback: function { $('#startuserbatchscript').on('click', function {                                       $('textarea#userrightsbatch').val.match(/^(.*?)$/gmi).forEach(function(v, d) { checkUserStats(v, d); });                                       $('#userrightsbatch .close').click;                                    }); }                           })                        })                    }                });            });            return tru.condition = "true"; }   }, 2000) }(window, mw, $)); // //Random Page Shortcut $(function {   var newpage = $('.wds-community-header__wiki-buttons a[data-tracking="wiki-activity"]');    newpage.clone.attr({href: '/wiki/Special:Random', title: 'Random Page', 'data-tracking': 'random-page'}).insertAfter(newpage)        .find('svg').html(' '); }); //SandboxLink mw.loader.using('mediawiki.util', function {   if ($('a[data-id="sandbox"]').length || !$('.wds-global-navigation__content-bar').length) {        return;    }    var c = mw.config.get([ 'wgContentLanguage', 'wgUserLanguage' ]),   i18n = {        en: 'My Sandbox',        an: 'As mías contrebucions',        ar: 'مساهمتي',        ast: 'Les mios collaboraciones',        ba: 'Минең башҡарған',        be: 'Мой уклад',        bg: 'Моите приноси',        bs: 'Moj doprinos',        ca: 'Les meves contribucions',        csb: 'Mój wkłôd',        cs: 'Můj příspěvek',        da: 'Mine bidrag',        de: 'Meine Beiträge',        el: 'Οι συνεισφορές μου',        eo: 'Miaj kontribuoj',        es: 'Mis contribuciones',        ext: 'Los mis endirguis',        eu: 'Nire ekarpenak',        fa: 'مشارکت‌ها',        fi: 'Omat muokkaukset',        fr: 'Mes contributions',        fy: 'Myn bydragen',        gl: 'As miñas contribucións',        hi: 'मेरा योगदान',        hr: 'Moj doprinos',        is: 'Framlög mín',        it: 'I miei contributi',        ja: '投稿記録',        kk: 'Менің үлесім',        'kk-arab': 'ۇلەسىم',        'kk-latn': 'Meniñ ülesim', kn: 'ನನ್ನ ಕೊಡುಗೆಗಳು', ko: '기여 목록', ky: 'Менин салымдар', la: 'Conlationes meæ', mk: 'Мојот придонес', mo: 'Контрибуцииле меле', mrj: 'Мӹньын лӓктӹшем', nl: 'Mijn bijdragen', nn: 'Bidraga mine', no: 'Mine bidrag', oc: 'Mas contribucions', pl: 'Mój wkład', pt: 'As minhas contribuições', 'pt-br': 'Minhas contribuições', ro: 'Contribuţiile mele', ru: 'Мой вклад', sco: 'Ma contreibutions', sk: 'Môj príspevok', sl: 'Moj prispevek', sr: 'Моји доприноси', 'sr-el': 'Moji doprinosi', sv: 'Mina bidrag', tg: 'Саҳми ҳиссагузориҳо', 'tg-latn': 'Sahmi hissaguzoriho', tt: 'Минем кертем', 'tt-latn': 'Minem kertem', udm: 'Мон гожтэмъёс', uk: 'Мій внесок', ur: 'شراکتیں', uz: 'Mening hissam', val: 'Les mies contribucions', zh: '我的贡献', 'zh-hans': '我的贡献', 'zh-hant': '我的貢獻', 'zh-tw': '我的貢獻', };   i18n = i18n[c.wgUserLanguage] || i18n[c.wgUserLanguage.split('-')[0]] || i18n[c.wgContentLanguage] || i18n[c.wgContentLanguage.split('-')[0]] || i18n.en; $('.wds-global-navigation__user-menu div:nth-child(2) ul li:nth-child(2)') .after(           $('<li>')                .append( $('') .attr({                           'data-id': 'sandbox',                            class: 'wds-global-navigation__dropdown-link',                            href: mw.util.getUrl('User:JustLeafy/Sandbox')                        }) .text(i18n) )       ); });

//HistoryKey $('body').off('keydown.gks'); $('body').on('keydown.gks', function (e) {   if (e.key !== 'h') return;    switch (document.activeElement.tagName) {        case 'INPUT':        case 'TEXTAREA':            return;            }            location.replace(mw.util.getUrl(mw.config.get('wgPageName'), {action: 'history'})); });