מדיה ויקי:Common.js: הבדלים בין גרסאות בדף

כמקובל
אין תקציר עריכה
 
(14 גרסאות ביניים של 6 משתמשים אינן מוצגות)
שורה 41: שורה 41:
}
}
}
}
 
// סקריפטים כלליים
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
importScript( 'MediaWiki:LoadingContent.js' ); // הצגת טקסטים הנטענים באופן דינמי
mw.loader.load( 'ext.gadget.ime' );
 
if ( mw.config.get( 'wgAction' ) === 'history' ) {
importScript( 'MediaWiki:FixHistPage.js' );     // הסתרת קישורים ותיבות checkbox בדף ההיסטוריה והוספת אפשרות להפעלתם באמצעות כפתור מתאים.
}
}


if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
try {
mw.loader.load( '//tools.wmflabs.org/imagemapedit/ime.js' );
}
catch( e ) {
} // surround with try/catch in case other server behaves badly.
}


// סקריפטים עבור אנונימיים ו/או חדשיםs
// סקריפטים עבור אנונימיים ו/או חדשיםs
שורה 184: שורה 175:
restrictionEdit[0] === 'autoconfirmed' ||
restrictionEdit[0] === 'autoconfirmed' ||
restrictionEdit[0] === 'templateeditor' ||
restrictionEdit[0] === 'templateeditor' ||
restrictionEdit[0] === 'autopatrol'
restrictionEdit[0] === 'editautopatrolprotected'
) &&
) &&
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 &&
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 &&
שורה 192: שורה 183:
'sysop': 'מוגן',
'sysop': 'מוגן',
'templateeditor': 'הגנת ממשק',
'templateeditor': 'הגנת ממשק',
'autopatrol': 'הגנה מוגברת',
'editautopatrolprotected': 'הגנה מוגברת',
'autoconfirmed': 'מוגן חלקית'
'autoconfirmed': 'מוגן חלקית'
};
};
שורה 258: שורה 249:


// On demand loading of scripts and gadgets, initial version from ruwiki.
// On demand loading of scripts and gadgets, initial version from ruwiki.
// Detects uses of templace "טען סקריפט"
// Detects uses of template "טען סקריפט"
// and loads specifically-named scripts or gadgets.
// and loads specifically-named scripts or gadgets.
// for a script to be loadable this way, its name must begin with "Mediawiki:Scripts/"
// for a gadget, its name as defined in gadgets-definition must begin with "ondemand-"
// for a gadget, its name as defined in gadgets-definition must begin with "ondemand-"
if ( mw.config.get('wgCanonicalNamespace') !== 'Special' )  
if ( mw.config.get('wgCanonicalNamespace') !== 'Special' )  
שורה 266: שורה 256:
var beenthere = {};
var beenthere = {};
$( '.executeJS', content ).each( function () {
$( '.executeJS', content ).each( function () {
var script = $( this ).data( 'scriptname' );
if ( script && $.trim( script ) ) {
script = $.trim( script );
if ( ! beenthere[script] )
mw.loader.load( "/w/index.php?title=Mediawiki:Scripts/" + script + ".js&action=raw&ctype=text/javascript", "text/javascript" );
beenthere[script] = true;
}
var gadget = $( this ).data( 'gadgetname' );
var gadget = $( this ).data( 'gadgetname' );
if ( gadget && $.trim( gadget ) ) mw.loader.load( 'ext.gadget.ondemand-' + $.trim( gadget ) ); // np repetitions - resourceloader takes care
if ( gadget && $.trim( gadget ) ) mw.loader.load( 'ext.gadget.ondemand-' + $.trim( gadget ) ); // np repetitions - resourceloader takes care
} );
} );
} );
// if paramvalidator wrappers are visible, add a 'close' button, make them close on click, and tile them.
mw.hook( 'wikipage.content' ).add( function( content ) {
$( '.paramvalidator-wrapper',  content ).filter(':visible')
.prepend(
$( '<input>', { 'type': 'button' } )
.val( 'סימון' )
.click( function( e ) {
e.stopPropagation();
var wrapper = $( this ).closest( '.paramvalidator-wrapper' ).filter(':visible');
wrapper
.css( { position: 'inherit' } )
.next()    // hopefully, the offending template itself
.css( { border: 'solid red 3px' } );
} )
)
.prepend( $( '<input>', { 'type': 'button' } ).val( 'סגירה' ) )
.click( function() {
var $this = $( this );
$this.slideUp( 'slow', function() { $this.remove(); } );
} );
if ( $( '.paramvalidator-wrapper',  content ).filter(':visible').length > 1 ) {
$( '.paramvalidator-wrapper',  content ).filter(':visible')
.prepend(
$( '<input>', { 'type': 'button' } )
.val( 'סגירת הכול' )
.click( function() { $( '.paramvalidator-wrapper' ).remove(); } )
)
.prepend(
$( '<input>', { 'type': 'button' } )
.val( 'סימון הכול' )
.click( function( e ) {
e.stopPropagation();
$( '.paramvalidator-wrapper' ).filter(':visible')
.css( { position: 'inherit' } )
.next()
.css( { border: 'solid red 3px' } );
} )
);
}
} );
} );