MediaWiki:Gadget-PageNumbers.js

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/**
 * 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 = [ '首页' ].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;
		}
		
		// 仅在引用了Page页面的页面启用
		if ($(".pr_quality").length == 0){
			return;
		}
		
		mw.loader.load( 'ext.gadget.PageNumbers-core' );
	}
} );