跳转到内容

User:A2569875/MediaWiki:Gadget-Graph.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// MediaWiki:Gadget-Graph.js
( function () {
	'use strict';

	window.mw = window.mw || {};
	mw.libs = mw.libs || {};
	var GW = mw.libs.GraphWidget = mw.libs.GraphWidget || {};

	if ( GW.scanAll ) {
		GW.scanAll();
		return;
	}

	var scriptPath = ( window.mw && mw.config && mw.config.get( 'wgScript' ) ) || '/w/index.php';
	var corePages = [
		'MediaWiki:Gadget-Graph/Core.js',
		'User:A2569875/Module:Graph/Core.js',
		'Module:Graph/Core.js'
	];

	function tryLoadCore( idx ) {
		if ( GW.scanAll || idx >= corePages.length ) {
			return;
		}
		var url = scriptPath + '?title=' + encodeURIComponent( corePages[ idx ] ) + '&action=raw&ctype=text/javascript';
		mw.loader.getScript( url ).then( function () {
			if ( !GW.scanAll ) {
				tryLoadCore( idx + 1 );
			}
		}, function () {
			tryLoadCore( idx + 1 );
		} );
	}

	if ( window.mw && mw.loader && typeof mw.loader.getScript === 'function' ) {
		tryLoadCore( 0 );
	}
}() );