מדיה ויקי:Common.js – הבדלי גרסאות
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 25: | שורה 25: | ||
mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); | mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); | ||
}; | }; | ||
/* | |||
* 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] === 'autopatrol' | |||
) && | |||
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | |||
( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 ) | |||
) { | |||
var restrictionEditMapping = { | |||
'sysop': 'מוגן', | |||
'templateeditor': 'הגנת ממשק', | |||
'autopatrol': 'הגנה מוגברת', | |||
'autoconfirmed': 'מוגן חלקית' | |||
}; | |||
$.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['*'] | |||
} ) ); | |||
} ); | |||
} ); | |||
} | |||
}) | |||
} ) | } ) | ||
mw.loader.load("http://chabadpedia.co.il/index.php?title=מדיה_ויקי:Gadget-Summarieslist.js&action=raw&ctype=text/javascript"); | mw.loader.load("http://chabadpedia.co.il/index.php?title=מדיה_ויקי:Gadget-Summarieslist.js&action=raw&ctype=text/javascript"); | ||