מדיה ויקי:Common.js: הבדלים בין גרסאות בדף
מ הוספת הגנת ממשק |
אין תקציר עריכה |
||
| (44 גרסאות ביניים של 9 משתמשים אינן מוצגות) | |||
| שורה 25: | שורה 25: | ||
// Deprecated | // Deprecated | ||
} | } | ||
mw.loader.using( 'mediawiki.util', function () { | mw.loader.using( 'mediawiki.util', function () { | ||
| שורה 44: | שורה 41: | ||
} | } | ||
} | } | ||
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) { | |||
mw.loader.load( 'ext.gadget.ime' ); | |||
if ( mw.config.get( ' | |||
} | } | ||
// סקריפטים עבור אנונימיים ו/או חדשיםs | // סקריפטים עבור אנונימיים ו/או חדשיםs | ||
| שורה 74: | שורה 58: | ||
!$( '#wpTextbox1' ).prop( 'readonly' ) | !$( '#wpTextbox1' ).prop( 'readonly' ) | ||
) { | ) { | ||
importScript( 'MediaWiki:Templateslist.js' ); // הצגת רשימת תבניות | importScript( 'MediaWiki:Templateslist.js' ); // הצגת רשימת תבניות | ||
importScript( 'MediaWiki:Nosaving.js' ); // חיוב תצוגה מקדימה למשתמשים אנונימיים | importScript( 'MediaWiki:Nosaving.js' ); // חיוב תצוגה מקדימה למשתמשים אנונימיים | ||
| שורה 153: | שורה 136: | ||
} | } | ||
// create an event when addPortletLink() is called, so scripts that manipulate menus ca readjust. | // create an event when util.addPortletLink() is called, so scripts that manipulate menus ca readjust. | ||
var oldFunc = mw.util.addPortletLink; | var oldFunc = mw.util.addPortletLink; | ||
if ( typeof oldFunc === 'function' ) { | if ( typeof oldFunc === 'function' ) { | ||
| שורה 191: | שורה 174: | ||
restrictionEdit[0] === 'sysop' || | restrictionEdit[0] === 'sysop' || | ||
restrictionEdit[0] === 'autoconfirmed' || | restrictionEdit[0] === 'autoconfirmed' || | ||
restrictionEdit[0] === ' | restrictionEdit[0] === 'templateeditor' || | ||
restrictionEdit[0] === ' | restrictionEdit[0] === 'editautopatrolprotected' | ||
) && | ) && | ||
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | $( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | ||
| שורה 199: | שורה 182: | ||
var restrictionEditMapping = { | var restrictionEditMapping = { | ||
'sysop': 'מוגן', | 'sysop': 'מוגן', | ||
' | 'templateeditor': 'הגנת ממשק', | ||
' | 'editautopatrolprotected': 'הגנה מוגברת', | ||
'autoconfirmed': 'מוגן חלקית' | 'autoconfirmed': 'מוגן חלקית' | ||
}; | }; | ||
| שורה 208: | שורה 191: | ||
format: 'json', | format: 'json', | ||
text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}', | text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}', | ||
prop: 'text', | prop: 'text|indicators', | ||
title: mw.config.get('wgPageName'), | title: mw.config.get('wgPageName'), | ||
contentmodel: 'wikitext' | contentmodel: 'wikitext' | ||
| שורה 217: | שורה 200: | ||
'html': data.parse.text['*'] | '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 ); | |||
} ); | } ); | ||
} ); | } ); | ||
} | } | ||
}); | }); | ||
} ); | } ); | ||
| שורה 257: | שורה 248: | ||
} | } | ||
// | // On demand loading of scripts and gadgets, initial version from ruwiki. | ||
// Detects uses of template "טען סקריפט" | |||
// and loads specifically-named scripts or gadgets. | |||
// for a gadget, its name as defined in gadgets-definition must begin with "ondemand-" | |||
if ( mw.config.get('wgCanonicalNamespace') !== 'Special' ) | |||
mw.hook( 'wikipage.content' ).add( function( content ) { | mw.hook( 'wikipage.content' ).add( function( content ) { | ||
var beenthere = {}; | |||
$( '.executeJS', content ).each( function () { | |||
var gadget = $( this ).data( 'gadgetname' ); | |||
if ( gadget && $.trim( gadget ) ) mw.loader.load( 'ext.gadget.ondemand-' + $.trim( gadget ) ); // np repetitions - resourceloader takes care | |||
} ); | } ); | ||
} ); | } ); | ||