User:Sophiedp/global.js

/* Show bots in RecentChanges */ //@author-Foodbandlt if (wgPageName == "Special:RecentChanges") { if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") == -1) { window.location.href = window.location.href + "?hidebots=0"; } else if (window.location.href.indexOf("hidebots=") == -1 && window.location.href.indexOf("?") !== -1) { window.location.href = window.location.href + "&hidebots=0"; } }

/* Show removed replies on threads */ $(".message-removed.hide").removeClass("hide");

/* Remove the part of the url that opens the editor on redlinks */ var head = $('a[href$="?action=edit&redlink=1"]'); if (head.attr("href")) { //if ?action=edit&redlink=1 is in the url head.attr("href", head.attr("href").replace("?action=edit&redlink=1", "")); //remove it }

/* Toolbar things */ //Make the wiki code menu take up less room mw.util.addCSS('ul#custom-links-menu-wikicode.tools-menu {line-height: 0;}'); //Link to subpages $('', {id: 'subpages'}).html('Subpages').prependTo('#my-tools-menu'); //Wiki code pages menu (function { var addCode = ' ' +                 '  ' +                  'Wiki Code'; addCode += ''; $( '.mytools' ).after( addCode ); WikiaFooterApp.init; }); $('', {id: 'common.css'}).html('Common.css').prependTo('#custom-links-menu-wikicode'); $('', {id: 'chat.css'}).html('Chat.css').prependTo('#custom-links-menu-wikicode'); $('', {id: 'wikia.css'}).html('<a href="/wiki/MediaWiki:Wikia.css">Wikia.css</a>').prependTo('#custom-links-menu-wikicode'); $('', {id: 'common.js'}).html('<a href="/wiki/MediaWiki:Common.js">Common.js</a>').prependTo('#custom-links-menu-wikicode'); $('', {id: 'chat.js'}).html('<a href="/wiki/MediaWiki:Chat.js">Chat.js</a>').prependTo('#custom-links-menu-wikicode'); $('', {id: 'wikia.js'}).html('<a href="/wiki/MediaWiki:Wikia.js">Wikia.js</a>').prependTo('#custom-links-menu-wikicode'); $('', {id: 'importjs'}).html('<a href="/wiki/MediaWiki:ImportJS">ImportJS</a>').prependTo('#custom-links-menu-wikicode'); $('', {id: 'jspages'}).html('<a href="/wiki/Special:JSPages">JS Pages</a>').prependTo('#custom-links-menu-wikicode');

/* Global nav links */ //Add new links $('<a class="wds-global-navigation__dropdown-link" href="http://community.wikia.com/wiki/User:Sophiedp/global.js">Global.js</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://community.wikia.com/wiki/User:Sophiedp/global.css">Global.css</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://steven-universe.wikia.com/wiki/User:Sophiedp/common.js">Common.js (SU)</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://steven-universe.wikia.com/wiki/User:Sophiedp/chat.js">Chat.js (SU)</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://steven-universe.wikia.com/wiki/User:Sophiedp/common.css">Common.css (SU)</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://steven-universe.wikia.com/wiki/User:Sophiedp/chat.css">Chat.css (SU)</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); $('<a class="wds-global-navigation__dropdown-link" href="http://starmanw.wikia.com/wiki/User:Sophiedp/common.js">Common.js (SW)</a></li>').insertBefore('.wds-global-navigation__wikis-menu li:last'); //Remove old links $('.wds-global-navigation__wikis-menu > div > ul.wds-list > li:has(a[data-tracking-label="link.explore"])').remove; $('.wds-global-navigation__wikis-menu > div > ul.wds-list > li:has(a[data-tracking-label="link.fandom-university"])').remove; $('.wds-global-navigation__wikis-menu > div > ul.wds-list > li:has(a[data-tracking-label="link.community-central"])').remove; //Change the title of the menu var spans = document.getElementsByTagName("span"); for(var i=0;i<spans.length; i++) { if(spans[i].innerHTML == "Wikis") { spans[i].innerHTML = "Links"; break; } }

/* Code to create my userpage or message wall greeting by clicking on a link */ if (wgCityId !== "621556") { //don't run on suwiki /* Create my userpage */ //Modified version of QuickCreateUserPage $('', {       id: 'qcup',    }).html('<a href="#">Create user page</a>') //create the link .prependTo('.toolbar .tools') //put it in the toolbar .click(function { //when clicked       $.ajax( { //create the userpage type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'User:Sophiedp', //at this page summary: 'Creating user page (script)', //with this edit summary text: '', //using this tempalte format: 'json', token: mw.user.tokens.get( 'editToken' ) }       } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; //say we created the page } else { new BannerNotification("An error occurred.","error").show; //say we didn't create the page }       } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; //say we didn't create the page } );   });    /* Create my messaage wall greeting */ //Modified version of QuickCreateMessageWallGreeting $('', {       id: 'qcmwg',    }).html('<a href="#">Create Greeting</a>') //create the link .prependTo('#my-tools-menu') //put it in the my tools menu on the toolbar .click(function { //when clicked       $.ajax( { //create the message wall greeting type: 'POST', url: mw.util.wikiScript( 'api' ), dataType: 'json', data: { action: 'edit', title: 'Message_Wall_Greeting:Sophiedp', //at this page summary: 'Creating message wall greeting (script)', //with this edit summary text: '', //using this template format: 'json', token: mw.user.tokens.get( 'editToken' ) }       } ).done( function ( data ) { if ( data.edit.result === 'Success' ) { new BannerNotification("Successfully created page!","confirm").show; //say we created the page } else { new BannerNotification("An error occurred.","error").show; //say we didn't create the page }       } ).fail( function ( data ) { new BannerNotification("An error occurred.","error").show; //say we didn't create the page } );   }); }

/* Staff/VSTF/Bot/Helper highlights */ importStylesheetPage('Highlight/code.css', 'dev');

/* WLB highlights */ importStylesheetPage('MediaWiki:WLBhighlight.css', 'wlb');

/* Imports */ importArticles({   type: "script",    articles: [        'u:dev:MediaWiki:CacheCheck/code.js', //cross out items already done        'u:dev:MediaWiki:MarkBlocked.js', //cross out blocked users        'u:dev:MediaWiki:AjaxRC/code.js', //auto refresh pages        'u:dev:MediaWiki:LastEdited/code.js', //show who last edited the page        'u:dev:MediaWiki:AjaxUndo/code.js', //undo with one click        'u:dev:MediaWiki:HoverEditCount/code.js', //show editcount when hovering over editcount on global masterhead        'u:dev:MediaWiki:QuickDiff/code.js', //show diffs in a popup        'u:dev:MediaWiki:ContribsLink/code.js', //add a contribs link in the account nav menu        'u:dev:MediaWiki:DupImageList/code.js', //list duplicate images        'u:dev:MediaWiki:DisplayTimer/code.js', //show a UTC clock in the toolbar, click to purge and shift + click to null edit        'u:dev:MediaWiki:Linksweeper/code.js', //remove links on pages 'u:dev:MediaWiki:RecentChangesMultiple/code.2.js' //better RecentChanges ] });