User:2ABot/global.js

importArticle({type:'script', article:'w:c:dev:UserTags/code.js'}); window.UserTagsJS = { modules: {} }; /* Users who are not longer than 5 days on the wiki, haven't made more than 10 edits and the edits have to be made on articles */ UserTagsJS.modules.newuser = { days: 3, // Must have been on the Wiki for 3 days edits: 5, // And have at least 5 edits to remove the tag namespace: 0 // Edits must be made to articles to count }; /* Users who aren't longer than 4 days on Wikia and haven't made somewhere on Wikia more than 10 edits */ UserTagsJS.modules.autoconfirmed = true; // Switch on /* Users who haven't made an edit for 30 days */ UserTagsJS.modules.inactive = 30; // 30 days /* View IP-address of anonymous editors */ importArticles({   type: "script",    articles: [        "w:c:dev:RevealAnonIP/usercode.js"    ] }); /* Categories */ importScriptPage('MassCategorization/code.js', 'dev'); /* Sending Multiple Messages */ importArticles({   type: 'script',    articles: [        'u:dev:Message/code.js'    ] }); /* Fast doing admin actions */ importScriptPage('WHAM/code.2.js', 'dev'); "w:c:dev:WHAM/code.js", /* Admin/Mod Tools */ importArticles({	type: "script",	articles: [		"u:dev:QuickModTools/loader.js"	] }); QuickModTools = { quickreasons: [ "Spam", "Vandalism", "Inappropriate", "Swearing" ],	defbanreason: "-" } importArticles( {   type: 'script',    articles: [        // ...        'u:dev:ChatBlockButton/code.js',        // ...    ] } ); /* Switching Skin */ importScriptPage('SkinSwitchButton/code.js', 'dev'); /* Deleting Pages */ importScriptPage('AjaxBatchDeleteV2/code.js', 'dev'); /* Purging */ importArticle({   type: 'script',    article: 'u:dev:NullEditButton/code.js' }); /* Last Edit Information */ importArticles( {   type: 'script',    articles: [        // ...        'u:dev:LastEdited/code.js',        // ...    ] } ); window.lastEdited = { position: 'top', size: false, diff: true, comment: false, time: true }; /* Reverting Renamed Pages */ importScriptPage('MassRenameRevert/code.js', 'dev');

/* Solving Double/Broken Redirects */ importScriptPage('RedirectManagement/code.js', 'dev'); /* Renaming Categories */ importScriptPage("CategoryRenameAuto-update/code.js", "dev"); /* Rename Pages */ importScriptPage( 'AjaxRename/code.js', 'dev' ); /* Updating links when renaming a page */ importScriptPage("PageRenameAuto-update/code.js", "dev"); /* Category Stuff */ importScriptPage("MediaWiki:Gadget-HotCat.js", "a"); /* Deleting Stuff */ batchDeleteDelay = 1000; importScriptPage('AjaxBatchDelete/code.2.js', 'dev'); /* Undo Stuff */ importScriptPage( 'AjaxUndo/code.js', 'dev' ); /* Undelete Stuff */ importArticle({   type: 'script',    article: 'u:dev:AjaxBatchUndelete/code.js' }); /* Patrolling Edits */ importScriptPage('AjaxPatrol/code.js', 'dev' ); /* Deleting Pages from Page */ window.fdButtons = []; window.fdButtons[window.fdButtons.length] = { summary: 'Housekeeping', label: 'HK' }; window.fdButtons[window.fdButtons.length] = { summary: 'Empty', label: 'E' }; window.fdButtons[window.fdButtons.length] = { summary: 'Vandalism', label: 'V' }; window.fdButtons[window.fdButtons.length] = { summary: 'Spam', label: 'S' }; window.fdButtons[window.fdButtons.length] = { summary: 'Advertizing', label: 'A' }; importArticles( {   type: 'script',    articles: [        // ...        'u:dev:FastDelete/code.js',        // ...    ] } ); /* Auto Refresh */ AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page'; ajaxPages = ["Special:RecentChanges","Special:WikiActivity"]; importScriptPage('AjaxRC/code.js', 'dev'); /* Back to top Button */ importArticles({   type: "script",    articles: [        // Back to top button        "w:c:dev:BackToTopButton/code.js"    ] }); /* SearchSuggest */ importArticles({   type: 'script',    articles: [        'u:dev:SearchSuggest/code.js'    ] }); /* Adds cancel button above edit screen */ importScriptPage('MediaWiki:Wikia.js/cancelButton.js', 'admintools'); // Adding "My Contributions" to user menu. // Function: Adds "My Contributions" to the UserDropdownMenu. function UserContribsMenuItem { $('ul.AccountNavigation li:first-child ul.subnav li:first-child').after('My Contributions'); } addOnloadHook(UserContribsMenuItem); function onloadhookcustom { var replace = document.getElementById("OnlineChat"); if (null != replace) { var getvalue = replace.getAttribute("class"); } } /* Mark for Deletion */ importArticles({   type: "script",    articles: [        "u:dev:MarkForDeletion/code.js"    ] }); /* Duplicate Images List */ importScriptPage('DupImageList/code.js', 'dev'); /* Auto Edit Pages */ /*importArticles({   type: 'script',    articles: [        'u:dev:AutoEditPages/code.js'    ] });

//Inspired from http://dev.wikia.com/wiki/MassNullEdit and http://dev.wikia.com/wiki/CategoryRenameAuto-update if (mw.config.get('skin') === 'monobook') { mw.util.addPortletLink('creates', '#', 'AutoEditPages', 'creates'); } else { if ($('.creates').length == 0) { $('#AccountNavigation > li > .subnav > li:last-child').after(              $('').append('AutoEditPages')             ); $('#my-tools-menu').prepend(' AutoEditPages'); }      }    function callAPI(data, method, callback) { data['format'] = 'json'; $.ajax({                           data: data,                            dataType: 'json',                            url: wgScriptPath + '/api.php',                            type: method,                            success: function(data) {                    if (!data.error) {             console.log('Succesful !');                    } else {             console.log('Failed.');                    $('#text-error-output').append('Failed to edit page : '+data.error.info+' ');                    }                            },                            error: function(xhr, error) { showError('AJAX error: ' + error.info); }                    }); }   function deletetemplate(template, page) { console.log(template + '|' + page); $.get(mw.util.wikiScript( 'api' ), {                           'action': 'query',                            prop: 'info|revisions',                            intoken: 'edit',                            titles: page,                            rvprop: 'content',                            rvlimit: '1',                            indexpageids: 'true',                            format : 'json'                    }, function( response ) {                            var pages = response.query.pages[response.query.pageids[0]];                            var content = pages.revisions[0]['*'];                            var templates = '',templatestart); console.log(templatestart + '|||' + templateend); var templateall = content.substring(templatestart,templateend + 2); content = content.replace(templateall,""); console.log('Content : ' + content); $.post(mw.util.wikiScript( 'api' ), {                                   minor : true,                                    format : 'json',                                    summary : 'Deleted template :' + template,                                    action : 'edit',                                    title : page,                                    basetimestamp : pages.revisions[0].timestamp,                                    startimestamp : pages.starttimestamp,                                    token : pages.edittoken,                                    text : content                            }, function( data ) {                    if (!data.error) {             console.log('Succesful !');                    } else {             console.log('Failed.');                    $('#text-error-output').append('Failed to edit page '+page+': '+data.error.info+' ');                    } });                   });    }    var pages; function posts(pages,content) { var actions; actions = $('.adding:checked').val + "text"; if (actions == "appendtext") { $.post(mw.util.wikiScript( 'api' ), {                   format: 'json',                    action: 'edit',                    title: encodeURIComponent(pages),                    appendtext: content,                    minor: true,                    bot: true,                    token: mw.user.tokens.get("editToken")            }, function( data ) {                    if (!data.error) {             console.log('Succesful !');                    } else {             console.log('Failed.');                    $('#text-error-output').append('Failed to edit page '+pages+': '+data.error.info+' ');                    }      }); } else { $.post(mw.util.wikiScript( 'api' ), {                   format: 'json',                    action: 'edit',                    title: pages,                    prependtext: content,                    minor: true,                    bot: true,                    token: mw.user.tokens.get("editToken")            }, function( data ) {                    if (!data.error) {             console.log('Edit of '+pages+ ' has been made successfully !');                    } else {             console.log('Failed.');                    $('#text-error-output').append('Failed to edit page '+pages+': '+data.error.info+' ');                    }      }); }     setTimeout(init, 1000); }   function addpages(category) { if (!category) { return false; }           $.getJSON("/api.php?action=query&list=categorymembers&cmtitle=Category:" + encodeURIComponent(category) + "&cmprop=title&cmlimit=5000&format=json", function(result){                    var categoryUsage = result.query.categorymembers;                    console.log(categoryUsage);                    console.log("Category usage successfully retrieved");                    if (categoryUsage.length > 0){                    for (var currentPage = 0; currentPage < categoryUsage.length; currentPage++){                            var title = categoryUsage[currentPage].title;                            if (title) {                                    $('#Names').val($('#Names').val + title + "\n");                            }                    }    }    }); alert('Done !'); }   function init { page = pages[0]; content = $('#Text').val; $('#startButton').prop('disabled',true); if (!pages || !content) { alert('Please fill the text and pages inputs'); return false; }         if (page == null ) { $('#startButton').prop('disabled',false); $('#text-error-output').append('Done !').css("background-color", "green"); return false; } else { pages = pages.slice(1,pages.length); $('#Names').val(pages.join('\n')); posts(page,content); }      }      var form = '\  \ \          \               Append \ Prepend \ \               Text to add :  \ Pages :  \ Add pages from a category :  \ Remove template from the pages above : <input type="text" id="Templatetodelete"/> \ <div id="text-error-output" style="height:10em; background-color: #ffbfbf; height: 150px; font-weight: bold; border: 1px solid black; overflow: scroll">Any errors encountered will appear below \ \    ';    $('.creates').click(function {    $.showCustomModal("Add contents to pages", form, { id: 'writeafter', width: 500, buttons: [{ id: 'startButton', message: 'Submit', defaultButton: true, handler: function { pages = $('#Names').val.split('\n'); init; }       },        {           id: 'Categorysubmit', message: 'Add pages from the category', handler: function { var categoryname = $('#Categoriename').val; addpages(categoryname); }       },        {           id: 'Template', message: 'Remove this template from pages above', handler: function { var template = $('#Templatetodelete').val; if (!template) { return false; }              pages = $('#Names').val.split('\n'); for (i=0;i<pages.length;i++) { deletetemplate(template,pages[i]); }           }        },        {            message: 'Close', handler: function { $('#writeafter').closeModal; location.reload; }       }]      });    }); //