Jump to content

User:Yahya/scripts/SNA.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//Created by Yahya
//Please give feedback on [[User Talk:Yahya]]
//See installation procedure on [[User:Yahya/scrips/SNA]]


if (mw.config.get("wgDBname") !== "bnwiki") {

(function() {
	$(document).ready(function() {
		mw.loader.using( ['mediawiki.util'], function() {
			{
				var L=mw.util.addPortletLink("p-navigation", "#", "Start a new article");
				if(L)L.addEventListener("click", create);
if (mw.config.get("wgDBname") === "enwiki") {
					var M=mw.util.addPortletLink("p-navigation", "#", "Start a new Draft");
					if(M)M.addEventListener("click", draf);
			}	
				return;
			}
		});
	});
}());
function create() {
	var art = prompt ("Article name?");
	switch (art) {
		case null:
		case undefined:
		case '':
		//Do nothing
		break;
		default:
		{
			window.open('/w/index.php?preload=Special:New_page&editintro=&title=' + art + '&create=Create+page#/editor/all', '_blank');
		}
	}
}
function draf() {
	var dra = prompt ("Draft name?");
	switch (dra) {
		case null:
		case undefined:
		case '':
		//Do nothing
		break;
		default:
		{
			window.open('/w/index.php?preload=Template%3AAfc+preload%2Fdraft&editintro=Template%3AAfC+draft+editintro&title=Draft:' + dra + '&create=Create+new+article+draft#/editor/all', '_blank');
		}
	}
  
}

}

if (mw.config.get("wgDBname") === "bnwiki") {

(function() {
	$(document).ready(function() {
		mw.loader.using( ['mediawiki.util'], function() {
			{
				var X=mw.util.addPortletLink("p-navigation", "#", "নতুন নিবন্ধ তৈরি");
				if(X) X.addEventListener("click", create);
				
				return;
			}
		});
	});
}());
function create() {
	var arti = prompt ("যে নিবন্ধটি তৈরি করতে চান তার নাম লিখুন:");
	switch (arti) {
		case null:
		case undefined:
		case '':
		//Do nothing
		break;
		default:
		{
			window.open('/w/index.php?preload=Special:New_page&editintro=&title=' + arti + '&create=Create+page#/editor/all', '_blank');
		}
	}


}

}