میڈیاویکی:Gadget-friendlywelcome.js

ویکی کتب سے

یاد دہانی: محفوظ کرنے کے بعد ان تبدیلیوں کو دیکھنے کے لیے آپ کو اپنے براؤزر کا کیش (cache) صاف کرنا ہوگا۔

  • فائرفاکس/ سفاری: جب Reload پر کلک کریں تو Shift دباکر رکھیں، یا Ctrl-F5 یا Ctrl-R دبائیں (Mac پر R-⌘)
  • گوگل کروم: Ctrl-Shift-R دبائیں (Mac پر Shift-R-⌘)
  • انٹرنیٹ ایکسپلورر: جب Refresh پر کلک کریں تو Ctrl یا Ctrl-F5 دبائیں
  • اوپیرا: Tools → Preferences میں جائیں اور کیش (cache) صاف کریں
//<nowiki>


(function($){


/*
 ****************************************
 *** friendlywelcome.js: Welcome module
 ****************************************
 * Mode of invocation:     Tab ("خوش‌آمدید"), or from links on diff pages
 * Active on:              Existing user talk pages, diff pages
 * Config directives in:   FriendlyConfig
 */

Twinkle.welcome = function friendlywelcome() {
	if( Morebits.queryString.exists( 'friendlywelcome' ) ) {
		if( Morebits.queryString.get( 'friendlywelcome' ) === 'auto' ) {
			Twinkle.welcome.auto();
		} else {
			Twinkle.welcome.semiauto();
		}
	} else {
		Twinkle.welcome.normal();
	}
};

Twinkle.welcome.auto = function() {
	if( Morebits.queryString.get( 'action' ) !== 'edit' ) {
		// userpage not empty, aborting auto-welcome
		return;
	}

	Twinkle.welcome.welcomeUser();
};

Twinkle.welcome.semiauto = function() {
	Twinkle.welcome.callback( mw.config.get( 'wgTitle' ).split( '/' )[0].replace( /\"/, "\\\"") );
};

Twinkle.welcome.normal = function() {
	if( Morebits.queryString.exists( 'diff' ) ) {
		// check whether the contributors' talk pages exist yet
		var $oList = $("#mw-diff-otitle2").find("span.mw-usertoollinks a.new:contains(talk)").first();
		var $nList = $("#mw-diff-ntitle2").find("span.mw-usertoollinks a.new:contains(talk)").first();

		if( $oList.length > 0 || $nList.length > 0 ) {
			var spanTag = function( color, content ) {
				var span = document.createElement( 'span' );
				span.style.color = color;
				span.appendChild( document.createTextNode( content ) );
				return span;
			};

			var welcomeNode = document.createElement('strong');
			var welcomeLink = document.createElement('a');
			welcomeLink.appendChild( spanTag( 'Black', '[' ) );
			welcomeLink.appendChild( spanTag( 'Goldenrod', 'خوش‌آمدید' ) );
			welcomeLink.appendChild( spanTag( 'Black', ']' ) );
			welcomeNode.appendChild(welcomeLink);

			if( $oList.length > 0 ) {
				var oHref = $oList.attr("href");

				var oWelcomeNode = welcomeNode.cloneNode( true );
				oWelcomeNode.firstChild.setAttribute( 'href', oHref + '&' + Morebits.queryString.create( {
						'friendlywelcome': Twinkle.getFriendlyPref('quickWelcomeMode') === 'auto' ? 'auto': 'norm',
						'vanarticle': Morebits.pageNameNorm
					} ) );
				$oList[0].parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );
				$oList[0].parentNode.parentNode.appendChild( oWelcomeNode );
			}

			if( $nList.length > 0 ) {
				var nHref = $nList.attr("href");

				var nWelcomeNode = welcomeNode.cloneNode( true );
				nWelcomeNode.firstChild.setAttribute( 'href', nHref + '&' + Morebits.queryString.create( {
						'friendlywelcome': Twinkle.getFriendlyPref('quickWelcomeMode') === 'auto' ? 'auto': 'norm',
						'vanarticle': Morebits.pageNameNorm
					} ) );
				$nList[0].parentNode.parentNode.appendChild( document.createTextNode( ' ' ) );
				$nList[0].parentNode.parentNode.appendChild( nWelcomeNode );
			}
		}
	}
	if( mw.config.get( 'wgNamespaceNumber' ) === 3 ) {
		var username = mw.config.get( 'wgTitle' ).split( '/' )[0].replace( /\"/, "\\\""); // only first part before any slashes
		Twinkle.addPortletLink( function(){ Twinkle.welcome.callback(username); }, "خوش‌آمدید", "friendly-welcome", "صارف کو خوش آمدید کہیں" );
	}
};

Twinkle.welcome.welcomeUser = function welcomeUser() {
	Morebits.status.init( document.getElementById('mw-content-text') );
	$( '#catlinks' ).remove();

	var params = {
		value: Twinkle.getFriendlyPref('quickWelcomeTemplate'),
		article: Morebits.queryString.exists( 'vanarticle' ) ? Morebits.queryString.get( 'vanarticle' ) : '',
		mode: 'auto'
	};

	Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
	Morebits.wiki.actionCompleted.notice = "خوش‌آمدید کہہ دیا گیا، اگلے چند سیکنڈوں میں تبادلۂ خیال صفحہ تازہ ہو جائے گا";

	var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "تبادلۂ خیال صفحہ میں ترمیم");
	wikipedia_page.setFollowRedirect(true);
	wikipedia_page.setCallbackParameters(params);
	wikipedia_page.load(Twinkle.welcome.callbacks.main);
};

Twinkle.welcome.callback = function friendlywelcomeCallback( uid ) {
	if( uid === mw.config.get('wgUserName') && !confirm( 'کیا واقعی آپ اپنے آپ کو خوش آمدید کہنا چاہتے ہیں؟!' ) ){
		return;
	}

	var Window = new Morebits.simpleWindow( 600, 420 );
	Window.setTitle( "صارف کو خوش آمدید کہیں" );
	Window.setScriptName( "پلک" );
	Window.addFooterLink( "مجلس خوش آمدید", "وپ:مخام" );
	Window.addFooterLink( "رہنمائے پلک", ":en:WP:TW/DOC#welcome" );

	var form = new Morebits.quickForm( Twinkle.welcome.callback.evaluate );

	form.append({
			type: 'select',
			name: 'type',
			label: 'خوش آمدید کی قسم: ',
			event: Twinkle.welcome.populateWelcomeList,
			list: [
				{ type: 'option', value: 'standard', label: 'معیاری پیغامات', selected: !Morebits.isIPAddress(mw.config.get('wgTitle')) },
				{ type: 'option', value: 'anonymous', label: 'خوش آمدید برائے آئی پی صارف', selected: Morebits.isIPAddress(mw.config.get('wgTitle')) },
				{ type: 'option', value: 'wikiProject', label: 'ویکی منصوبوں کے پیغام خوش آمدید' },
				{ type: 'option', value: 'nonPersian', label: 'غیر اردو خوش آمدید' }
			]
		});

	form.append( {
			type: 'div',
			id: 'welcomeWorkArea',
			className: 'morebits-scrollbox'
		} );

	form.append( {
			type: 'input',
			name: 'article',
			label: '* مربوط مضمون (اگر سانچہ میں اس کی معاونت موجود ہو):',
			value:( Morebits.queryString.exists( 'vanarticle' ) ? Morebits.queryString.get( 'vanarticle' ) : '' ),
			tooltip: 'یک نوشتار ممکن است از درون خوش‌آمد پیوندشود اگر الگو از آن پشتیبانی کند. برای پیوندندادن به هیچ نوشتاری خالی بگذارید. الگوهایی که از نوشتار پیوندشده پشتیبانی می‌کنند با یک ستاره مشخص شده‌اند.'
		} );

	var previewlink = document.createElement( 'a' );
	$(previewlink).click(function(){
		Twinkle.welcome.callbacks.preview(result);  // |result| is defined below
	});
	previewlink.style.cursor = "pointer";
	previewlink.textContent = 'نمائش';
	form.append( { type: 'div', name: 'welcomepreview', label: [ previewlink ] } );

	form.append( { type: 'submit' } );

	var result = form.render();
	Window.setContent( result );
	Window.display();

	// initialize the welcome list
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	result.type.dispatchEvent( evt );
};

Twinkle.welcome.populateWelcomeList = function(e) {
	var type = e.target.value;

	var container = new Morebits.quickForm.element({ type: "fragment" });

	if ((type === "standard" || type === "anonymous") && Twinkle.getFriendlyPref("customWelcomeList").length) {
		container.append({ type: 'header', label: 'خوش آمدید کے شخصی سانچے' });
		container.append({
			type: 'radio',
			name: 'template',
			list: Twinkle.getFriendlyPref("customWelcomeList"),
			event: Twinkle.welcome.selectTemplate
		});
	}

	var appendTemplates = function(list) {
		container.append({
			type: 'radio',
			name: 'template',
			list: list.map(function(obj) {
				var properties = Twinkle.welcome.templates[obj];
				var result = (properties ? {
					value: obj,
					label: "{{" + obj + "}}: " + properties.description + (properties.linkedArticle ? "\u00A0*" : ""),  // U+00A0 NO-BREAK SPACE
					tooltip: properties.tooltip  // may be undefined
				} : {
					value: obj,
					label: "{{" + obj + "}}"
				});
				return result;
			}),
			event: Twinkle.welcome.selectTemplate
		});
	};

	switch (type) {
		case "standard":
			container.append({ type: 'header', label: 'خوش آمدید کے عمومی سانچے' });
			appendTemplates([
				"خوش آمدید",
				"welcome-short",
				"welcome-personal",
				"welcome-graphical",
				"welcome-menu",
				"welcome-screen",
				"welcome-belated",
				"welcome student",
				"welcome teacher",
				"welcome non-latin"
			]);
			container.append({ type: 'header', label: 'الگوهای خوش‌آمد کاربر مشکل‌دار' });
			appendTemplates([
				"welcomelaws",
				"first article",
				"welcometest",
				"welcomevandal",
				"welcomenpov",
				"welcomespam",
				"welcomeunsourced",
				"welcomeauto",
				"welcome-COI",
				"welcome-delete",
				"welcome-image"
			]);
			break;
		case "anonymous":
			container.append({ type: 'header', label: 'الگوهای خوش‌آمد کاربر ناشناس' });
			appendTemplates([
				"welcome-anon",
				"welcome-anon-test",
				"welcome-anon-unconstructive",
				"welcome-anon-constructive",
				"welcome-anon-delete"
			]);
			break;
		case "wikiProject":
			container.append({ type: 'header', label: 'الگوهای خوش‌آمد ویژه ویکی‌پروژه' });
			appendTemplates([
				"welcome-au",
				"welcome-bd",
				"welcome-bio",
				"welcome-cal",
				"welcome-conserv",
				"welcome-cycling",
				"welcome-dbz",
				"welcome-et",
				"welcome-de",
				"welcome-in",
				"welcome-math",
				"welcome-med",
				"welcome-no",
				"welcome-pk",
				"welcome-phys",
				"welcome-pl",
				"welcome-roads",
				"welcome-rugbyunion",
				"welcome-ru",
				"welcome-starwars",
				"welcome-ch",
				"welcome-uk",
				"welcome-videogames",
				"TWA invite"
			]);
			break;
		case "nonPersian":
			container.append({ type: 'header', label: 'الگوهای خوش‌آمد غیر فارسی' });
			appendTemplates([
				"welcomeen-sq",
				"welcomeen-ar",
				"welcomeen-zh",
				"welcomeen-nl",
				"welcomeen-fi",
				"welcomeen-fr",
				"welcomeen-de",
				"welcomeen-he",
				"welcomeen-ja",
				"welcomeen-ko",
				"welcomeen-mr",
				"welcomeen-ml",
				"welcomeen-or",
				"welcomeen-pt",
				"welcomeen-ru",
				"welcomeen-es",
				"welcomeen-sv",
				"welcomeen-uk"
			]);
			break;
		default:
			container.append({ type: 'div', label: 'Twinkle.welcome.populateWelcomeList: something went wrong' });
			break;
	}

	var rendered = container.render();
	$(e.target.form).find("div#welcomeWorkArea").empty().append(rendered);

	var firstRadio = e.target.form.template[0];
	firstRadio.checked = true;
	Twinkle.welcome.selectTemplate({ target: firstRadio });
};

Twinkle.welcome.selectTemplate = function(e) {
	var properties = Twinkle.welcome.templates[e.target.values];
	e.target.form.article.disabled = (properties ? !properties.linkedArticle : false);
};


// A list of welcome templates and their properties and syntax

// The four fields that are available are "description", "linkedArticle", "syntax", and "tooltip".
// The three magic words that can be used in the "syntax" field are:
//   - $USERNAME$  - replaced by the welcomer's username, depending on user's preferences
//   - $ARTICLE$   - replaced by an article name, if "linkedArticle" is true
//   - $HEADER$    - adds a level 2 header (most templates already include this)

Twinkle.welcome.templates = {
	// GENERAL WELCOMES

	"خوش آمدید": {
		description: "معیاری خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcome|$USERNAME$}}~~~~"
	},
	"welcome-short": {
		description: "یک پیام خوش‌آمد کوتاه‌تر",
		linkedArticle: false,
		syntax: "{{subst:welcome-short|$USERNAME$}} $EXTRA$ ~~~~"
	},
	"welcome-personal": {
		description: "خوش‌آمد شخصی‌تر، شامل بشقابی از کلوچه‌ها",
		linkedArticle: false,
		syntax: "{{subst:welcome-personal|$USERNAME$}}~~~~"
	},
	"welcome-graphical": {
		description: "پیام خوش‌آمد رنگارنگ همراه جدولی از تقریباً ۲۰ پیوند",
		linkedArticle: false,
		syntax: "$HEADER$ {{subst:welcome-graphical|$EXTRA$}}"
	},
	"welcome-menu": {
		description: "پیام خوش‌آمد همراه جدول بزرگ از تقریباً ۶۰ پیوند",
		linkedArticle: false,
		syntax: "{{subst:welcome-menu}}"
	},
	"welcome-screen": {
		description: "پیام خوش‌آمد همراه جدول شفاف و حاشیه‌نویسی از ۱۰ پیوند",
		linkedArticle: false,
		syntax: "$HEADER$ {{subst:welcome-screen|static=true}}"
	},
	"welcome-belated": {
		description: "خوش‌آمد به کاربرانی با مشارکت‌های قابل توجه‌تر",
		linkedArticle: false,
		syntax: "{{subst:welcome-belated|$USERNAME$}}"
	},
	"welcome student": {
		description: "خوش‌آمد به دانش‌آموزانی که به عنوان بخشی از یک پروژهٔ کلاسی آموزشی ویرایش می‌کنند",
		linkedArticle: false,
		syntax: "$HEADER$ {{subst:welcome student|$USERNAME$}}~~~~"
	},
	"welcome teacher": {
		description: "خوش‌آمد به مدرسان دورهٔ آموزشی درگیر در یک پروژه کلاسی آموزشی",
		linkedArticle: false,
		syntax: "$HEADER$ {{subst:welcome teacher|$USERNAME$}}~~~~"
	},
	"welcome non-latin": {
		description: "خوش‌آمد به کاربرانی با نام کاربری دارای نویسه‌های غیر لاتین",
		linkedArticle: false,
		syntax: "{{subst:welcome non-latin|$USERNAME$}}~~~~"
	},

	// PROBLEM USER WELCOMES

	"welcomelaws": {
		description: "خوش‌آمد همراه اطلاعاتی دربارهٔ حق تکثیر، دبط، صفحهٔ تمرین و خرابکاری",
		linkedArticle: false,
		syntax: "{{subst:welcomelaws|$USERNAME$}}~~~~"
	},
	"first article": {
		description: "برای کسی که نخستین نوشتارش رهنمودهای ساخت نوشتار را رعایت نکرده‌است",
		linkedArticle: true,
		syntax: "{{subst:first article|$ARTICLE$|$USERNAME$}}"
	},
	"welcometest": {
		description: "برای کسی که تلاش‌های اولیه‌اش به نظر آزمایشی می‌آیند",
		linkedArticle: true,
		syntax: "{{subst:welcometest|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcomevandal": {
		description: "برای کسی که تلاش‌های اولیه‌اش به نظر خرابکاری می‌آیند",
		linkedArticle: true,
		syntax: "{{subst:welcomevandal|$ARTICLE$|$USERNAME$}}"
	},
	"welcomenpov": {
		description: "برای کسی که تلاش‌های اولیه‌اش وفادار به سیاست دیدگاه بی‌طرف نیستند",
		linkedArticle: true,
		syntax: "{{subst:welcomenpov|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcomespam": {
		description: "خوش‌آمد همراه گفتگوی اضافی دربارهٔ سیاست‌های ضد هرزنگاری",
		linkedArticle: true,
		syntax: "{{subst:welcomespam|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcomeunsourced": {
		description: "برای کسی که تلاش‌های اولیه‌اش بدون منبع هستند",
		linkedArticle: true,
		syntax: "{{subst:welcomeunsourced|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcomeauto": {
		description: "برای کسی که نوشتاری خودزیست‌نامه‌ای ساخته‌است",
		linkedArticle: true,
		syntax: "{{subst:welcomeauto|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-COI": {
		description: "برای کسی که در حوزه‌هایی ویرایش کرده‌است که ممکن است تعارض منافع داشته باشند",
		linkedArticle: true,
		syntax: "{{subst:welcome-COI|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-delete": {
		description: "برای کسی که اطلاعات را از نوشتارها حذف می‌کند",
		linkedArticle: true,
		syntax: "{{subst:welcome-delete|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcome-image": {
		description: "خوش‌آمد همراه اطلاعات اضافی دربارهٔ تصاویر (سیاست و روش)",
		linkedArticle: true,
		syntax: "{{subst:welcome-image|$USERNAME$|art=$ARTICLE$}}"
	},

	// ANONYMOUS USER WELCOMES

	"welcome-anon": {
		description: "برای کاربران ناشناس؛ تشویق به ساخت حساب کاربری",
		linkedArticle: true,
		syntax: "{{subst:welcome-anon|art=$ARTICLE$}}~~~~"
	},
	"welcome-anon-test": {
		description: "برای کاربران ناشناسی که ویرایش‌های آزمایشی انجام دادند",
		linkedArticle: true,
		syntax: "{{subst:welcome-anon-test|$ARTICLE$|$USERNAME$}}~~~~"
	},
	"welcome-anon-unconstructive": {
		description: "برای کاربران ناشناسی که خرابکاری کرده‌اند یا ویرایش‌های نامفید داشته‌اند",
		linkedArticle: true,
		syntax: "{{subst:welcome-anon-unconstructive|$ARTICLE$|$USERNAME$}}"
	},
	"welcome-anon-constructive": {
		description: "برای کاربران ناشناسی که با خرابکاری مبارزه می‌کنند یا ویرایش سازنده دارند",
		linkedArticle: true,
		syntax: "{{subst:welcome-anon-constructive|art=$ARTICLE$}}"
	},
	"welcome-anon-delete": {
		description: "برای کاربران ناشناسی که محتوا را از صفحه‌ها حذف کرده‌اند",
		linkedArticle: true,
		syntax: "{{subst:welcome-anon-delete|$ARTICLE$|$USERNAME$}}~~~~"
	},

	// WIKIPROJECT-SPECIFIC WELCOMES

	"welcome-au": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به استرالیا",
		linkedArticle: false,
		syntax: "{{subst:welcome-au}}~~~~"
	},
	"welcome-bd": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به بنگلادش",
		linkedArticle: true,
		syntax: "{{subst:welcome-bd|$USERNAME$||$EXTRA$|art=$ARTICLE$}}~~~~"
	},
	"welcome-bio": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های زیستنامه‌ای",
		linkedArticle: false,
		syntax: "{{subst:welcome-bio}}~~~~"
	},
	"welcome-cal": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به کالیفرنیا",
		linkedArticle: false,
		syntax: "{{subst:welcome-cal}}~~~~"
	},
	"welcome-conserv": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های محافظه‌کاری",
		linkedArticle: false,
		syntax: "{{subst:welcome-conserv}}"
	},
	"welcome-cycling": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های دوچرخه‌سواری",
		linkedArticle: false,
		syntax: "{{subst:welcome-cycling}}~~~~"
	},
	"welcome-dbz": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به مانگای دراگون بال",
		linkedArticle: false,
		syntax: "{{subst:welcome-dbz|$EXTRA$|sig=~~~~}}"
	},
	"welcome-et": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به استونی",
		linkedArticle: false,
		syntax: "{{subst:welcome-et}}"
	},
	"welcome-de": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به آلمان",
		linkedArticle: false,
		syntax: "{{subst:welcome-de}}~~~~"
	},
	"welcome-in": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به هند",
		linkedArticle: true,
		syntax: "{{subst:welcome-in|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-math": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های ریاضی",
		linkedArticle: true,
		syntax: "{{subst:welcome-math|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-med": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های پزشکی",
		linkedArticle: true,
		syntax: "{{subst:welcome-med|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-no": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به نروژ",
		linkedArticle: false,
		syntax: "{{subst:welcome-no}}~~~~"
	},
	"welcome-pk": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به پاکستان",
		linkedArticle: true,
		syntax: "{{subst:welcome-pk|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-phys": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های فیزیک",
		linkedArticle: true,
		syntax: "{{subst:welcome-phys|$USERNAME$|art=$ARTICLE$}}~~~~"
	},
	"welcome-pl": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به لهستان",
		linkedArticle: false,
		syntax: "{{subst:welcome-pl}}~~~~"
	},
	"welcome-rugbyunion": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های راگبی ۱۵ نفره",
		linkedArticle: false,
		syntax: "{{subst:welcome-rugbyunion}}~~~~"
	},
	"welcome-ru": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به روسیه",
		linkedArticle: false,
		syntax: "{{subst:welcome-ru}}~~~~"
	},
	"welcome-starwars": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های جنگ ستارگان",
		linkedArticle: false,
		syntax: "{{subst:welcome-starwars}}~~~~"
	},
	"welcome-ch": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به سوئیس",
		linkedArticle: true,
		syntax: "{{subst:welcome-ch|$USERNAME$|art=$ARTICLE$}} ~~~~"
	},
	"welcome-uk": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های مربوط به اوکراین",
		linkedArticle: false,
		syntax: "{{subst:welcome-uk}}~~~~"
	},
	"welcome-roads": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های جاده‌ها و بزرگ‌راه‌ها",
		linkedArticle: false,
		syntax: "{{subst:welcome-roads}}"
	},
	"welcome-videogames": {
		description: "خوش‌آمد به کاربرانی با علاقه‌ای آشکار در موضوع‌های بازی ویدئویی",
		linkedArticle: false,
		syntax: "{{subst:welcome-videogames}}"
	},
	"TWA invite": {
		description: "از کاربر برای ماجراجویی ویکی‌پدیا دعوت کنید (الگوی خوش‌آمد نیست)",
		linkedArticle: false,
		syntax: "{{WP:TWA/Invite|signature=~~~~}}"
	},

	// غیر اردو پیغامات خوش آمدید

	"welcomeen-ar": {
		description: "عربی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-ar}}"
	},
	"welcomeen-sq": {
		description: "البانوی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-sq}}"
	},
	"welcomeen-zh": {
		description: "چینی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-zh}}"
	},
	"welcomeen-nl": {
		description: "ولندیزی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-nl}}"
	},
	"welcomeen-fi": {
		description: "فنّش زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-fi}}"
	},
	"welcomeen-fr": {
		description: "فرانسیسی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-fr}}"
	},
	"welcomeen-de": {
		description: "جرمن زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-de}}"
	},
	"welcomeen-he": {
		description: "عبرانی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-he}}"
	},
	"welcomeen-ja": {
		description: "جاپانی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-ja}}"
	},
	"welcomeen-ko": {
		description: "کوریائی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-ko}}"
	},
	"welcomeen-mr": {
		description: "مراٹھی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-mr}}"
	},
	"welcomeen-ml": {
		description: "ملیالم زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-ml}}"
	},
	"welcomeen-or": {
		description: "اڑیہ زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-or}}"
	},
	"welcomeen-pt": {
		description: "پرتگالی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-pt}}"
	},
	"welcomeen-ru": {
		description: "روسی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-ru}}"
	},
	"welcomeen-es": {
		description: "ہسپانوی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-es}}"
	},
	"welcomeen-sv": {
		description: "سویڈش زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-sv}}"
	},
	"welcomeen-uk": {
		description: "یوکرینی زبان کے صارفین کے لیے پیغام خوش آمدید",
		linkedArticle: false,
		syntax: "{{subst:welcomeen-uk}}"
	}
};

Twinkle.welcome.getTemplateWikitext = function(template, article) {
	var properties = Twinkle.welcome.templates[template];
	if (properties) {
		return properties.syntax.
			replace("$USERNAME$", Twinkle.getFriendlyPref("insertUsername") ? mw.config.get("wgUserName") : "").
			replace("$ARTICLE$", article ? article : "").
			replace(/\$HEADER\$\s*/, "== خوش آمدید ==\n\n").
			replace("$EXTRA$", "");  // EXTRA is not implemented yet
	} else {
		return "{{subst:" + template + (article ? ("|art=" + article) : "") + "}}" +
			(Twinkle.getFriendlyPref("customWelcomeSignature") ? "~~~~" : "");
	}
};

Twinkle.welcome.callbacks = {
	preview: function(form) {
		var previewDialog = new Morebits.simpleWindow(750, 400);
		previewDialog.setTitle("سانچہ خوش آمدید کی نمائش");
		previewDialog.setScriptName("صارف کو خوش آمدید کہیں");
		previewDialog.setModality(true);

		var previewdiv = document.createElement("div");
		previewdiv.style.marginLeft = previewdiv.style.marginRight = "0.5em";
		previewdiv.style.fontSize = "small";
		previewDialog.setContent(previewdiv);

		var previewer = new Morebits.wiki.preview(previewdiv);
		previewer.beginRender(Twinkle.welcome.getTemplateWikitext(form.getChecked("template"), form.article.value));

		var submit = document.createElement("input");
		submit.setAttribute("type", "submit");
		submit.setAttribute("value", "بند کریں");
		previewDialog.addContent(submit);

		previewDialog.display();

		$(submit).click(function(e) {
			previewDialog.close();
		});
	},
	main: function( pageobj ) {
		var params = pageobj.getCallbackParameters();
		var text = pageobj.getPageText();

		// abort if mode is auto and form is not empty
		if( pageobj.exists() && params.mode === 'auto' ) {
			Morebits.status.info( 'هشدار', 'صفحهٔ بحث کاربر خالی نیست؛ در حال لغوکردن خوش‌آمد خودکار' );
			Morebits.wiki.actionCompleted.event();
			return;
		}

		var welcomeText = Twinkle.welcome.getTemplateWikitext(params.value, params.article);

		if( Twinkle.getFriendlyPref('topWelcomes') ) {
			text = welcomeText + '\n\n' + text;
		} else {
			text += "\n" + welcomeText;
		}

		var summaryText = "ویکیپیڈیا میں خوش آمدید!";
		pageobj.setPageText(text);
		pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
		pageobj.setWatchlist(Twinkle.getFriendlyPref('watchWelcomes'));
		pageobj.setCreateOption('recreate');
		pageobj.save();
	}
};

Twinkle.welcome.callback.evaluate = function friendlywelcomeCallbackEvaluate(e) {
	var form = e.target;

	var params = {
		value: form.getChecked("template"),
		article: form.article.value,
		mode: 'manual'
	};

	Morebits.simpleWindow.setButtonsEnabled( false );
	Morebits.status.init( form );

	Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
	Morebits.wiki.actionCompleted.notice = "خوش‌آمدید کہہ دیا گیا، اگلے چند سیکنڈوں میں تبادلۂ خیال صفحہ تازہ ہو جائے گا";

	var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "تبادلۂ خیال صفحہ میں ترمیم");
	wikipedia_page.setFollowRedirect(true);
	wikipedia_page.setCallbackParameters(params);
	wikipedia_page.load(Twinkle.welcome.callbacks.main);
};
})(jQuery);


//</nowiki>