مدیاویکی:Gadget-afchelper.js

از ویکی‌پدیا، دانشنامهٔ آزاد

نکته: برای دیدن تغییرات، ممکن است نیاز باشد که حافظهٔ نهانی مرورگر خود را پس از انتشار پاک‌سازی کنید. گوگل کروم، فایرفاکس، مایکروسافت اج و سافاری: کلید Shift را نگه دارید و روی دکمهٔ Reload در نوار ابزار مرورگر کلیک کنید. برای آگاهی از جزئیات و نحوهٔ پاک‌سازی حافظهٔ نهانی سایر مرورگرها، صفحهٔ ویکی‌پدیا:میانگیر مرورگرتان را خالی کنید را ببینید.

/* Uploaded from https://github.com/WPAFC/afch-rewrite, commit: 24800715ad8fef3129b80f299ccef602518561b8 (master) */
//<nowiki>
( function () {
	// Check that we're in the right namespace and on the right page
	switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
		case 4: // ویکی‌پدیا
		case 5: // بحث ویکی‌پدیا
			var pageName = mw.config.get( 'wgTitle' );
			// return nothing for now, all drafts are now under Draft namespace
			// currently only the article submission script is running here.
			// to be used when script(s) for other modules such as category and
			// redirect requests are reintergrated into here.
			if ( pageName !== 'مقاله‌ها برای ایجاد/تمرین' ) {
				return;
			}
			break;
		case 2: // کاربر
		case 118: // پیش‌نویس
			break;
		default:
			return;
	}

	// Initialize the AFCH object
	window.AFCH = {};

	// Set up constants
	AFCH.consts = {};

	AFCH.consts.scriptpath = mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' );

	// These next two statements (setting beta and baseurl) may be modified
	// by the uploading script! If you change them, check that the uploading
	// script at scripts/upload.py doesn't break.
	AFCH.consts.beta = false;
	AFCH.consts.baseurl = AFCH.consts.scriptpath +
		'?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-afchelper.js';

	$.getScript( AFCH.consts.baseurl + '/core.js' ).done( function () {
		var loaded = AFCH.load( 'submissions' ); // perhaps eventually there will be more modules besides just 'submissions'
		if ( !loaded ) {
			mw.notify( 'ناتوان در بارگیری ابزار مبا: ' + ( AFCH.error || 'خطای ناشناخته' ),
				{ title: 'خطای ابزار مبا' } );
		}
	} );
}() );
//</nowiki>