User:NguoiDungKhongDinhDanh/reload-with-safe-mode.js

// Originally by Enterprisey. $(function {	var page = mw.config.get('wgPageName'),		un = mw.config.get('wgUserName'),		sv = mw.config.get('wgServer'),		pagelink = mw.util.getUrl(page),		ex = ['NguoiDungKhongDinhDanh', 'NDKDDBot', 'NDKDD (COI)', 'NhacNy2412', 'NhacNy2412Bot', 'Không hề giả trân'],		testex = (ex.indexOf(un) > -1 ? true : false),		alts = 'Reload with safemode',		altq = 'See system messages',		altp = 'Show portlets',		func = function(string) {			return window.location.href.replace('?', '&')				.replace('/wiki/', '/w/index.php?title=')				.replace('#', '&' + string + '#')				.replace('/w/index.php&', '/w/index.php?');		},		safemode = func('safemode=1'),		qqx = func('uselang=qqx'),		portlets = func('showportlets=true');

mw.loader.using(['mediawiki.util'], function {		var safemodify = mw.util.addPortletLink( 'p-cactions', safemode + (safemode.indexOf('safemode=1') >= 0 ? '' : '&' + 'safemode=1'), 'Safemodify', 'ca-safemodify', alts ),			seesysmess = mw.util.addPortletLink( 'p-cactions', qqx + (qqx.indexOf('uselang=qqx') >= 0 ? '' : '&' + 'uselang=qqx'), 'Sysmess', 'ca-sysmessages', altq ),			seeportlets = mw.util.addPortletLink( 'p-cactions', portlets + (portlets.indexOf('showportlets=true') >= 0 ? '' : '&' + 'showportlets=true'), 'Portlets', 'ca-showportlets', altp );		if (testex) {			mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:NguoiDungKhongDinhDanh/JWB.js/load.js&action=raw&ctype=text/javascript');		}	}); });