User:Yahya/scripts/SNA.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Yahya/scripts/SNA. |
//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');
}
}
}
}