מדיה ויקי:Common.js: הבדלים בין גרסאות בדף
גרסה חדשה של גיא |
אין תקציר עריכה |
||
| (29 גרסאות ביניים של 6 משתמשים אינן מוצגות) | |||
| שורה 41: | שורה 41: | ||
} | } | ||
} | } | ||
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) { | |||
mw.loader.load( 'ext.gadget.ime' ); | |||
if ( mw.config.get( ' | |||
} | } | ||
// סקריפטים עבור אנונימיים ו/או חדשיםs | // סקריפטים עבור אנונימיים ו/או חדשיםs | ||
| שורה 188: | שורה 175: | ||
restrictionEdit[0] === 'autoconfirmed' || | restrictionEdit[0] === 'autoconfirmed' || | ||
restrictionEdit[0] === 'templateeditor' || | restrictionEdit[0] === 'templateeditor' || | ||
restrictionEdit[0] === ' | restrictionEdit[0] === 'editautopatrolprotected' | ||
) && | ) && | ||
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | $( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | ||
| שורה 196: | שורה 183: | ||
'sysop': 'מוגן', | 'sysop': 'מוגן', | ||
'templateeditor': 'הגנת ממשק', | 'templateeditor': 'הגנת ממשק', | ||
' | 'editautopatrolprotected': 'הגנה מוגברת', | ||
'autoconfirmed': 'מוגן חלקית' | 'autoconfirmed': 'מוגן חלקית' | ||
}; | }; | ||
| שורה 204: | שורה 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' | ||
| שורה 213: | שורה 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 ); | |||
} ); | } ); | ||
} ); | } ); | ||
} | } | ||
}); | }); | ||
} ); | } ); | ||
| שורה 253: | שורה 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 | ||
} ); | } ); | ||
} ); | } ); | ||