پرش به محتوا

Gadget-CreatePage.js - فراغیب

از فراحوزه
esfandiari>Esfandiari
جز ۱ نسخه واردشده
جز ۲ نسخه واردشده
 
(بدون تفاوت)

نسخهٔ کنونی تا ‏۲۵ ژوئن ۲۰۲۶، ساعت ۰۸:۳۹

//Copied from کاربر:Jeeputer/subpageCreator.js ---> [[special:permalink/31158190]]
//Created by Yahya
//Please give feedback on [[User Talk:Yahya]]
//See installation procedure on [[User:Yahya/scrips/SNA]]

(function() {
	$(document).ready(function() {
		mw.loader.using( ['mediawiki.util'], function() {
			{
				var L = mw.util.addPortletLink("p-tb", "javascript:void(0)", "زیرصفحه‌ساز", 'p-subpcr', 'ایجاد زیرصفحهٔ کاربری تازه', 'null', '#utcdate');
				L.addEventListener("click", subpage);
					var M=mw.util.addPortletLink("p-tb", "javascript:void(0)", "مقاله‌ساز", 'p-artcr', 'ایجاد مقالهٔ تازه', 'null', '#p-subpcr');
				M.addEventListener("click", article);
				
				return;
			}
		});
	});
}());
function subpage() {
	var user = mw.config.get("wgUserName");
	var subp = prompt ("عنوان زیرصفحه؟");
	switch (subp) {
		case null:
		case undefined:
		case '':
		//Do nothing
		break;
		default:
		{
			window.open('/w/index.php?preload=Special:New_page&editintro=&title=کاربر:' + user +'/' + subp + '&action=edit', '_blank');
		}
	}
}
function article() {
	var art = prompt ("عنوان مقاله؟");
	switch (art) {
		case null:
		case undefined:
		case '':
		//Do nothing
		break;
		default:
		{
			window.open('/w/index.php?title=' + art + '&action=edit', '_blank');
		}
	}

}