User:Ferretwings/common.js

From Terraria Wiki
Jump to navigation Jump to search

Note: After publishing, 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 (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
window.hotcat_translations_from_commons = true;

/*
 This imports the latest version of HotCat from Commons.
 HotCat is a gadget to make changes to categories much easier.
 Full documentation can be found at http://commons.wikimedia.org/wiki/Help:Gadget-HotCat
*/
mw.loader.load( '//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript' );

/*
// How to import scripts:
//Edit summary presets
importScript('User:Equazcion/summaryPresets.js');
var customsum1 = "-- Bugs don't generally go on the wiki anymore. See [[Terraria_Wiki:Rules#Bugs|bug rules]]";
var customsum2 = "-- see [[trivia rules]]";
var customsum3 = "ce";
*/
/*
//Edit summary presets
mw.loader.load( '//terraria.gamepedia.com/index.php?title=User:Equazcion/summaryPresets.js&action=raw&ctype=text/javascript' );
var customsum1 = "-- Bugs don't generally go on the wiki anymore. See [[Terraria_Wiki:Rules#Bugs|bug rules]]";
var customsum2 = "-- see [[trivia rules]]";
var customsum3 = "ce";
*/

/*
//Auto-sign unsigned comments
mw.loader.load( '//terraria.gamepedia.com/index.php?title=User:Equazcion/signUnsigned.js&action=raw&ctype=text/javascript' );
*/
/*
//syntax highlighter from https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter
mw.loader.load('//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&action=raw&ctype=text/javascript');
*/

//Display hidden block option
setTimeout(function(){
   $('.mw-htmlform-field-HTMLCheckField:has(input#mw-input-wpAutoBlock)').show();
}, 500);

// RC editlink
( function() {
	'use strict';
	
	var $changeList = $( '.mw-changeslist' );
	if ( !$changeList.length ) {
		return;
	}
	
	mw.loader.using( 'mediawiki.util' ).then( function() {
		$changeList.find( '.mw-title' ).each( function() {
			var title = $( this ).find( '.mw-changeslist-title' ).attr( 'title' );
			if ( title ) {
				$( '<a>' ).addClass( 'rc-editlink' ).attr( {
					href: mw.util.getUrl( title, { action: 'edit' } ),
					title: 'Edit this page'
				} ).text( '✎' ).insertAfter( this );
			}
		} );
	} );
}() );

// In recent changes:
var $pages = $('.mw-changeslist .special li');
$pages.each(function(index,value){
    var $this = $(this);

    // Add "check" link to user links, which opens contribs, deleted contribs, and block log
    var $userBlock = $this.find('.mw-usertoollinks a:last');
    $userBlock.after(' | <a class="check">check</a>');
    var $check = $this.find('.check');
    var $user = $this.find('.mw-userlink:last').text();
    $check.css('cursor','pointer');
    $check.click(function(){
        window.open('http://terraria.gamepedia.com/Special:Contributions/' + $user);
        window.open('http://terraria.gamepedia.com/Special:DeletedContributions/' + $user);
        window.open('http://terraria.gamepedia.com/index.php?title=Special:Log/block&page=User%3A' + $user);
    });
    
    // Add delete links to new pages
    if ($this.find('.newpage').length > 0) { 
        var $title = $this.find('.mw-title');
        $title.after(' (<a href="http://terraria.gamepedia.com/index.php?title=' + $title.text() + '&action=delete">delete</a>)');
    }
});

// Always choose Vandalism as default delete reason
$('#wpDeleteReasonList').val('Vandalism');

// Remove previous content from delete summary line and place below for optional pasting
$deleteContent = $('#wpDeleteReasonRow #wpReason').val();
$('#deleteconfirm').append('<fieldset><div style="padding-top:10px"><code>' + $deleteContent + '</code></div></fieldset>');
$('#wpDeleteReasonRow #wpReason').val('');

/*
// Remove ads, promos, "social" features 
$('#p-sitePromos').remove();
$('#p-socialProfiles').remove();
$('#p-sharing').remove();
$('.t-netbar-curseInfo').remove();
$('#socialContainer').remove();
$('#feedlinks').remove();
$('.atfmrec').remove();
$('.show-ads').remove();
$('#siteNotice').remove();
$('.curse-stripe').remove();

setTimeout(function(){
    $('.show-ads').remove();
    //$('iframe').remove();
},500);

*/