בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,362
רעדאגירונגען
ק (אויסשטעל) |
(אפדעיט) |
||
| שורה 116: | שורה 116: | ||
} | } | ||
/* | |||
* Adds an automatic '{{תב|מוגן}}' or '{{תב|מוגן חלקית}}' template when the page is protected. | |||
* You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted. | |||
* | |||
* written by [[User:ערן]], [[User:Yonidebest]] | |||
* | |||
*/ | |||
$(function(){ | |||
var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit'); | |||
if( restrictionEdit && | |||
restrictionEdit.length > 0 && | |||
( | |||
restrictionEdit[0] === 'sysop' || | |||
restrictionEdit[0] === 'autoconfirmed' || | |||
restrictionEdit[0] === 'templateeditor' || | |||
restrictionEdit[0] === 'editautopatrolprotected' | |||
) && | |||
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | |||
( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 ) | |||
) { | |||
var restrictionEditMapping = { | |||
'sysop': 'מוגן', | |||
'templateeditor': 'הגנת תבניות', | |||
'editautopatrolprotected': 'הגנה מוגברת', | |||
'autoconfirmed': 'מוגן חלקית' | |||
}; | |||
$.get( mw.util.wikiScript( 'api' ), { | |||
action: 'parse', | |||
format: 'json', | |||
text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}', | |||
prop: 'text|indicators', | |||
title: mw.config.get('wgPageName'), | |||
contentmodel: 'wikitext' | |||
}, function( data ) { | |||
$( function () { | |||
$( '.printfooter' ).before( $( '<div>', { | |||
'class': 'plprotected', | |||
'html': data.parse.text['*'] | |||
} ) ); | |||
var newList = []; | |||
$.each( data.parse.indicators, function ( name, indicator ) { | |||
newList.push( | |||
$( '<div>' ) | |||
.addClass( 'mw-indicator' ) | |||
.attr( 'id', mw.util.escapeIdForAttribute( 'mw-indicator-' + indicator.name ) ) | |||
.html( indicator['*'] ) | |||
.get( 0 ), | |||
// Add a whitespace between the <div>s because | |||
// they get displayed with display: inline-block | |||
document.createTextNode( '\n' ) | |||
); | |||
} ); | |||
$( '.mw-indicators' ).append( newList ); | |||
} ); | |||
} ); | |||
} | |||
}); | |||
} ); | |||
}); | |||
// On demand loading of gadgets, initial version from ruwiki. | // On demand loading of gadgets, initial version from ruwiki. | ||
רעדאגירונגען