User:Psl85/warnings.js

// /** ** This is the installer-Script for MediaWiki:AxUserMsg.js ** Using LOD (Load on demand) to increase the overall page-loading time. ** Written in 2011 by Rillke **

// This Code is jsHint valid! /*global jQuery:false, mw:false, importScript:false */ (function($) { 'use strict';

if (3 === mw.config.get('wgNamespaceNumber') ||	2 === mw.config.get('wgNamespaceNumber') || 	( -1 === mw.config.get('wgNamespaceNumber') && (-1 !== $.inArray(mw.config.get('wgCanonicalSpecialPageName'), ['Contributions', 'DeletedContributions', 'Block', 'CentralAuth', 'Userrights', 'Listfiles', 'Log'])) )) {

var loadFullScript = function { mw.loader.load( mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + '?title=User:Psl85/warnings/Warnings.js&action=raw&ctype=text/javascript&dummy=1' ); setTimeout(function {		if (!window.AxUserMsg) {			loadFullScript;		}	}, 4500); }; if (window.installOldLinks || window.AxUserMsgFireAsYouClick) { if (window.AxUserMsgFireAsYouClick) { window.installOldLinks = true; }	// User wants old links - therefore we have to load the whole script each time loadFullScript; return; } else { $(document).ready(function {		mw.loader.using(['mediawiki.util'], function  { if (window.installOldLinks || window.AxUserMsgFireAsYouClick) { if (window.AxUserMsgFireAsYouClick) { window.installOldLinks = true; }				// User js was loaded later, so do it now! loadFullScript; return; }

if (0 === $('#t-AjaxUserMessage').length && 0 === $('#t-AjaxUserMessageLOD').length) { var linktext = "Notify this user"; var pHref = mw.util.addPortletLink('p-tb', '#', linktext, 't-AjaxUserMessageLOD', 'Launch user messages script'); if (!pHref) { throw new Error('Gadget user messages: Unable to install link!'); }				$(pHref).on('click.umBootStrap', function(e) {					var $linknode = $(this).find('a');					if (0 === $linknode.length) {						$linknode = $(this);					}					e.preventDefault;					$linknode.text('Loading...');					$(document).on('scriptLoaded', function(evt, st, o) { if (st) { if ('AxUserMsg' === st && o) { $linknode.text(linktext); o.umNotifyUser; }						}					});					$(this).off('click.umBootStrap');					loadFullScript;				}); }		});	}); }

} // Namespace Guard })(jQuery); //