User:DEmersonJMFM/global.js

// ********* IF COPIED, APPROPRIATE ATTRIBUTION REQUIRED **********

// ************************************************ // AjaxRC config - http://dev.wikia.com/wiki/AjaxRC // ************************************************

ajaxPages = ["Special:WikiActivity","Special:RecentChanges","Special:Watchlist","Special:Log","Special:Contributions"]; ajaxRefresh = 30000; /* 30 seconds */ AjaxRCRefreshText = 'Auto-refresh'; AjaxRCRefreshHoverText = 'Automatically refresh the page';

// ********************************************************************* // Oasis Improvements config - http://dev.wikia.com/wiki/AdvancedOasisUI // *********************************************************************

window.AdvancedOasisUI = { accountNavFollowedPages: true, accountNavWatchlist: false, categoryRedlink: true, RCHeader: false, DefaultSourceMode: true, lightbox: true, randomPageLimitedTo: '', activity2RC: false, userLang: true, };

// ***************************************************** // UTC Clock config - http://dev.wikia.com/wiki/UTCClock // ***************************************************** window.DisplayClockJS = { format: "%2H:%2M:%2S %p %2d %B %Y (UTC)" };

// ******************************************************************** // No Image Lightbox config - http://dev.wikia.com/wiki/NoImageLightbox // ********************************************************************

window.NoImageLightbox = { novideo: true };

// ********************************************************************* // Back-To-Top Button config - http://dev.wikia.com/wiki/BackToTopButton // *********************************************************************

window.BackToTopStart = 200; window.BackToTopSpeed = 500;

// ********************************************************************** // Minor Edit Timeout config - http://dev.wikia.com/wiki/MinorEditTimeout // **********************************************************************

minorEditTimeout = 60000;

// ************************************************************** // YoutubePlayer config - http://dev.wikia.com/wiki/YoutubePlayer // **************************************************************

window.YoutubePlayerDisableAutoplay = true;

// ***************************** // Beginning of Script importing // ***************************** importArticles({   type: "script",    articles: [        'w:c:dev:MediaWiki:UTCClock/code.js',                        // Wikia Clock (UTC)        'w:c:dev:MediaWiki:WHAM/code.2.js',                          // Quick Tools        'w:c:dev:MediaWiki:AjaxRC/code.js',                          // Ajax Refresh Feeds        'w:c:dev:MediaWiki:StickySummary.js',                        // Auto Summaries        'w:c:dev:MediaWiki:ListFiles/code.js',                       // File Management        'w:c:dev:MediaWiki:CacheCheck/code.js',                      // Cross Resolved Special Entries        'w:c:dev:MediaWiki:MassNullEdit/code.js',                    // Null Edits in mass        'w:c:dev:MediaWiki:NullEditButton/code.js',                  // Null Edit Drop Option        'w:c:dev:MediaWiki:AntiSoundcloud/code.js',                  // Kill Soundcloud Autoplay        'w:c:dev:MediaWiki:NoImageLightbox/code.js',                 // Remove 'Popup' Window 'w:c:dev:MediaWiki:AjaxBatchDelete/code.js',                // Batch Delete //     'w:c:dev:MediaWiki:CleanWantedFiles/code.js', Until bugs fixed  Fix WantedFiles redlinks 'w:c:dev:MediaWiki:AdvancedOasisUI/code.js',                // Oasis Improvements 'w:c:dev:MediaWiki:BackToTopButton/code.js',                // Back-to-the-top Button 'w:c:dev:MediaWiki:MinorEditTimeout/code.js',               // Auto Uncheck Non-Minor Edits 'w:c:dev:MediaWiki:SkinSwitchButton/code.js',               // Fast Skin Switch 'w:c:dev:MediaWiki:Thread Inspection/code.js',              // View Deleted Thread Posts 'w:c:dev:MediaWiki:MassCategorization/code.js',             // Mass Addition/Removal of Categories 'w:c:dev:MediaWiki:WallGreetingButton/code.js',             // Add Greeting Button to MW        'w:c:dev:MediaWiki:CategoryRenameAuto-update/code.js',       // Rename Categories Quickly 'w:c:dev:MediaWiki:PageRenameAuto-update/code.js',          // Update page links when renamed 'w:c:dev:MediaWiki:FileUsageAuto-update/code.js',           // Rename file names on articles after move 'w:c:dev:MediaWiki:ExpandGlobalNavDropdownsOnHover/code.js' // Restore Hovering Of Dropdown Menus ] });

// *************************************************************************** // Kill Specific Dev Scripts Imported Wiki-Wide (Opt-out) - Created by Saftzie // ***************************************************************************

if (typeof localStorage === 'object') { localStorage['optoutPowerPageMaker'] = '1'; localStorage['optoutPageMakerPro'] = '1'; } else { $.cookie('optoutPowerPageMaker', '1', {path: '/'}); $.cookie('optoutPageMakerPro', '1', {path: '/'}); }

// ***************************************************************** // Add Extra AccountNav Options (Modified) - Created by SpikeToronto // *****************************************************************

if(!window.CustomButtonsLoaded) addOnloadHook(addCustomLinks); var CustomButtonsLoaded = true; function addCustomLinks { $('Wikia.js').insertBefore('.wds-global-navigation__user-menu .wds-dropdown__content li:last'); $('Wikia.css').insertBefore('.wds-global-navigation__user-menu .wds-dropdown__content li:last'); }

// ******************************************************** // Remove AutoSummary During Deletion - Created by Josephyr // ********************************************************

$(function {    // Clears the delete additional reason box if it's an autosummary    if (wgAction && wgAction === "delete") {        var deleteBox = document.getElementsByName("wpReason")[0];        if (deleteBox && deleteBox.value.search("content was") === 0) {            deleteBox.value = "";        }    } });

// ******************************************************************************************************* // Change Input Type of Edit Summary From Text To TextArea - Created by Slyst // Used with Editing Layout Improvements (Classic Rich-Text Editor) in User:DEmersonJMFM/classiceditor.css // *******************************************************************************************************

if ($.getUrlVar('action') == 'edit' &&  $('#wpSummary').length &&   !mw.config.get('wgEditPageWideSourceMode')   ) { var val = ''; if ($('#wpSummary').val) { val = $('#wpSummary').val; }   $('#wpSummary').replaceWith($(' ').attr({ id: 'wpSummary', name: 'wpSummary', placeholder: 'Add a summary of your edit' }).val(val)); }

// ********************************************************************** // Red Link Fixer (Modified) - Created by Madnessfan34537 and Monchoman45 // **********************************************************************

$('#my-tools-menu').append(' Fix redlinks'); function FixRedlinks { $.getJSON('/api.php?action=query&prop=revisions&titles=' + wgPageName + '&rvprop=content&indexpageids=1&format=json', function(result) {                   var text = result.query.pages[result.query.pageids[0]].revisions[0]['*'];                    var redlinks = $('a.new');                    var ref = 0;                    while(text.indexOf(, ref) != -1) {                            if(text.indexOf(, text.indexOf(, open);                                    var close = text.indexOf(, open);                                    if(text.indexOf(' ', open) != -1 && text.indexOf(' ', open) < close) {ref = open + 1; continue;}                                    if(pipe != -1 && pipe < close) { //is display                                            if(pipe == close - 1) { var title = text.substring(open + 2, pipe); var display = title.substring(title.indexOf(':') + 1); }                                           else { var title = text.substring(open + 2, pipe); var display = text.substring(pipe + 1, close); }                                   }                                    else { //is page var title = text.substring(open + 2, close); var display = title; }                                   if(!title) {ref = open + 1; continue;} //skip  and | for(var i = 0; i < redlinks.length; i++) { var utitle = title[0].toUpperCase + title.substring(1); if(redlinks[i].title.indexOf(' (page does not exist)')) {var redlink = redlinks[i].title.substring(0, redlinks[i].title.length - 22);} else {var redlink = redlinks[i];} if(utitle == redlink || utitle == ':' + redlink) { if(pipe == close - 1) {var show = title;} else {var show = display;} text = text.substring(0, open) + show + text.substring(close + 2); break; }                                   }                                    ref = open + 2; }                           else {break;} }                   $.getJSON('/api.php?action=query&prop=info&titles=' + wgPageName + '&intoken=edit&indexpageids=1&format=json', function(result) {                            var token = result.query.pages[result.query.pageids[0]].edittoken;                            $.post('/api.php', {action: 'edit', title: wgPageName, text: text, summary: 'Housekeeping: Fixing redlinks', token: token}, function {window.location.reload;});                    }); });   }