User:Cåm/global.js

/* __NOWYSIWYG__ */ (function ($, mw) { /*jshint forin:true, eqeqeq:true, quotmark:single, bitwise:true, strict:true, undef:true, unused:false, curly:true, undef:true, browser:true, trailing:true, jquery:true, indent:4 */ /*global mediaWiki, importArticles */	'use strict'; /* Run scripts below this line */

// import variables var monoBookText = 'Monobook', oasisText = 'Oasis', fdButtons = [];

// Fastdelete button names fdButtons[fdButtons.length] = { // RuneScape Wiki only 'summary': 'Successful RfD', 'label': 'RfD' };

fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'Housekeeping' };

/**	 * Imports * See Help:Including additional JavaScript and CSS for help with importArticles * @todo Move AntiUnicruft & Tabkey to Greasemonkey (or equivalent) */	importArticles({		type: 'script',		articles: [			'u:dev:AjaxUndo/code.js',		// Add a undo link to page diffs and histories				'u:dev:AllPagesHideRedirect/code.js',	// Adds a hide redirect button to AllPages & PrefixIndex			'u:dev:AntiUnicruft/code.js',		// Removes invisible characters			'u:dev:FastDelete/code.js',		// Fast Delete buttons			'u:dev:SkinSwitchButton/code.js',	// Switch between Monobook & Oasis			'u:dev:UnsafeScripts/code.js',		// Allows import of scripts into .js pages			'u:kangaroopower:MediaWiki:Scope.js',	// FindReplace function for source editor			'u:runescape:User:Cåm/oldfilepages.js',	// Changes file pages back to original styling			'u:runescape:User:Joeytje50/tabkey.js',	// Allows use of tabkey for use in scripts			'u:wikimarks:Client.js'			// Customisable On The Wiki tab		]	});

/**	 * Special:Editcount link in profile masthead * By Matthew2602 and Cåm */	function editcountMasthead { if ($('#UserProfileMasthead').length === 0) { return; }

if (mw.config.get('wgCanonicalNamespace') === 'Special') { var user = mw.config.get( 'wgTitle').split('/'); $('#UserProfileMasthead .tally em').html('' + $('#UserProfileMasthead .tally em').text + ''); } else { $('#UserProfileMasthead .tally em').html('' + $('#UserProfileMasthead .tally em').text + ''); }	}

/**	 * Unchecks redirect checkbox on file pages * Because redirects in file namespace do nothing * By Cåm */	function uncheckFileRedirects { if(mw.config.get('wgCanonicalSpecialPageName') === 'Movepage' && (/File/).test( mw.config.get('wgTitle'))) { $('#wpLeaveRedirect').removeAttr('checked'); }	}

/**	 * Prevent autoplay of embedded youtube videos * From Thread:522896 * Currently broken on file page videos - testing */	$(function {		$('[id^="youtubeEmbeddedPlayer-"]').onload (function  { console.log('iframe loaded'); });	}); /*	$('iframe[src^="http://www.youtube.com"]').each(function {		var source = $(this).attr('src');		if (source.indexOf('autoplay=1') !== -1) {			$(this).attr('src', source.replace('autoplay=1', 'autoplay=0'));		}		console.log('autoplay removed');	}); $(function {		editcountMasthead;		uncheckFileRedirects;	});

/* Run script above this line */ }(jQuery, mediaWiki)); /* */