跳至内容

MediaWiki:Common.js/Perbook.js

来自 Wikibooks,开放世界中的开放书籍
注意:保存更改后,更改可能并不立即发生。单击此处了解如何绕过浏览器缓存。
  • Mozilla/Firefox/Safari:单击“重新加载”时按住 Shift 键,或按下 Ctrl-Shift-R(Apple Mac 上为 Cmd-Shift-R);
  • Internet Explorer:单击“刷新”时按住 Ctrl 键,或按下 Ctrl-F5
  • Konqueror:只需单击“重新加载”按钮,或按下 F5
  • Opera 用户可能需要在“工具→首选项”中完全清除其缓存。
/* Per-book JavaScript. 
  * Maintained by [[User:Darklama]]
  * Use book-specific stylesheet and JavaScript.
  * You can ask an administrator to add or update a global book specific Stylesheet or JavaScript.
  */

(function( mw ) {
	var	ns = mw.config.get( 'wgNameSpaceNumber' ),
		user = mw.config.get( 'wgUserName', false ),
		book = mw.config.get( 'wgBookName' );

	if ( ns === 8 || mw.config.get( 'wgIsArticle' ) === false ) {
		return; 	/* Disable in MediaWiki space and when not viewing book material */
	} else if ( ns === 2 ) {
		/* Find correct book name in User space */
		book = mw.config.get( 'wgPageName' ).split( '/', 2 )[1];

		if ( book === 'per_book' ) {
			return; /* Disable within reserved spaces */
		}
	}

	/* global styling */
	importStylesheet( 'MediaWiki:Perbook/' + book + '.css' );
	importScript( 'MediaWiki:Perbook/' + book + '.js' );

	/* user styling */
	if ( user ) {
		importStylesheet( 'User:' + user + '/per_book/' + book + '.css' );
		importScript( 'User:' + user + '/per_book/' + book + '.js' );
	}
})( mediaWiki );
华夏公益教科书