User:Minato826/global.js

/*self import */ importArticles({   type: "script",    articles: [        'u:the-last-tycoon:User:Minato826/wikia.js'        ] });

importArticles({   type: "script",    articles: [        'u:travel:User:Minato826/wikia.js'        ] });

/* Imports from Dev */ importArticles({   type: "script",    articles: [        "u:dev:AjaxPatrol/code.js",        "u:dev:RedirectManagement/beta.js",        "u:dev:QuickCreateUserPage/code.js",        "u:dev:QuickCreateMessageWallGreeting/code.js"    ] });

//*Mass Categorization*// massCategorizationDelay = 1000; importScriptPage('MediaWiki:MassCategorization/code.js', 'dev');

/* view removed comments */ importArticles({   type: 'script',    articles: [        'u:dev:ViewRemovedAlways/code.js'    ] });

/*recent change from dev*/ importArticles({   type: "script",    articles: [        "u:dev:RecentChangesMultiple/code.2.js"    ] });

/*fast delete from dev*/ importArticles( {   type: 'script',    articles: [        'u:dev:Rollback/code.js',       ] } );

$( document ).ready( function { mw.util.addPortletLink( 'p-personal', mw.util.wikiGetlink('Special:NewPagesFeed'), 'Page Curation', 'pt-pagecuration', 'View Special:New Pages using the Page Curation tool', null, '#pt-preferences' ); });

//Turns rollback links into AJAX rollback links //By BenjaminWillJS

function SetAjaxRollback { $('a.mw-rollback-link').click(function(e) {		e.preventDefault;		var $rblink = $(this);		var href = this.getElementsByTagName('a')[0].href;		this.innerHTML = ' ';		$.ajax({ url: href, success: function { $rblink.text(function (i, val) {return val + ' [success]';}); loadPageData; },			error: function { $rblink.text(function (i, val) {return val + ' [failed]';}); loadPageData; }		});	}); }

// This script reimpliments the last edit banner used on mobile // See User:Opencooper/lastEdit // TODO: standardize on either single or double quotes

function requestRevision { // If we're not reading an article, do nothing if (!(mw.config.get( 'wgAction' ) === 'view' && mw.config.get( 'wgIsArticle' ) && mw.config.get("wgPageName") !== "Main_Page")) { return; }

// API docs: https://www.mediawiki.org/wiki/API:Revisions $.ajax({       url: "https://en.wikipedia.org/w/api.php?action=query&prop=revisions&format=json&titles="             + mw.config.get('wgPageName')             + "&rvprop=timestamp%7Cuser%7Ccomment%7Ctags%7Cids",        success: displayEdit    }); }

// Display the last edit info to the right of the site subhead function displayEdit(response) { var pageId = mw.config.get('wgArticleId'); var pageInfo = response.query.pages[pageId].revisions[0]; // Relies on moment.js. See script history for an inline implementation var relativeTimestamp = moment(pageInfo.timestamp).fromNow;

var editComment = pageInfo.comment; if (!editComment) { editComment = "[No edit summary]"; }   editComment = editComment.replace(/'/g, "&#39;"); // HTML encode quotes

var lastEdit = " Last edited " + relativeTimestamp + ""; var lastEditor = "" + pageInfo.user + ""; // Can be filtered if needed var pageTags = ""; if (pageInfo.tags.length > 0) { pageTags = " (" + pageInfo.tags + ") "; }

var notice = lastEdit + " by " + lastEditor + pageTags;

// MediaWiki:Gadget-metadata.js replaces the siteSub element so wait for it   // to run first // Check if script is enabled and if it hasn't ran already if ($("script").text.search("ext.gadget.metadata") != -1 && !$(".assess-article-rating").length) { var target = document.querySelector('#siteSub'); var observer = new MutationObserver(function(mutations) { // IE 11+           $('#siteSub').append(" " + notice + " ");            observer.disconnect;        });

observer.observe(target, {childList: true}); } else { $('#siteSub').append(" " + notice + " "); }

// Unfortunately Template:Coords absolutely positions itself so we have // to move it down so we don't get obscured var sheet = window.document.styleSheets[0]; sheet.insertRule('#coordinates { top: 2em !important; }', sheet.cssRules.length); }

$(requestRevision);

//From StarmanW // Always show bots--Full Credits goes to Dorumin $('a').each(function {  if ( $(this).attr('href') == '/wiki/Special:RecentChanges' ) {      $(this).attr('href', '/wiki/Special:RecentChanges?hidebots=0');   } }); // Remove MPC--Full Credits goes to Dorumin if ( $(".youtubeplayer").length ) { $('ul.tools li:first-child:not(.tools-menu li)').after('Remove MPC'); $(".removeMPC").click(function {       $(".youtubeplayer").remove;        $(".removeMPC").remove;    }); }

// TWEAKS $(function {   $(' RecentChanges  ').insertBefore('.wds-global-navigation__search');    $(' Admins  ').insertBefore('.wds-global-navigation__search');  });

//Linksweeper linkSweepConfirmation = true; LinkSweeperDelay = 1000;

//MassRename settings massRenameDelay = 1000;

//MassCat massCategorizationDelay = 500;

//Page Creator options var PCOptions = { namespaces: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 110, 111, 828, 829, 1202] };

// Fast Delete var fdButtons = []; fdButtons[fdButtons.length] = {'summary': 'spam','label': 'S'}; fdButtons[fdButtons.length] = {'summary': 'vandalism','label': 'V'}; fdButtons[fdButtons.length] = {'summary': 'Housekeeping','label': 'HK'}; fdButtons[fdButtons.length] = {'summary': 'Duplicate','label': 'D'}; fdButtons[fdButtons.length] = {'summary': 'Unused','label': 'U'}; fdButtons[fdButtons.length] = {'summary': 'Unofficial/Not-Needed/Irrelevant','label': 'UNI'}; fdButtons[fdButtons.length] = {'summary': 'Other reason','label': 'Other'};

$(window).load(function {   importArticles({ type: "script", articles: [ 'u:dev:MediaWiki:AjaxBatchDelete/code.js', 'u:dev:MediaWiki:AjaxBatchUndelete/code.js', 'u:dev:MediaWiki:AjaxDiff/code.js', 'u:dev:MediaWiki:AjaxRedirect/code.js', 'u:dev:MediaWiki:AjaxRename/code.js', 'u:dev:MediaWiki:AjaxRC/code.js', 'u:dev:MediaWiki:AjaxUndo/code.js', 'u:dev:MediaWiki:AutoEditDropdown/code.js', 'u:dev:MediaWiki:AntiSoundcloud/code.js', 'u:dev:MediaWiki:AnchoredRollback/code.js', 'u:dev:MediaWiki:CacheCheck/code.js', 'u:dev:MediaWiki:CategoryRenameAuto-update/code.js', 'u:dev:MediaWiki:ContribsLink/code.js', 'u:dev:MediaWiki:DisplayTimer/code.js', 'u:dev:MediaWiki:FastDelete/code.js', 'u:dev:MediaWiki:LastEdited/code.js', 'u:dev:MediaWiki:Linksweeper/code.js', 'u:dev:MediaWiki:MassRename/code.js', 'u:dev:MediaWiki:MassRenameRevert/code.js', 'u:dev:MediaWiki:MassCategorization/code.js', 'u:dev:MediaWiki:MultipleFileDelete/code.js', 'u:dev:MediaWiki:Nuke/code.js', 'u:dev:MediaWiki:PortableCSSPad/code.js', 'u:dev:MediaWiki:PageCreator/code2.js', 'u:dev:MediaWiki:QuickCreateUserPage/code.js', 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js', 'u:dev:MediaWiki:RevealAnonIP/code.js', 'u:dev:MediaWiki:RedirectManagement/code.js', 'u:dev:MediaWiki:SearchSuggest/code.js', 'u:dev:MediaWiki:View_Source/code.js', 'u:dev:MediaWiki:ViewRemovedAlways/code.js', 'u:starmanw:MediaWiki:MultiUpload/code.js', 'u:starmanw:MediaWiki:QuickLogs/code.js', 'u:kocka:MediaWiki:AjaxThreadDelete/code.js', 'u:dev:MediaWiki:UserAccountAge/code.js', 'u:kocka:User:KockaAdmiralac/UnhideUserWikis.javascript' ]   }); });