صارف:Ulubatli Hasan/common.js

آزاد دائرۃ المعارف، ویکیپیڈیا سے

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

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

mw.loader.getScript( 'https://en.wikipedia.org/w/load.php?modules=ext.gadget.libSettings' ).then( function() {
	mw.loader.load( 'https://en.wikipedia.org/w/load.php?modules=ext.gadget.Shortdesc-helper' );
})
// <nowiki> // DO NOT REMOVE THIS LINE EVER
/*jslint browser: true, white: true*/
/*global mediaWiki, jQuery*/
/*!
 * @author User:Ebraminio, User:Yamaha5
 */
(function ($, mw) {
	'use strict';

	function createPage(title, text, summary, callback) {
		return new mw.Api().post({
			action: 'edit',
			title: title,
			text: text,
			summary: summary,
			createonly: '',
			minor: '',
			token: mw.user.tokens.get('csrfToken')
		}).then(function (data) {
			if (data.error && data.error.info) {
				mw.notify(title + ' نا کام: ' + data.error.info);
			} else {
				callback();
			}
			return data;
		}, function (data) {
			mw.notify(title + ' نا کام: ' + data);
			return data;
		});
	}

	function urWikiName(title) {
		return $.ajax({
			url: '//ar.wikipedia.org/w/api.php',
			data: {
				action: 'query',
				prop: 'langlinks',
				titles: title,
				redirects: 1,
				format: 'json',
				lllimit: 500
			},
			dataType: 'jsonp'
		}).then(function (data) {
			try {
				return $.grep($.map(data.query.pages, function (x) { return x; })[0].langlinks, function (x) {
					return x.lang === 'ur';
				})[0]['*'];
			} catch (ignore) { }
		});
	}

	function catParents(title) {
		return $.ajax({
			url: '//ar.wikipedia.org/w/api.php',
			data: {
				action: 'query',
				prop: 'categories',
				titles: title,
				clshow: '!hidden',
				cllimit: 500,
				format: 'json'
			},
			dataType: 'jsonp'
		}).then(function (data) {
			try {
				return $.map($.map(data.query.pages, function (x) { return x; })[0].categories, function (x) {
					return x.title;
				});
			} catch (ignore) { }
		});
	}

	function getWikidataEntity(artitle) {
		return new mw.Api({ ajax: { url: '//www.wikidata.org/w/api.php' } }).get({
			action: 'wbgetentities',
			format: 'json',
			sites: 'arwiki',
			titles: artitle,
			normalize: 'true',
			origin: window.location.protocol + '//' + window.location.hostname
		}).then(function (x) { return $.map(x.entities, function (x) { return x; })[0]; });
	}

	function commonsCatFromEntity(entity) {
		try {
			return entity.claims.P373[0].mainsnak.datavalue.value;
		} catch (ignore) { }
	}

	function startCat(urlink, arlink) {
		arlink = arlink.replace(/\_/g, ' ');
		return urWikiName(arlink).then(function (x) {
			if (x) {
				mw.notify('زمرہ پہلے سے موجود ہے');
				return;
			}
			return catParents(arlink).then(function (x) {
				if (!x) {
					mw.notify('صفحہ "' + arlink + '" ہدف ویکی میں موجود نہیں یا زمرہ موجود نہیں ہے');
					return;
				}
				return $.when.apply(null, $.map(x, function (y) {
					return urWikiName(y);
				})).then(function () {
					var catText = $.map(arguments, function (x) {
							return '[[' + x + ']]';
						}).join('\n') + '\n[['+'ar:' + arlink + ']]';
					catText = catText.replace(/\[\[undefined\]\]/g, '');
					catText = catText.replace(/\n\n/g, '\n');
					catText = catText.trim();
					return createPage(
						urlink,
						catText,
						'تخلیق زمرہ بمطابق [[:ar:' + arlink + ']] بذریعہ آلہ زمرہ ساز',
						function () {
							mw.notify('تخلیق ' + urlink + ' کامیابی سے مکمل۔');
						}
					);
				});
			});
		});
	}

	function loadPage(title) {
		return new mw.Api().get({
			action: 'query',
			prop: 'revisions',
			titles: title,
			rvprop: 'content',
			format: 'json'
		}).then(function (data) {
			return $.map(data.query.pages, function (value) { return value; })[0].revisions[0]['*'];
		});
	}
 
	/**
	 * Save a page
	 */
	function savePage(title, text, summary) {
		return new mw.Api().post({
			action: 'edit',
			title: title,
			text: text,
			summary: summary,
			nocreate: '',
			minor: '',
			token: mw.user.tokens.get('csrfToken')
		}).then(function (data) {
			if (data.error && data.error.info) {
				mw.notify(data.error.info);
			}
		}, function (data) {
			mw.notify(data);
		});
	}

	function init(e) {
		e.preventDefault();
		$('<div>' +
			'<div style="width: 40em">زمرہ جات تخلیق کرنے کے لیے درج ذیل مثالیں ملاحظہ فرمائیں:<br>زمرہ1@Cateogry1<br>زمرہ2@Cateogry2<br>زمرہ3@Cateogry3</div><br><B>اہم نکات:</B><br><B>1-</B> نو تخلیق شدہ زمرے  چند گھنٹوں کے بعد <a href="//ur.wikipedia.org/w/index.php?title=ویکیپیڈیا:روبہ_جات" target="ویکیپیڈیا:روبہ جات">ویکیپیڈیا:روبہ جات</a> کی مدد سے <a href="//ur.wikipedia.org/w/index.php?title=ویکیپیڈیا:ویکی_ڈیٹا" target="ویکیپیڈیا:ویکی ڈیٹا">ویکیپیڈیا:ویکی ڈیٹا</a> سے منسلک ہو جائیں گے، جس کے بعد ہی دوسرے خودکار ذرائع سے ان کو صفحات پر لگایا جائے گا؛ تاہم اگر آپ چاہیں تو فوری طور پر خود ان زمرہ جات کو ویکی ڈیٹا سے مربوط کر سکتے ہیں اور انہیں صفحات پر استعمال کر سکتے ہیں۔<br><B>2-</B>جو زمرے انگریزی ویکی پر موجود نہیں وہ نہیں بنائے جا سکیں گے۔<br>' +
			'<textarea style="width: 100%; background-color: yellow;" placeholder="زمرہ1@Cateogry1" id="catmakerinput" rows="7"></textarea>' +
			'</div>'
			).dialog({
			modal: true,
			width: 700,
			buttons: [{
				id: 'catmaker-button-import',
				text: 'تخلیق زمرہ',
				click: function () {
					var formInput = $('#catmakerinput').val();
					formInput = formInput.replace('*', '').replace('#', '').replace('---', '@')
					if (formInput === '') { mw.notify('براہ کرم درست اندراج کریں'); return; }
					var requests = formInput.trim().split('\n');
					if (requests.length > 1000) {
						loadPage('ویکیپیڈیا:ویکی منصوبہ زمرہ جات/درخواست تخلیق').then(function (content) {
							return savePage('ویکیپیڈیا:ویکی منصوبہ زمرہ جات/درخواست تخلیق', content + '\n*' + requests.join('\n*').replace(/@/g, '---'), 'مدد طلب کریں [[میڈیاویکی:Gadget-CatMaker.js|آلہ زمرہ ساز]]').then(function () {
								mw.notify('آپ کی درخواستیں روبہ سے بنانے کے لیے رکھ دی گئی ہیں، براہ کرم جانچ لیں۔');
								window.location = mw.util.getUrl('ویکیپیڈیا:ویکی منصوبہ زمرہ جات/درخواست تخلیق', { action: 'history' });
							});
						});
						return;
					}
					$.when.apply(null, $.map(requests, function (x) {
						var req = x.replace(/زمرہ:/, '').replace(/Category:/i, '').split('@');
						if (req.length !== 2) { return; }
						return startCat('زمرہ:' + req[0], 'Category:' + req[1]);
					})).then(function () {
						mw.notify('تخلیق زمرہ مکمل، براہ مہربانی جانچ لیں۔');
						window.location = mw.util.getUrl('Special:Contributions/' + mw.config.get('wgUserName'));
					});
				}
			}]
		});
	}

	$(function () {
		mw.util.addCSS('#t-catmaker { font-weight: bold; }');
		$(mw.util.addPortletLink('p-tb', '#', '/زمرہ ساز/عربی', 't-catmaker', 'تخلیق زمرہ جات بذریعہ آلہ زمرہ')).click(init);
	});
}(jQuery, mediaWiki));

importScript('User:Kephir/gadgets/rater.js'); // [[User:Kephir/gadgets/rater]]

importScript('MediaWiki:Gadget-afchelper-beta.js'); // AFCH beta script [[MediaWiki:Gadget-afchelper-beta.js]]

importScript("User:Writ Keeper/Scripts/teahouseUtility.js"); // Gives one-click option to add Teahouse invitation or talkback to a user

importScript("User:Writ Keeper/Scripts/teahouseTalkback.js"); // Adds Talkback reminder when you save an edit at the Teahouse

importScript("User:Writ Keeper/Scripts/teahouseTalkbackLink.js"); // Adds a talkback link to signatures on the Teahouse 

importScript('User:Ryan Vesey/THQ.js'); // Adds Teahouse link to sidebar

importScript("User:Ocaasi/WikiLoveinstallscript.js");// Adds Teahouse Badges to WikiLove

//Adds 'Check Refs' to the toolbox, links to http://toolserver.org/~dispenser/cgi-bin/reflinks.py -- Dispenser's reference title fixer.

function refcheck()
{
  mw.util.addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webreflinks.py?page=" + wgPageName + "&citeweb=on", "Check Refs");
}
 
function linkcheck()
{
  mw.util.addPortletLink("p-tb", "http://toolserver.org/~dispenser/cgi-bin/webchecklinks.py?page=" + wgPageName, "Check Links");
}
 
if ( wgNamespaceNumber == 0 ) {
 $(refcheck);
 $(linkcheck);
}


importScript('User:Kephir/gadgets/sagittarius.js'); // [[User:Kephir/gadgets/sagittarius]]

importScript('User:Mattflaschen/CommonsHelper Labs.js'); // Transfer

importScript('User:Hammad/rollbackTouch.js'); // Linkback: [[User:Hammad/rollbackTouch.js]]

importScript('User:Howcheng/quickimgdelete.js');

importScript('User:Hammad/duplinks.js'); // [[User:Hammad/duplinks]]

// sMirC Emoticons-bar for the WikiEditor
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Perhelion/WikiEditorEmoticons.js&action=raw&ctype=text/javascript&maxage=86400&smaxage=86400&bcache=1');

importScript('User:Mr. Stradivarius/gadgets/Draftify.js'); // Linkback: [[User:Mr. Stradivarius/gadgets/Draftify.js]]

/* User:Epicgenius/stubtag.js */
importScript( 'User:Epicgenius/stubtag.js' ); // Backlink: [[User:Epicgenius/stubtag.js]]

importScript('User:Mr.Z-man/closeAFD.js');

importScript('User:Ohconfucius/script/Common Terms.js'); // [[User:Ohconfucius/script/Common Terms.js]]

importScript('User:Ohconfucius/script/formatgeneral.js'); // [[User:Ohconfucius/script/formatgeneral.js]]

importScript('User:Ohconfucius/script/flagcruft.js'); // [[User:Ohconfucius/script/flagcruft.js]]

importScript('User:Ohconfucius/script/MOSNUM dates.js'); // [[User:Ohconfucius/script/MOSNUM dates.js]]

importScript('User:Ohconfucius/script/EngvarB.js'); // [[User:Ohconfucius/script/EngvarB.js]]

// INSECURE JS LOAD importScript("User:GregU/dashes.js");

/* User:Qwertyytrewqqwerty/DisamAssist.js */
// INSECURE JS LOAD importScript( 'User:Qwertyytrewqqwerty/DisamAssist.js' ); // Backlink: [[User:Qwertyytrewqqwerty/DisamAssist.js]]


importScript("User:PleaseStand/userinfo.js");

importScript('User:Howcheng/quickimgdelete.js');

importScript( 'User:Dschwen/MegapixelDisplay.js' );

importScript('User:Hammad/CatListMainTalkLinks.js');

// INSECURE JS load importScript('User:Shubinator/DYKcheck.js');

importScript('User:Yethrosh/insertVectorButtons.js');
importScript('میڈیاویکی:Gadget-AutoEd.js');
importScript('User:Yethrosh/test.js');  

importScript('User:Hammad/Advisor.js');
importScript( 'User:Equazcion/ScriptInstaller.js' ); // Backlink: [[User:Equazcion/ScriptInstaller.js]]
// INSECURE JS LOAD importScript('User:APersonBot/AFCRHS.js'); //Linkback: [[User:APersonBot/AFCRHS.js]] Added by Script installer
importScript('User:Hammad/rater.js'); //Linkback: [[User:Evad37/rater.js]] Added by Script installer
/*global mw */
/*jshint strict: false, browser: true, jquery: true */
/**
 * Extra toolbar options
 *  
 *  Description: Adds extra buttons to the old (non-enhanced) editing toolbar.
 *  
 *  Maintainers: [[User:Yethrosh]]
 */

function addExtraButtons () {
	mw.toolbar.addButtons(
	{
		imageId: 'button-quote',
		imageFile: '//upload.wikimedia.org/wikipedia/commons/0/07/Quotations_Marks.jpg',
		speedTip: 'اقتباس',
		tagOpen: '{{اقتباس|',
		tagClose: '}}',
		sampleText: 'یہاں اقتباس درج کریں'
	},
	{
		imageId: 'button-insert-sheyr',
		imageFile: '//upload.wikimedia.org/wikipedia/commons/0/07/Quotations_Marks.jpg',
		speedTip: 'شعر درج کریں',
		tagOpen: '{{شعر آغاز}}{{ب|',
		tagClose: '}}{{شعر اختتام}}',
		sampleText: 'یہاں شعر درج کریں'
	},
	{
		imageId: 'button-insert-reference',
		imageFile: '//upload.wikimedia.org/wikipedia/commons/0/07/Quotations_Marks.jpg',
		speedTip: 'حوالہ جات کا سانچہ درج کریں',
		tagOpen: '== حوالہ جات ==',
		tagClose: '{{حوالہ جات}}',
		sampleText: ''
	}
	);
}

mw.loader.using( 'user.options', function () {
	// This can be the string "0" if the user disabled the preference ([[bugzilla:52542#c3]])
	if ( mw.user.options.get( 'usebetatoolbar' ) != 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
		$.when(
			mw.loader.using( 'mediawiki.toolbar' ),
			$.ready
		).then( addExtraButtons );
	}
} );
importScript('User:Yethrosh/XFDcloser.js');
importScript('صارف:Yethrosh/refill.js')
importScript('User:Smith609/citations.js'); //Linkback: [[User:Smith609/citations.js]] Added by Script installer
importScript('User:Ulubatli_Hasan/reply-link.js'); // Backlink: [[User:Ulubatli_Hasan/reply-link.js]]