跳转到内容

MediaWiki:Mobile.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */

Promise.all( [
	mw.loader.using( 'mediawiki.util' ),
	$.ready,
] ).then( function() {
	function addPortletLink() {
		mw.log.warn(
			'addPortletLink is deprecated on desktop and never implemented on mobile',
			'More information on https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#addPortletLink',
		);
	}

	if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Search' ) {
		// Scripts specific to editing pages
		mw.loader.using( [ 'ext.gadget.EditCommon-styles', 'ext.gadget.EditCommon' ] );
	}

	// 如果从浏览模式直接进入编辑模式,页面不会刷新,该小工具不会加载,因此采用钩子加载
	// 注意在同一页面上,即使该钩子多次触发,小工具也只会加载一次
	mw.hook( 'mobileFrontend.editorOpened' ).add( () => {
		mw.loader.using( [ 'ext.gadget.EditCommon-styles', 'ext.gadget.EditCommon' ] );
	} );

	// 请在本行前添加内容
} );
// 请勿在本行后添加内容