میڈیاویکی:Gadget-adminhighlighter.js

تفصیل کے لیے کھولیں کے بٹن پر کلک کریں یاددہانی: محفوظ کرنے کے بعد تازہ ترین تبدیلیوں کو دیکھنے کے لیے آپ کو اپنے براؤزر کا کیش صاف کرنا ہوگا۔

  • فائرفاکس/ سفاری: جب Reload پر کلک کریں تو Shift دبا کر رکھیں، یا Ctrl-F5 یا Ctrl-R دبائیں (Mac پر R- )
  • گوگل کروم: Ctrl-Shift-R دبائیں (Mac پر Shift-R-⌘)
  • انٹرنیٹ ایکسپلورر: جب Refresh پر کلک کریں تو Ctrl یا Ctrl-F5 دبائیں
  • اوپیرا: Tools → Preferences میں جائیں اور کیش صاف کریں

//<nowiki>
/**
 * Admin highlighter 2.0
 * ---------------------
 * A jQuery/mediawiki-heavy rewrite of [[User:Amalthea/userhighlighter.js]]
 * 
 * This script highlights links to admins' userpages or talkpages in bodyContent
 * (that is, everything but the tabs, personal links at the top of the screen and sidebar)
 * by giving them a cyan background.
 *
 * See [[User:Theopolisme/Scripts/adminhighlighter]] for more details.
 *
 * @author theopolisme
 */
;(function($, mw){
	$.getJSON(mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=میڈیاویکی:Gadget-adminhighlighter.js/sysop.js', function(data){
		ADMINHIGHLIGHT_EXTLINKS = window.ADMINHIGHLIGHT_EXTLINKS || false;
		ADMINHIGHLIGHT_NAMESPACES = [-1,2,3];
		mw.loader.using(['mediawiki.util','mediawiki.Uri', 'mediawiki.Title'], function() {
mw.util.addCSS(".userhighlighter_sysop.userhighlighter_sysop {background-color: #00FFFF !important}");
			$('#bodyContent a').each(function(index,linkraw){
				try {
					var link = $(linkraw);
					var url = link.attr('href');
					if (!url || url.charAt(0) === '#') return; // Skip <a> elements that aren't actually links; skip anchors
					if (url.lastIndexOf("http://", 0) != 0 && url.lastIndexOf("https://", 0) != 0 && url.lastIndexOf("/", 0) != 0) return; //require http(s) links, avoid "javascript:..." etc. which mw.Uri does not support
					var uri = new mw.Uri(url);
					if (!ADMINHIGHLIGHT_EXTLINKS && !$.isEmptyObject(uri.query)) return; // Skip links with query strings if highlighting external links is disabled
					if (uri.host == 'ur.wikipedia.org') {
						var mwtitle = new mw.Title(mw.util.getParamValue('title',url) || decodeURIComponent(uri.path.slice(6))); // Try to get the title parameter of URL; if not available, remove '/wiki/' and use that
						if ($.inArray(mwtitle.getNamespaceId(), ADMINHIGHLIGHT_NAMESPACES)>=0) {
							var user = mwtitle.getMain().replace(/_/g," ");
							if (mwtitle.getNamespaceId() === -1) user = user.replace('Contributions/',''); // For special page "Contributions/<username>"
							if (data[user] == 1) {
								link.addClass('userhighlighter_sysop'); // Override the above color by using `a.userhighlighter_sysop.userhighlighter_sysop {background-color: COLOR !important}`
							}
						}
					}
				} catch (e) {
					// Sometimes we will run into unparsable links, so just log these and move on
					window.console && console.error('Admin highlighter recoverable error',e.message);
				}
			});
		});
	});
}(jQuery, mediaWiki));
//</nowiki>