מדיה ויקי:AlertProtected.js

מתוך ויקימסע

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אינטרנט אקספלורר / אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
  • אופרה: ללחוץ על Ctrl-F5.
/***
Source: he.wikipedia.org/wiki/MediaWiki:Common.js
***/
	var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit');
	if( restrictionEdit &&
		restrictionEdit.length > 0 &&
		(
			restrictionEdit[0] === 'sysop' ||
			restrictionEdit[0] === 'editprotected' ||
			restrictionEdit[0] === 'autoconfirmed' ||
			restrictionEdit[0] === 'editsemiprotected'
		) &&
		$('#no-protection-message, #fullyprotected-icon, #fullyprotected-notice, #semiprotected-icon, #semiprotected-notice').length === 0 &&
		($.inArray(mw.config.get('wgAction'), ['view','submit']) + 1)
	) {
		var restrictionEditMapping = {
			'sysop': 'מוגן',
			'editprotected': 'מוגן',
			'autoconfirmed': 'מוגן חלקית',
			'editsemiprotected': 'מוגן חלקית'
		};
		$.get( mw.util.wikiScript('api'), {
			action: 'parse',
			format: 'json',
			text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}',
			prop: 'text',
			title: mw.config.get('wgPageName'),
			contentmodel:'wikitext'
		}, function(data) {
			$(function() {
				$('.printfooter').before($('<div>', {
					'class': 'plprotected',
					'html': data.parse.text['*']
				}));
			});
		});
	}