ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "มีเดียวิกิ:Gadget-PageNumbers.js"

จาก วิกิซอร์ซ
เนื้อหาที่ลบ เนื้อหาที่เพิ่ม
Geonuch (คุย | ส่วนร่วม)
 
up to date with enws
 
บรรทัดที่ 1: บรรทัดที่ 1:
/**
/**
* PageNumbers loader
* PageNumbers loader
*
*
* Loads the dynamic layouts module on suitable pages
* Checks for presence of ProofReading extension by looking for pr_quality color status bar
*/
*/
$( function ( $ ) {
$( function ( $ ) {
var ns = mw.config.get( 'wgNamespaceNumber' );
var nsOptionMenu = [ 0, 114 ];
var title = mw.config.get( 'wgTitle' );
if ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), nsOptionMenu ) !== -1 && $( 'table.pr_quality' ).length ) {

var disabledTitle = [ 'Main Page' ].indexOf( title ) !== -1;
var nsOK = [ 0, 114 ].indexOf( ns ) !== -1;
// disable on the mobile skins (actually the mobile doesn't serve this gadget at all, but
// this makes testing easier)
var skinOk = [ 'minerva' ].indexOf( mw.config.get( 'skin' ) ) === -1;
var isRedirect = mw.config.get( 'wgIsRedirect' );
// Sandboxes in the the User and Wikisource namespaces
var isSandbox = ( [ 2, 4 ].indexOf( ns ) !== -1 ) && ( title.indexOf( 'Sandbox' ) !== -1 );

if ( !disabledTitle && ( nsOK || isSandbox ) && skinOk && !isRedirect ) {
// done the easy ones - now a slower (?) check for a disabling object

// eslint-disable-next-line no-jquery/no-global-selector
if ($('.ws-dynlayout-disable').length) {
return;
}
mw.loader.load( 'ext.gadget.PageNumbers-core' );
mw.loader.load( 'ext.gadget.PageNumbers-core' );
}
}

รุ่นแก้ไขปัจจุบันเมื่อ 00:16, 10 พฤศจิกายน 2565

/**
 * PageNumbers loader
 * 
 * Loads the dynamic layouts module on suitable pages
 */
$( function ( $ ) {
	var ns = mw.config.get( 'wgNamespaceNumber' );
	var title =  mw.config.get( 'wgTitle' );

	var disabledTitle = [ 'Main Page' ].indexOf( title ) !== -1;
	var nsOK = [ 0, 114 ].indexOf( ns ) !== -1;
	// disable on the mobile skins (actually the mobile doesn't serve this gadget at all, but
	// this makes testing easier)
	var skinOk = [ 'minerva' ].indexOf( mw.config.get( 'skin' ) ) === -1;
	var isRedirect = mw.config.get( 'wgIsRedirect' );
	// Sandboxes in the the User and Wikisource namespaces
	var isSandbox = ( [ 2, 4 ].indexOf( ns ) !== -1 ) && ( title.indexOf( 'Sandbox' ) !== -1 );

	if ( !disabledTitle && ( nsOK || isSandbox ) && skinOk && !isRedirect ) {
		// done the easy ones - now a slower (?) check for a disabling object

		// eslint-disable-next-line no-jquery/no-global-selector
		if ($('.ws-dynlayout-disable').length) {
			return;
		}
		
		mw.loader.load( 'ext.gadget.PageNumbers-core' );
	}
} );