User:StarmanW/common.js

//

/* FULL CREDITS GOES TO SLYST */ /** * quickLogs * * displays user logs on special:contributions * @author user:slyst */ var QLUserId = $('.chat-change-ban').attr('data-user-id'); $(function {   var quickLogs = {        user: mw.config.get('wgTitle').split('/')[1] || decodeURIComponent($.getUrlVar('target')),        init: function {            $('#contentSub').html( ' ' +                   'For ' + '' + this.user + ' (' +                    (this.rights ? 'block | ' : '') +                   'block log | ' +                    'uploads | ' +                    'move log | ' +                    (!!mw.config.get('wgWikiaChatWindowFeatures') ? 'chatban log | ' : '') +                   'abuse log | ' +                    'userrights log | ' +                    (this.rights ? 'deletedcontribs</a> | ' : '') +                    (this.rights ? 'user rights management</a> | ' : '') +                   (this.rightsCmod ? 'Ban from Chat</a> | ' : '') +                    'all logs</a>' +                    ')' + ' ' +               ' ' +                    ' Logs ' + ' ' +                       '<ul>' + '<li>Please select the type of logs to be shown.</li>' + '</ul>' + ' ' +               ' '            );            this.addCSS;            $('.quicklogs').on('click', function { $('#quicklogs-head').html('Logs: ' + $(this).data('log')); $('#quicklogs-container ul').html('<img style="display: block; margin: 0 auto;" src="' + mw.config.get('stylepath') + '/common/images/ajax.gif" />'); if ($(this).siblings.hasClass('selected')) { $(this).siblings.removeClass('selected'); }               $(this).addClass('selected'); quickLogs.log($(this).data('log')); });       },        log: function(log) {            switch(log) {                case 'block':                    this.getLogs('block', undefined, this.user);                    break;                case 'upload':                    this.getLogs('upload', this.user, undefined);                    break;                case 'move':                    this.getLogs('move', this.user, undefined);                    break;                case 'chatban':                    this.getLogs('chatban', undefined, this.user);                    break;                case 'abuselog':                    $.get(mw.util.wikiScript('api'), { action: 'query', list: 'abuselog', afluser: this.user, afllimit: 500, aflprop: 'ids|filter|user|title|action|result|timestamp|hidden', format: 'json' }, function(data) { var html = ''; if (data.warnings) { html += '<li>Special:AbuseLog</a> does not exist.</li>'; } else { if (!$.isEmptyObject(data.query.abuselog)) { var le = data.query.abuselog; for (var i in le) { html += '<li>' + quickLogs.date(le[i].timestamp) + '' + le[i].title + '</a><ul><li>action: ' + le[i].action + '</li><li>actions taken: ' + le[i].result + '</li><li>description: ' + le[i].filter + '</li></ul>'; }                           } else { html += '<li>No logs found.</li>'; }                       }                        $('#quicklogs-container ul').html(html); });                   break;                case 'deletedcontribs':                    $.get(mw.util.wikiScript('api'), { action: 'query', list: 'deletedrevs', druser: this.user, drlimit: 500, drprop: 'parsedcomment', format: 'json' }, function(data) { var le = data.query.deletedrevs, html = ''; if (!$.isEmptyObject(le)) { for (var i in le) { html += '<li>' + quickLogs.date(le[i].revisions[0].timestamp) + '' + le[i].title + '</a> (diff</a> | deletion log</a> | view</a>)' + (le[i].revisions[0].parsedcomment ? ' (' + le[i].revisions[0].parsedcomment + ') ' : ) + '</li>'; }                       } else { html += '<li>No logs found.</li>'; }                       $('#quicklogs-container ul').html(html); });                   break;                case 'rights':                    this.getLogs('rights', undefined, this.user);                    break;            }        },        getLogs: function(type, user, title) {            var data = {                action: 'query',                list: 'logevents',                leprop: 'title|user|timestamp|type|parsedcomment|details',                lelimit: 500,                format: 'json'            };            if (type) {                data.letype = type;            }            if (user) {                data.leuser = user;            }            if (title) {                data.letitle = 'User:' + title;            }            $.get(mw.util.wikiScript('api'), data, function(data) { quickLogs.addLogs(data, type); });       },        addLogs: function(data, type) {            var le = data.query.logevents,                html = '';            if (!$.isEmptyObject(le)) {                switch(type) {                    case 'block':                        for (var i in le) {                          html += '<li>' + this.date(le[i].timestamp) + this.userLinks(le[i].user, true) + ' ' + le[i].action + 'ed ' + this.userLinks(this.user) + (le[i].block && le[i].block.duration ? ' with an expiry time of ' + le[i].block.duration : '') + (le[i].block && le[i].block.flags ? ' (' + le[i].block.flags.replace(/\,/g, ', ') + ')' : '') + (le[i].parsedcomment ? ' (' + le[i].parsedcomment + ') ' : '') + '</li>';                       }                        break;                    case 'upload':                        for (var i in le) {                            html += '<li>' + this.date(le[i].timestamp) + '' + le[i].title + '</a>' + (le[i].action === 'overwrite' ? ' (updated revision)' : '') + (le[i].parsedcomment ? ' (' + le[i].parsedcomment + ') ' : '') + '</li>';                       }                        if (data['query-continue']) {                            html += '<li>see more</a></li>';                        }                        break;                    case 'move':                        for (var i in le) {                            html += '<li>' + this.date(le[i].timestamp) + this.userLinks(this.user) + ' moved page ' + le[i].title + '</a> to ' + le[i].move['new_title'] + '</a>' + (le[i].action === 'move_redir' ? ' over redirect' : ) + (le[i].move.suppressedredirect ===  ? ' without leaving a redirect' : '') + (le[i].parsedcomment ? ' (' + le[i].parsedcomment + ') ' : '') + '</li>';                       }                        if (data['query-continue']) {                            html += '<li>see more</a></li>';                        }                        break;                    case 'chatban':                        for (var i in le) {                            html += '<li>' + this.date(le[i].timestamp) + this.userLinks(le[i].user, true);                            switch (le[i].action) {                                case 'chatbanadd':                                    html += ' banned ' + this.userLinks(this.user) + ' from chat with an expiry time of ' + le[i][2];                                    break;                                case 'chatbanchange':                                    html += ' changed ban settings for ' + this.userLinks(this.user) + ' with an expiry time of ' + le[i][2]; break; case 'chatbanremove': html += ' unbanned ' + this.userLinks(this.user) + ' from chat'; break; }                           html += (le[i].parsedcomment ? ' (' + le[i].parsedcomment + ') ' : '') + '</li>'; }                       break; case 'rights': for (var i in le) { html += '<li>' + this.date(le[i].timestamp) + this.userLinks(le[i].user, true) + ' changed group membership for ' + this.userLinks(this.user) + ' from (' + (le[i].rights.old === '' ? 'none' : le[i].rights.old) + ') to (' + (le[i].rights['new'] === '' ? 'none' : le[i].rights['new']) + ')' + (le[i].parsedcomment ? ' (' + le[i].parsedcomment + ') ' : '') + '</li>'; }                       break; }           } else { html += '<li>No logs found.</li>'; }           $('#quicklogs-container ul').html(html); },       rights: function { return /(bureaucrat|patroller|sysop|helper|vstf|staff)/.test(mw.config.get('wgUserGroups').join(' ')) ? true : false; },       rightsCmod: function { return /(bureaucrat|chatmoderator|sysop|helper|vstf|staff)/.test(mw.config.get('wgUserGroups').join(' ')) ? true : false; },       userLinks: function(user, sub) { var links = '' + user + '</a>'; if (sub) { links += ' (';               if ($('.WikiaUserPagesHeader .tabs [data-id="talk"]').length) {                    links += '<a href="/wiki/User_talk:' + mw.util.wikiUrlencode(user) + '">talk</a> | ';                } else if ($('.WikiaUserPagesHeader .tabs [data-id="wall"]').length) {                    links += '<a href="/wiki/Message_Wall:' + mw.util.wikiUrlencode(user) + '">wall</a> | ';                }                links += '<a href="/wiki/Special:Contributions/' + mw.util.wikiUrlencode(user) + '">contribs</a>)'; }           return links; },       date: function (date) { var date = new Date(date).toUTCString, d = date.slice(5, 7), m = date .slice(8, 11) .replace(/Jan/g, 'January') .replace(/Feb/g, 'February') .replace(/Mar/g, 'March') .replace(/Apr/g, 'April') .replace(/Jun/g, 'June') .replace(/Jul/g, 'July') .replace(/Aug/g, 'August') .replace(/Sep/g, 'September') .replace(/Oct/g, 'October') .replace(/Nov/g, 'November') .replace(/Dec/g, 'December'), y = date.slice(12, 16); date = date.slice(17, 22) + ', ' + m + ' ' + d + ', ' + y + ': '; return date; },       addCSS: function { mw.util.addCSS(               '#contentSub .link {' +                    'text-decoration: line-through;' +                '}' +                '.quicklogs {' +                    'cursor: pointer;' +                '}' +                '.quicklogs.selected {' +                    'color: inherit;' +                    'font-weight: bold;' +                    'cursor: default;' +                '}' +                '.quicklogs.selected:hover {' +                    'text-decoration: none;' +                '}' +                '#quicklogs-ul {' +                    'border: 1px solid ' + $('#WikiaPage').css('border-color') + ';' +                    'padding: 10px;' +                    'overflow-y: auto;' +                    'max-height: 300px;' +                '}' +                '#quicklogs-head {' +                    'font-size: 16px;' +                    'margin-bottom: 5px;' + '}' +               '#quicklogs-container ul {' + 'list-style-type: square;' + 'margin-left: 20px;' + 'font-size: 13px;' + '}'           );        }    };    if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {        quickLogs.init;    }    $('.quickbanmodal').on('click', function(e) { e.preventDefault; var title = mw.html.escape($.msg('chat-ban-modal-change-ban-heading')), userId = $(this).data('user-id'), okCallback = function(expires, reason) { $.post(wgScript + '?action=ajax&rs=ChatAjax&method=blockOrBanChat', {                   userToBanId: QLUserId,                    time: expires,                    reason: reason,                    mode: 'global',                    token: mw.user.tokens.get('editToken')            }, $.proxy(function(data) { window.location.reload; }));       };        var chatBanModal = new ChatBanModal(title, okCallback, {            'isChangeBan': true,            userId: QLUserId        }); }); });

// VSTFReport by KockaAdmiralac // FULL CREDRITS AND ORIGINAL CREATOR GOES TO User:KockaAdmiralac $(function {   var data = {}, split1 = window.location.href.split("?");    if(split1[1])split1[1].split("&").forEach(function(el) {       split = el.split("="); data[split[0]] = decodeURIComponent(split[1]); }, this);   // If user is on the report page    if(wgPageName === "Report:Vandalism" && wgCityId === "65099")    {        // If the report should be submitted        if(data.report === "yes" && data.cb !== localStorage.getItem("rvcachebuster"))        {            // Waiting until the button appears            var interval = setInterval(function {               // If button appeared if($("#vstf-report-vandalism").length > 0) {                   // Opening form $("#requestWindow #submit").click(function { localStorage.setItem("rvcachebuster", data.cb); }); $("#vstf-report-vandalism").click; // Filling in form data $("#wikiname").val(data.name); $("#wikiurl").val(data.url); $("#user").val(data.vandal); // Clearing the check interval clearInterval(interval); }           }, 100);        }    }    // If user is on contributions page    else if(wgCanonicalSpecialPageName === "Contributions")    {        // Adding link to the report page        mw.util.addCSS(".VSTFReportButtonContainer{width:100%;text-align:center}");        $(" <button id='VSTFReportButton'>Report Vandalism ").insertAfter("#contentSub");        $("#VSTFReportButton").click(function {           var target; if(data.target) target = data.target.replace(/\+/g, " "); else target = wgPageName.split("/")[1]; window.location.href = "http://vstf.wikia.com/Report:Vandalism?report=yes&name=" + encodeURIComponent(wgSiteName) + "&url=" + encodeURIComponent(wgServer.substring(7, wgServer.length - 10)) + "&vandal=" + target + "&cb=" + encodeURIComponent(Math.random * 10000000000000000); });   } });

// VSTF Spam Report reference from VSTF Vandalism Report by User:KockaAdmiralac $(function {   var data = {}, split1 = window.location.href.split("?");    if(split1[1])split1[1].split("&").forEach(function(el) {       split = el.split("="); data[split[0]] = decodeURIComponent(split[1]); }, this);   // If user is on the report page    if(wgPageName === "Report:Spam" && wgCityId === "65099")    {        // If the report should be submitted        if(data.report === "yes" && data.cb !== localStorage.getItem("rvcachebuster"))        {            // Waiting until the button appears            var interval = setInterval(function {               // If button appeared if($("#vstf-report-spam").length > 0) {                   // Opening form $("#requestWindow #submit").click(function { localStorage.setItem("rvcachebuster", data.cb); }); $("#vstf-report-spam").click; // Filling in form data $("#wikiname").val(data.name); $("#wikiurl").val(data.url); $("#user").val(data.vandal); // Clearing the check interval clearInterval(interval); }           }, 100);        }    }    // If user is on contributions page    else if(wgCanonicalSpecialPageName === "Contributions")    {        // Adding link to the report page        mw.util.addCSS(".VSTFReportButtonContainer{width:100%;text-align:center}");        $(" <button id='VSTFReportButton'>Report Spam ").insertAfter("#contentSub");        $("#VSTFReportButton").click(function {           var target; if(data.target) target = data.target.replace(/\+/g, " "); else target = wgPageName.split("/")[1]; window.location.href = "http://vstf.wikia.com/Report:Spam?report=yes&name=" + encodeURIComponent(wgSiteName) + "&url=" + encodeURIComponent(wgServer.substring(7, wgServer.length - 10)) + "&vandal=" + target + "&cb=" + encodeURIComponent(Math.random * 10000000000000000); });   } });

//MultiUpload Script // ORIGINAL BY Gguigui1, FULL CREDITS GOES TO Gguigui1 /* OverPowered MultiUpload script */ (function ($) {   var i18n = {        en: {            logout: "You have to be log in and autoconfirmed to upload files",            update: "Update the form",            nofile: "You have to choose a file to upload it",            imagename: 'Image n°',            filename: 'File name : ',            licensetext: 'File license : ',            uploadfiles: 'Upload all images',            browsersupport: 'This browser doesn\'t seem to support the `files` property of file inputs.',            nolicence: 'None selected',            problem: 'A problem occured, upload cancelled',            success: 'Image uploaded successfully.',            duplicate: 'This image is a doublon of : ',            alreadyname: 'A image has already this name, please choose an other one below :',            reset: 'Reset the form',            description: 'Summary :',            filedescription: 'File description' },       fr: { logout: "Vous devez être connecté et autoconfirmed pour importer des fichiers", update: "Mettre à jour le formulaire", nofile: "Vous devez choisir un fichier pour l'importer !", imagename: 'Image n°', filename: 'Nom du fichier : ', licensetext: 'Licence du fichier : ', uploadfiles: 'Importer les images', browsersupport: 'Ce navigateur n\'a pas l\'air de reconnaître l\'attribut file des file inputs', nolicence: 'Aucune licence sélectionné', problem: 'Un problème est survenu, l\'opération a été annulé', success: 'Les images ont été importés avec succès.', duplicate: 'Cette image est un doublon de l\'image : ', alreadyname: 'Une image porte déjà ce nom sur ce wikia, merci donc de choisir un autre nom', reset: 'Remettre à zéro le formulaire', description: 'Description :', filedescription: 'Description du fichier' },	es: { logout: "Debes haber iniciado sesión y estar autoconfirmado para subir archivos", update: "Actualizar el formulario", nofile: "Tienes que elegir un archivo para subirlo", imagename: 'Imagen n°', filename: 'Nombre del archivo : ', licensetext: 'Licencia del archivo : ', uploadfiles: 'Subir todas las imágenes', browsersupport: 'Este navegador no parece soportar la propiedad `files` de las entradas de archivo.', nolicence: 'Ninguna seleccionada', problem: 'Ha ocurrido un problema, subida cancelada', success: 'Imagen subida satisfactoriamente.', duplicate: 'Esta imagen es un duplicado de : ', alreadyname: 'Una imagen ya tiene este nombre, por favor escoge otro nombre debajo:', reset: 'Reiniciar el formulario', description: 'Sumario:', filedescription: 'Descripción del archivo' },       pl: { logout: "Musisz być zalogowany i mieć potwierdzone konto, aby móc przesyłać pliki", update: "Zaktualizuj formularz", nofile: "Musisz wybrać plik, aby go przesłać", imagename: 'Obraz n°', filename: 'Nazwa pliku : ', licensetext: 'Licencja pliku : ', uploadfiles: 'Prześlij wszystkie pliki', browsersupport: 'Ta przeglądarka nie wspiera właściwości `files` na wejściu.', nolicence: 'Nic nie wybrano', problem: 'Wystąpił problem, przesyłanie anulowane', success: 'Obrazy zostały przesłane.', duplicate: 'Ten obraz jest duplikatem : ', alreadyname: 'Inny obraz już posiada tą nazwę, proszę wybierz poniżej inną :', reset: 'Wyczyść formularz', description: 'Opis :', filedescription: 'Opis pliku' }   };    // UserLanguage > ContentLanguage > ENGLISH i18n = $.extend(i18n.en, i18n[mw.config.get('wgContentLanguage')], i18n[mw.config.get('wgUserLanguage')]); var MultiUpload = { init: function { $('#my-tools-menu').prepend(' <a style="cursor:pointer" href="/wiki/Special:BlankPage?blankspecial=MultiUpload">Multi Upload</a></li>'); if (mw.config.get('wgCanonicalSpecialPageName') === 'Blankpage' && $.getUrlVar('blankspecial') === 'MultiUpload') { if (wgUserName === null || !$.inArray('autoconfirmed', wgUserGroups)) { /* If the user don't have multiple upload rights (if it's not autoconfirmed) */ $('#mw-content-text').html(i18n.logout); return false; }               var MultiUploadoption = MultiUploadoption || {}; $.extend(MultiUpload, MultiUploadoption); $('#mw-content-text').remove; $('#WikiaArticle').append('<input type="file" multiple id="fileinput" accept="image/*" />\n Ici \n ' + i18n.update + ' '); $('#editor').css('display', 'none'); var token = mw.user.tokens.get('editToken'); $('.AdminDashboardArticleHeader > h1').html('Multi Upload'); var filename; }       },        updatelicensebutton: function (licencestext) { if (licencestext !== null) { var licences = licencestext.split('\n'); if (licences[licences.length - 1] === '') { licences.splice(-1, 1); //Remove last line as it is empty }               $('.licence').replaceWith('  '); $('.licence').prepend(' ' + i18n.nolicence + ' '); for (i = 0; i < licences.length; i++) { if (licences[i].indexOf('** ') === 0) { licences[i] = licences[i].replace("** ", ""); if (licences[i].split('|')[0] == MultiUpload.defaultlicence) { $('.licence').find('optgroup:last-child').append('<option selected value="' + licences[i].split('|')[0] + '">' + licences[i].split('|')[1] + ' '); } else { $('.licence').find('optgroup:last-child').append('<option value="' + licences[i].split('|')[0] + '">' + licences[i].split('|')[1] + ' '); }                   } else { licences[i] = licences[i].replace('* ', ''); $('.licence').append('<optgroup label="' + licences[i] + '"></optgroup'); }               }            }        },        getlicence: function  { $.ajax({               type: "GET",                url: wgServer + '/api.php?action=query&meta=allmessages&ammessages=Licenses&format=json',                success: function (data) {                    var content = data.query.allmessages[0]['*'];                    MultiUpload.updatelicensebutton(content);                },                error: function (data) {                    alert(i18n.errorapi + ' : ' + data.error.info);                }            }); },       update: function  { if ($('fieldset').length > 0) { MultiUpload.handleFileSelect; return false; }           $('#editor').css('display', 'block'); $('#fileinput').attr("disabled", true); input = document.getElementById('fileinput'); $('#editor').html(''); if (input.files.length === 0) { alert(i18n.nofile); return false; }           if (!MultiUpload.max || typeof MultiUpload.max != "number" || MultiUpload.max < 0 || MultiUpload.max > 101) { if ($.inArray('staff', wgUserGroups) + $.inArray('helper', wgUserGroups) + $.inArray('util', wgUserGroups) + $.inArray('bot-global', wgUserGroups) > -4) { MultiUpload.max = 200; } else if ($.inArray('bureaucrat', wgUserGroups) + $.inArray('bot', wgUserGroups) > -2) { MultiUpload.max = 1000; } else if ($.inArray('sysop', wgUserGroups) > -1) { MultiUpload.max = 1000; } else if ($.inArray('rollback', wgUserGroups) > -1) { MultiUpload.max = 1000; } else { MultiUpload.max = 1000; }           }            if (!MultiUpload.max) { alert(lng.problem); return false; }           var limit; if (MultiUpload.max < input.files.length) { limit = MultiUpload.max; } else { limit = input.files.length; }           for (i = 0; i < limit; i++) { $('#editor').append(' ' + i18n.imagename + (i + 1) + ' ' + i18n.filename + '<input type="text" class="imagename" value="' + input.files[i].name + '" id="imagename' + (i + 1) + '"/> <div style="float:center; display:none;" id="loading' + (i + 1) + '"><img src="' + mw.config.get('stylepath') + '/common/images/ajax.gif" style="float: right; margin-left: 20px;" /> ' + i18n.licensetext + '<input type="text" class="licence" id="licence' + (i + 1) + '"/> '); }           MultiUpload.getlicence; $('#editor').append(' ' + i18n.filedescription + '  '); $('#go').html(i18n.uploadfiles); },       handleFileSelect: function  { input = document.getElementById('fileinput'); if (!input.files) { alert(i18n.browsersupport); $('#fileinput').attr("disabled", false); } else if (!input.files[0]) { alert(i18n.problem); $('#fileinput').attr("disabled", false); } else { $('fieldset').attr('disabled', 'disabled'); $('#go').attr('disabled', 'disabled'); var numberfiles = $('fieldset').length - 1; if (numberfiles > 0) { for (i = 0; i < numberfiles; i++) { file = input.files[i]; filename = $('.imagename').eq(i).val || input.files[i].name; console.log(filename); if ($('#WikiaArticle').find('select:eq(' + i + ')').find('option:selected').val !== "none") { licence = '' + '\n' + $('#UploadDescription').val; } else { licence = $('#UploadDescription').val; }                       console.log(licence); $('#loading' + (i + 1)).css('display', 'initial'); MultiUpload.uploadfiles(file, filename, licence); }                   alert(i18n.success); $('#go').html(i18n.reset); $('#go').removeAttr('disabled'); $('#go').click(function (event) {                       if ($('#go').html == i18n.reset) {                        event.stopPropagation;                        $('#WikiaArticle').find('*').attr("disabled", false);                        $('#editor').html();                        $('#editor').css('display', 'none');                        $('#go').html(i18n.update);                        $('#fileinput').val();                        }                    }); }           }        },        uploadfiles: function (fileToUpload, fileName, licence) { var lFileName = fileName; formdata = new FormData; //see https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects?redirectlocale=en-US&redirectslug=Web%2FAPI%2FFormData%2FUsing_FormData_Objects formdata.append('action', 'upload'); formdata.append('filename', lFileName); formdata.append('token', mw.user.tokens.get('editToken')); formdata.append('file', fileToUpload); formdata.append('text', licence); formdata.append('format', 'json'); //as we now have created the data to send, we send it... $.ajax({ //http://stackoverflow.com/questions/6974684/how-to-send-formdata-objects-with-ajax-requests-in-jquery               url: mw.util.wikiScript('api'), //url to api.php                 contentType: false,                processData: false,                type: 'POST',                data: formdata, //the formdata object we created above                dataType: 'json',                async: false,                success: function (data) {                    //        console.log(data);                    if (data.upload.result == 'Warning') {                        if (data.upload.warnings.hasOwnProperty('duplicate')) {                            //if file is a duplicate, we use the name of the first existing file                            lFileName = data.upload.warnings.duplicate[0];                            alert(i18n.duplicate + lFileName);                            MultiUpload.uploadfinished(false); } else if (data.upload.warnings.hasOwnProperty('exists')) { lFileName = prompt(i18n.alreadyname, lFileName); if (lFileName !== null) { lFileName = MultiUpload.uploadfiles(fileToUpload, lFileName, licence); } else { MultiUpload.uploadfinished(false); }                       }                    } else { MultiUpload.uploadfinished(true); }               },                error: function (xhr, status, error) { alert(error); MultiUpload.uploadfinished(false); }           });        },        uploadfinished: function (result) {            if (result) {                $('#loading' + (i + 1) + ' > img').attr('src', 'http://vignette4.wikia.nocookie.net/guigui/images/e/ef/Success.png/revision/latest?cb=20141230103851&path-prefix=fr');            } else {                $('#loading' + (i + 1) + ' > img').attr('src', 'http://vignette1.wikia.nocookie.net/guigui/images/8/8a/Problem.png/revision/latest?cb=20141230110222&path-prefix=fr');            }        }    };    $('#WikiaArticle').on("click", "#go", function  { MultiUpload.update; });   MultiUpload.init; // Start script })(jQuery); //

/*
 * Rollback
 * Perform rollbacks without needing to be in the usergroup
 * @author Ozuzanna

mw.loader.using('mediawiki.api', function {

var main = { init: function { //check if conventional rollback links are present if ($('.mw-rollback-link').length) return; if (mw.config.get('wgAction') == "history" && $('#pagehistory li').length > 1) $('#pagehistory li:first .mw-history-undo a').before(' <a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a> | '); else if (mw.config.get('wgCanonicalSpecialPageName') == "Contributions") { $('#mw-content-text ul').find('li').each(function {				if ($(this).find('.mw-uctop').length)					$(this).append(' [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + $(this).find('a:first').attr('title') + '">rollback</a>] ');			}); }		else if (($.getUrlVar('diff') || $.getUrlVar('oldid')) && $('#differences-nextlink').length === 0) $('.mw-usertoollinks:last').after('   [<a style="cursor: pointer" title="&quot;Rollback&quot; reverts edit(s) to this page of the last contributor in one click" data-id="' + mw.config.get('wgPageName') + '">rollback</a>] '); $('.mw-custom-rollback-link a').click(function {			main.getRevisionIdAndContent($(this).attr('data-id'));			$(this).parent.remove;		}); },	getRevisionIdAndContent: function(title) { var API = new mw.Api; API.get({		action: 'query',		prop: 'revisions',		titles: title,		rvprop: 'user|ids',		rvlimit: 500,		cb: new Date.getTime		}) .done(function(d) {			if (!d.error) {				var revisions;				for (var i in d.query.pages) {					revisions = d.query.pages[i].revisions;				}				var currentUser = revisions[0].user, //current user rollbacking from				lastUser,				revId;				for (var i in revisions) {					if (revisions[i].user != currentUser) {						lastUser = revisions[i].user; //remember last author						revId = revisions[i].revid; //get revision to revert to						break;					}				}				if (lastUser) {					API.get({ action: 'query', prop: 'revisions', rvprop: 'content', revids: revId, cb: new Date.getTime })					.done(function(d) { if (!d.error) { var content = ""; //can be no content on page so initialise empty as failsafe for (var i in d.query.pages) { if (d.query.pages[i].revisions) content = d.query.pages[i].revisions[0]["*"]; }							main.performRollback(title,content,currentUser,lastUser); }						else new BannerNotification('Unable to rollback (failed to get page content): ' + d.error.code,'error').show; })					.fail(function { new BannerNotification('Unable to rollback: failed to get page content!','error').show; });				}				else					new BannerNotification('Unable to rollback: no different editor found!','error').show;			}			else				new BannerNotification('Unable to rollback (failed to get revisions): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to get revisions!','error').show;		}); },	performRollback: function(page,text,user,user2) { var API = new mw.Api, summary = 'Undo Spam/Vandalism'; if (summary.length > 150) summary = 'Undo Spam/Vandalism'; API.post({		action: 'edit',		title: page,		text: text,		summary: summary,		token: mw.user.tokens.values.editToken		}) .done(function(d) {			if (!d.error) {				new BannerNotification('Rollback successful!','confirm').show;							}			else				new BannerNotification('Unable to rollback (failed to publish edit): ' + d.error.code,'error').show;		}) .fail(function {			new BannerNotification('Unable to rollback: failed to publish edit!','error').show;		}); } };

main.init; });

/* FULL CREDITS GOES TO SONAKO WIKIA */ // ==UserScript== // @name TopAndDownButtonsEverywhere // @description Top and Down buttons everywhere (no Jquery) // @version 1.6 // @author Max Max // @license MIT // @include * // @icon http://pics.smotri.com/cskins/blue/smiles/bt.gif // @run-at document-end // @grant none // ==/UserScript== // create element function ce(n) { return document.createElement(n); } // end of function // global variables var position, // figure out if this is moz || IE because they use documentElement el = (navigator.userAgent.indexOf('Firefox') != -1 || navigator.userAgent.indexOf('MSIE') != -1) ? document.documentElement : document.body, // timer t1, t2, // speed by speed_by_click = 200, // edit this value speed_by_over = 100, // edit this value // z-index zIindex = 1001;      // edit this value // move up function move_up { position = document.documentElement.scrollTop || document.body.scrollTop; window.scrollTo(0, position-1); t1 = setTimeout(move_up, speed_by_over); } // end of function // move downn function move_dn { position = document.documentElement.scrollTop || document.body.scrollTop; window.scrollTo(0, position+1); t2 = setTimeout(move_dn, speed_by_over); } // end of function // document height function getDocumentHeight { return (document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight; } // end of function // document scroll function get_scroll(a) { var d = document, b = d.body, e = d.documentElement, c = "client" + a,       a = "scroll" + a;    return /CSS/.test(d.compatMode)? (e[c]< e[a]) : (b[c]< b[a]) } // end of function // calk function scrollTo(element, to, duration) { var start = element.scrollTop, change = to - start, currentTime = 0, increment = 20, newDuration = (typeof(duration) === 'undefined') ? 500: duration; var animateScroll = function{ currentTime += increment; var val = Math.easeInOutQuad(currentTime, start, change, newDuration); element.scrollTop = val; if(currentTime < newDuration) { setTimeout(animateScroll, increment); } };   animateScroll; } // end of function //t = current time //b = start value //c = change in value //d = duration Math.easeInOutQuad = function (t, b, c, d) { t /= d/2; if (t < 1) return c/2*t*t + b;   t--; return -c/2 * (t*(t-2) - 1) + b; }; function addStyle(css) { var head = document.head || document.getElementsByTagName('head')[0]; if (head) { var style = ce("style"); style.type = "text/css"; style.appendChild(document.createTextNode(css)); head.appendChild(style); } // end if } // end of function function shareCSS{ // variables var s='', img_up, img_dn; // img vs button img_up = 'data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB+SURBVDhPY1i1atV/amAGahgCMoNhaIGlS5cKAp19BoRBbLJcj2QILDJINwzoAmMgfoclIkBixkS5DI8hMJcRNgxoSBoOl6CnNZBhaVhdBjWE1MSJahjQkA4KEmYH2GUrV66cSYEhYB+AzKBtFiHkQqKiH6Ro1CDCQTWgYQQAs81DU0G/83sAAAAASUVORK5CYII='; img_dn = 'data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAUCAYAAACAl21KAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACPSURBVDhPY2DAAlatWvUfH8amB6vYqEGEg2pgw4iQ7cTKM6xcuXImsYpxqQOZAQ4woIIOCgzrQAl1oEFpZBiWhitFgwx7R4SBIDXYDYGZDFRgTMAwkCHGhBMRJMxwGUa8ITCbli5dKgg08AySN8+AxIhyCboiJMPIN4Qsm6miiYioxltawvSDYogohYTUAQC80UNTOht/YwAAAABJRU5ErkJggg=='; // button id   s+='#play_btn_up { position:fixed; right:350px; bottom:600px;z-index:'+zIindex+'; height:36px; width:36px; cursor:pointer; background:url('+img_up+') no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); border-radius:5px 0 0 5px; margin-top:-24px; }'; s+='#play_btn_dn { position:fixed; right:350px; bottom:560px; z-index:'+zIindex+'; height:36px; width:36px; cursor:pointer; background:url('+img_dn+') no-repeat scroll 50% 50% rgba(0, 0, 0, 0.7); border-radius:5px 0 0 5px; margin-top:-24px; }'; // button class s+='.play_btn { -webkit-transition-duration:0.5s linear; -o-transition-duration:0.5s linear; -moz-transition-duration:0.5s linear; transition-duration:0.5s linear; opacity:0.65; }'; s+='.play_btn:hover { opacity:1; }'; // append addStyle(''+s); } // end of function // main function create_btn_element { // get scroll var up, dn, scrolled, h = get_scroll('Height'); // exit if(!h) { return; } // end if	// add css shareCSS; // if 	if(el){ // create DOM element up = ce('span'); dn = ce('span'); // set attribute up.setAttribute('id','play_btn_up'); dn.setAttribute('id','play_btn_dn'); // set class up.className = "play_btn"; dn.className = "play_btn"; // append element document.body.appendChild(up); document.body.appendChild(dn); // scroll scrolled = window.pageYOffset || document.documentElement.scrollTop; // if scroll up.style.display = (scrolled > 0) ? "" : "none"; // add event over up.addEventListener('mouseover', move_up, false); dn.addEventListener('mouseover', move_dn, false); // add event out up.addEventListener('mouseout', function{clearTimeout(t1);},false); dn.addEventListener('mouseout', function{clearTimeout(t2);},false); // add event click up.addEventListener('click', function{ scrollTo(el, 0, speed_by_click); }, false); dn.addEventListener('click', function{ scrollTo(el, getDocumentHeight, speed_by_click); }, false); // add event scroll window.onscroll = function { var scrolled = window.pageYOffset || document.documentElement.scrollTop, diffHeight = document.body.scrollHeight - window.innerHeight; // if scroll up up.style.display = (scrolled > 0) ? "" : "none"; // if scroll dn dn.style.display = (diffHeight > scrolled) ? "" : "none"; }; // end of function } // end if } // end of function // run it create_btn_element;