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(' '); });