User:Kanegasi/common.js

From Minecraft Wiki
Jump to: navigation, search

Documentation may be created at User:Kanegasi/common.js/doc.

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold ⇧ Shift while clicking Reload, or press either Ctrl+F5 or Ctrl+R (⌘ Cmd+R on a Mac)
  • Google Chrome: Press Ctrl+⇧ Shift+R (⌘ Cmd+⇧ Shift+R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl+F5
  • Opera: Clear the cache in Tools → Preferences
mw.loader.localLoad = function (url) { return mw.loader.load('http://minecraft.gamepedia.com/index.php?title=' + url + '&action=raw&ctype=text/javascript'); };


/* Replaces IPs with their known owner, publicly acknowledged by that user */
$('.mw-userlink[title$="82.69.54.207"]').attr({ title: 'User:Simons Mith (IP)' }).text('Simons Mith');


/* Allows rollback summary to be edited */
mw.loader.localLoad('User:Majr/editableRollback.js');


/* Warns user if any pages are tagged for deletion */
mw.loader.localLoad('User:Kanegasi/pendingdeletion.js');


/* Changes vector menu items into tabs */
$('#p-cactions').addClass('emptyPortlet').find('> .menu li').addClass('collapsible').find('a').wrap('<span/>');
$('#p-views > ul').append($('#p-cactions > .menu li'));


if (mw.config.get('wgPageName') !== 'Special:RecentChanges') {


/* Counts all your edits and saves them to a page ( http://en.wikipedia.org/wiki/User:Kanegasi/editcounter ) */
if (mw.config.get('wgTitle') === mw.config.get('wgUserName') && mw.config.get('wgNamespaceNumber') === 2) {
    var subPages = 'true';
    var nameSpaces = new Array();
    nameSpaces[3] = 'Utalk';
    nameSpaces[4] = 'MCW';
    nameSpaces[5] = 'MCWtalk';
    nameSpaces[7] = 'Ftalk';
    nameSpaces[8] = 'MW';
    nameSpaces[9] = 'MWtalk';
    nameSpaces[10] = 'Temp';
    nameSpaces[11] = 'Ttalk';
    nameSpaces[13] = 'Htalk';
    nameSpaces[14] = 'Cat';
    nameSpaces[15] = 'Ctalk';
    var mainTableAttrib = 'class="wikitable" style="font-family: Minecraft; margin: 0 auto 1em; text-align: center"';
    var noInclude = '{{User:Kanegasi/stuff}}';
    mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Kanegasi/editcounter.js&action=raw&ctype=text/javascript');
}


/* Creates a dropdown menu on edit summaries with presets */
if (mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit') {
    var customSummaries = [
        '[' + '[Minecraft 2.0]] info does not belong outside of its article',
        '[' + '[Category:Screenshots]]',
        '[' + '[Category:User images]]',
        '[' + '[mcf:1-|go to the suggestion forums]]',
        '[' + '[mcf:24-|go to the forums]]',
        '[' + '[mcf:31-|go to the server forums]]',
        '[' + '[mcf:56-|go to the mod forums]]',
        '[' + '[mcf:155-|go to the support forums]]',
        '[' + '[mcf:219-|go to the Pocket Edition forums]]',
        '[' + '[mcf:220-|go to the Xbox 360 Edition forums]]',
        '[' + '[Special:Interwiki|Interwiki link]]',
        '[' + '[Project:Wiki Rules#1|Rule#1]]: Violates Minecraft ToU/brand guidelines',
        '[' + '[Project:Wiki Rules#2|Rule#2]]: Spam',
        '[' + '[Project:Wiki Rules#2|Rule#2]]: Vandalism',
        '[' + '[Project:Wiki Rules#3|Rule#3]]: Too simple',
        '[' + '[Project:Wiki Rules#3|Rule#3.1]]: No proof [' + '[Mojang]] has played this',
        '[' + '[Project:Wiki Rules#4|Rule#4]]: Lack of content',
        '[' + '[Project:Wiki Rules#5|Rule#5]]: Harassment/insult/[[wikipedia:ad hominem|ad hominem]]',
        '[' + '[Project:Wiki Rules#6|Rule#6]]: Not a [' + '[Mojang]]ster',
        '[' + '[Project:Wiki Rules#7|Rule#7/7.1]]: False info/speculation',
        '[' + '[Project:Wiki Rules#8|Rule#8]]: Belongs in [' + '[Tutorials]]',
        '[' + '[Project:Wiki Rules#9|Rule#9]]: Custom server mods belong with their server article',
        '[' + '[Project:Wiki Rules#10|Rule#10/11]]: Server/community advertising',
        '[' + '[Project:Wiki Rules#13|Rule#13]]: [[wikipedia:Plagiarism|Plagiarism]]',
        '[' + '[Project:Wiki Rules#15|Rule#15.1]]: Mod info in vanilla article',
        '[' + '[Project:Wiki Rules#16|Rule#16]]: [[Project:Wiki Rules/Video policy|Video policy]]',
        '[' + '[Project:Wiki Rules#18|Rule#18]]: Signature',
        '[' + '[Project:Wiki Rules#19|Rule#19]]: Herospam',
        '[' + '[Project:Wiki Rules#20|Rule#20]]: Custom textures/UI/mods',
        '[' + '[Project:Wiki Rules#22|Rule#22]]: Template as signature',
        '[' + '[Project:Wiki Rules#23|Rule#23]]: Not tutorial material'
    ];
    mw.loader.localLoad('User:Kanegasi/editsummarypresets.js');
}


/* Adds Doc and Doc talk tabs to template pages and change Template and Talk tabs to always link to the original template and talk page */
if (mw.config.get('wgNamespaceNumber') === 10 || mw.config.get('wgNamespaceNumber') === 11) {
    mw.loader.localLoad('User:Majr/docTabs.js');
}


/* Adds a hidden pilcrow (¶) after editable section titles for easy section linking ( Source: http://en.wikipedia.org/wiki/User:Bility/copySectionLink ) */
$(document).ready(function() {
  var i=0;
  $('span.mw-headline').each(function() {
    var $pilcrowlink = $('<a>¶</a>').attr({
      id:    'sectiontitlecopy'+i,
      href:  '/wiki/'+mw.config.get('wgPageName')+'#'+$(this).attr('id'),
      style: 'display:none;'
    });
    $(this).append(' ',$pilcrowlink);
    $(this).parent().attr({
      onMouseOver: '$("#sectiontitlecopy'+i+'").attr("style","display:inline")',
      onMouseOut: '$("#sectiontitlecopy'+i+'").attr("style","display:none")'
    });
    i++;
  });
});


};