کاربر:Technical 13/Scripts/editTemplateNoDoc.js: تفاوت بین نسخه‌ها

از پژوهشکده امر به معروف
پرش به: ناوبری، جستجو
(صفحه‌ای تازه حاوی «<source> if( mw.config.get('wgNamespaceNumber') === 10 && mw.config.get('wgAction') === 'edit' && $( '.template-documentation' ).length !=...» ایجاد کرد)
 
 
سطر ۱: سطر ۱:
<source>
 
 
if( mw.config.get('wgNamespaceNumber') === 10 && mw.config.get('wgAction') === 'edit' &&  $( '.template-documentation' ).length !== -1){
 
if( mw.config.get('wgNamespaceNumber') === 10 && mw.config.get('wgAction') === 'edit' &&  $( '.template-documentation' ).length !== -1){
 
$( '.template-documentation' ).css( 'display', 'none');
 
$( '.template-documentation' ).css( 'display', 'none');
سطر ۲۹: سطر ۲۸:
 
/*              Do nothing              */
 
/*              Do nothing              */
 
}
 
}
 
</source>
 

نسخهٔ کنونی تا ‏۱۳ اسفند ۱۳۹۴، ساعت ۱۲:۴۵

if( mw.config.get('wgNamespaceNumber') === 10 && mw.config.get('wgAction') === 'edit' &&  $( '.template-documentation' ).length !== -1){
	$( '.template-documentation' ).css( 'display', 'none');
	var tnd = mw.util.addPortletLink(
		'p-tb',
		'#',
		'View doc',
		'pt-temp-doc',
		'View template documentation',
		null,
		null
	);
	$( tnd ).click( function ( e ) {
		e.preventDefault();
		/* Toggle documentation display */
		$( '.template-documentation' ).css( 'display', function (i, val) {
			return val === 'none' ? '' : 'none';
		});
		/* Toggle the link */
		$( 'li#pt-temp-doc a' ).html( function (i, val) {
			return val === 'View doc' ? 'Hide doc' : 'View doc';
		});
		/* Toggle the description */
		$( 'li#pt-temp-doc a' ).attr( 'title', function (i, val) {
			return val === 'View template documentation' ? 'Hide template documentation' : 'View template documentation';
		});
	});
} else {
	/*               Do nothing               */
}