Jump to content

User:Mandarax/common.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.
// <nowiki> See [[mw:Manual:Interface/JavaScript]] for info including variables

mw.loader.using( 'mediawiki.util' ).done(function(){ 

CurNS=mw.config.get('wgCanonicalNamespace'); // Current namespace
CurNSnum=mw.config.get('wgNamespaceNumber'); // Current namespace number
CurPg=mw.config.get('wgPageName'); // Current page name
Action=mw.config.get('wgAction');
Script=mw.config.get('wgScript');
Firefox=navigator.userAgent.match(/(Firefox)/i);

// In desktop mode, iPad UA is same as a Mac. The rare times I use a Mac, this will think it's a mobile.
MOBILE=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Macintosh)|(android)|(webOS)/i);
//MOBILE=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i);

// ========= DISPLAY AT BOTTOM (OR TOP) OF PAGE ==========
function showTxt(txt,top)
	{
	line='<h4 style="text-align:center;"><tt>'+txt+'</tt></h4>';
	if (top) $('body').prepend(line);
	else $('body').append(line);
	}

// a convenient way to display test values
if (CurPg=="User:Mandarax/common.js")
	{
	if (MOBILE) MYN="yes"; else MYN="no";
	showTxt("MOBILE: " + MYN + " (" + MOBILE + ") • navigator.userAgent = " + navigator.userAgent, 1);
	}

// ===== ROLLBACK CONFIRMATION WITH CUSTOM SUMMARY ======
$(".mw-rollback-link").on('click', function(e) {
	var count = e.target.innerText.match(/\d/) ? e.target.innerText.match(/\d+/)[0] : null;
	if (count >1) plural="s"; else plural="";
	var summary = prompt('Rollback ' + count + ' edit' + plural + ' by ' + mw.util.getParamValue('from',e.target.href) + '?\n\nEnter text to append to custom rollback summary.\n\nLeave blank to use standard rollback.\n\n', "");
	if (summary == undefined)
		return e.preventDefault();
	else if (summary == "")
		return true;
	summary="Undid edit" + plural + " by [[Special:Contribs/$2|$2]] ([[User talk:$2|talk]]); rv to last ver by $1 – " + summary;
	e.target.href += "&summary=" + encodeURIComponent(summary);
	return true;
	});

var styleEle = document.getElementsByTagName("head")[0].appendChild(document.createElement("style"));
styleEle.sheet.insertRule(".mw-rollback-link {background-color:#f2deff;}", 0);


// ============= MISC ONE-LINERS =============

importScript('User:Shubinator/DYKcheck.js');fixedSidebar="never"; // DYKCHECK
importScript('User:Ohconfucius/dashes.js');		// DASHES
importScript('User:Uziel302/typo.js');			// CORRECT TYPOS IN ONE CLICK
importScript('User:Ingenuity/AntiVandal.js');	// ANTI-VANDAL
importScript('User:SD0001/find-archived-section.js'); // FIND ARCHIVED SECTION FROM CLICKED-ON LINK
importScript('User:Numbermaniac/goToBottom.js');// GO TO BOTTOM
importScript('User:Numbermaniac/goToTop.js');	// GO TO TOP
DiffOnly="all";importScript('User:Mr. Stradivarius/gadgets/DiffOnly.js'); // SHOW DIFFS W/O CONTENT
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:SMcCandlish/userinfo.js&action=raw&ctype=text/javascript');	// DISPLAY USER INFO

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Joeytje50/JWB.js/load.js&action=raw&ctype=text/javascript'); // JWB

// ============ DISABLE /* top */ EDIT SUMMARY =============
if ($('#wpSummary').val()=="/* top */ ") $('#wpSummary').val("");

// ======= ITEMS TO INSTALL ONLY IF NOT ON A MOBILE DEVICE =======
if (!MOBILE)
{
importScript('MediaWiki:Gadget-popups.js');	// POPUPS
importStylesheet('MediaWiki:Gadget-navpop.css');
window.popupStructure='menus';
window.popupHideDelay=0.3;
window.popupFixDabs=true;
window.popupFixRedirs=true;
window.popupRedlinkRemoval=true;

importScript('User:Endo999/GoogleTrans.js');	// GOOGLETRANS
mw.util.addPortletLink('p-tb',"javascript:GT.SCSettings()", "GoogleTrans", "", "GoogleTrans options");

}

// ======== PREVENT ACCIDENTAL SUBMIT IF ENTER IS HIT IN EDIT SUMMARY ========

$(document).ready(function(){
    $('input#wpSummary').keypress(function(e){
        if(e.which==13) {alert('Click "Publish changes"'); e.preventDefault();}
    });
});

// ===== DISABLE "PUBLISH CHANGES" BUTTON IF SUMMARY IS BLANK OR JUST /* ... */ =====

if(Action=="edit" || Action=="submit") {
document.getElementById("wpSave").addEventListener("click", function(event){
  if(/(^\/\*.*\*\/ $|^$)/.test($('#wpSummary').val()))
    {alert("No edit summary entered"); event.preventDefault()}
  });
}

// ===== CHECK "MINOR EDIT" BY DEFAULT (EXCEPT USER TALK & WT) ======

if(Action == 'edit' && CurNSnum!=3 && CurNSnum!=5) {
    addOnloadHook(function minorEdit() {
       document.getElementById('wpMinoredit').checked = true;
    });
}

// ========= FOCUS ON TEXTAREA WHEN STARTING EDIT ==========

if(Firefox && Action == 'edit') {
  $( function () {
    $( '#wpTextbox1' ).focus();
  } );
}

// ================= COMMENTS IN LOCAL TIME =================

importScript('User:Mxn/CommentsInLocalTime.js');
if (MOBILE)
	{
	window.LocalComments = $.extend(window.LocalComments, {
		formats: {
			day: "LLL",
			week: "LLL",
			other: "LLL",
		},
		tooltipFormats: [],
	});
	}
else
	{
	window.LocalComments = $.extend(window.LocalComments, {
		formats: {
			day: function (then) { return then.fromNow(); },
			week: function (then) { return then.calendar(); },
			other: "LLL",
		},
		tooltipFormats: [
			function (then) { return then.fromNow(); },
			"ddd MMM DD YYYY HH:mm ZZ (h:mm a)",
			function (then) { return then.utc(); },
			// Wiki format is "HH:mm, DD MMMM YYYY (UTC)"
		],
	});
	}
// ================== FORCE DESKTOP VIEW ==================

$(document).ready(function() {
if(window.location.origin.includes(".m")){
	if(window.location.pathname.includes("/wiki/")){
		window.location="https://en.wikipedia.org/w/index.php?title="+window.location.pathname.replace("/wiki/","")+"&mobileaction=toggle_view_desktop";
	}
	else{
		window.location=window.location.href.replace(".m","")+"&mobileaction=toggle_view_desktop";
	}
}
});

// ======================= HOTCAT =========================

window.hotcat_use_category_links = true;
window.hotcat_no_autocommit = true;
window.hotcat_del_needs_diff = true;

// =========== ADD DROPDOWN meta:MoreMenu ITEMS  ===========

mw.hook('moremenu.ready').add(function (config) {

    MoreMenu.addLink(
        'user',
        'Edit count',
        'https://en.wikipedia.org/w/api.php?action=query&list=users&usprop=editcount&ususers=' + config.targetUser.name
    );

    MoreMenu.addLink(
        'user',
        'Userspace',
        mw.util.getUrl('Special:PrefixIndex/User:' + config.targetUser.name + '/')
    );
    MoreMenu.addLink(
        'page',
        'Edit current version',
         mw.util.getUrl('Special:EditPage/'+CurPg), true
    );
    MoreMenu.addLink(
        'page',
        'Skip to bottom',
        '#footer', true
    );
    MoreMenu.addSubmenuLink(
        'page', 'tools', 
        'Reflinks',
        'https://dispenser.info.tm/~dispenser/cgi-bin/reflinks.py?page='+CurPg
    );
    MoreMenu.addSubmenuLink(
        'page', 'tools', 
        'Dab solver',
        'http://69.142.160.183/~dispenser/cgi-bin/dab_solver.py?page='+CurPg
    );
    MoreMenu.addSubmenuLink(
        'page', 'tools', 
        'GoogleTrans',
        'javascript:GT.SCSettings()'
    );
});

// =============== RENAME TABS ===============

function RenameTab(TabID, TabLabel) {
    var tab, tablink;
    tab = document.getElementById('ca-'+TabID);
    if (!tab) {return;}

    tablink = tab.getElementsByTagName('a')[0];
    if (!tablink) {return;}

    tablink.firstChild.nodeValue = TabLabel;
    if ( mw.config.get( 'skin' ) === 'monobook' ) {
      tablink.style.paddingLeft = ".4em";
      tablink.style.paddingRight = ".4em";
    }
};

if (CurPg=='Main_Page') RenameTab('nstab-main', 'Main');
//else RenameTab('nstab-main', 'Art'); // article
RenameTab('nstab-help', 'Help');
RenameTab('nstab-special', 'Special');
RenameTab('nstab-project', 'Project');
RenameTab('nstab-user', 'User');
RenameTab('edit', 'Edit');
RenameTab('viewsource', 'Source');
//Other tab IDs: 'talk' 'history' 'addsection'

//Didn't work to replace "edit source": 
//'editsource', 'visualeditor-ca-editsource', 'monobook-view-edit'

// ================= ADD ITEMS TO TOOLBOX =================

// === Create new toolbox ===
function addPortlet(id, title, before, px) {
	//Some "before" portlets:	navigation: 'p-navigation'	search: 'p-search'	
	//contribute: 'p-interaction'	tools 'p-tb'	languages: 'p-lang'
	if (!px) px=11;
	var copy = document.getElementById('p-tb');
	var div = document.createElement('div');
	div.setAttribute('id', id);
	div.setAttribute('class', copy.getAttribute('class'));
	div.innerHTML = '<span style="color:black;font-size:' + px + 'px">&nbsp;' + title + '</span>';
	var pBody = document.createElement('div');
	pBody.setAttribute('class', copy.getElementsByTagName('div')[0].getAttribute('class'));
	pBody.appendChild(document.createElement('ul'));
	div.appendChild(pBody);
	if (before && (before = document.getElementById(before))) {
		copy.parentNode.insertBefore(div, before);
	} else {
		copy.parentNode.appendChild(div);
	}
	return pBody;
}

addPortlet('p-mx', 'Mx', 'p-tb');

function addlink(action, DispTxt, tb){ // "standard" toolbox is p-tb; function default is p-mx
if (!DispTxt) DispTxt=action;
if (!tb) tb='mx';
mw.util.addPortletLink( // [[Help:Customizing toolbars]]
	'p-'+tb, // where to put the link
	action, // action
	DispTxt, // text to display
	'', // internal ID
	DispTxt // mouseover text
	// ,Shortcut key press
	// ,Existing portlet link to place the new portlet link before
	);}

//addlink('https://dispenser.info.tm/~dispenser/cgi-bin/dablinks.py?page='+CurPg, 'Dablinks');
//addlink('https://dispenser.info.tm/~dispenser/cgi-bin/reflinks.py?page='+CurPg, 'Reflinks');
//addlink('http://wikipedia.ramselehof.de/wikiblame.php?lang=en&article='+CurPg, 'WikiBlame');

if (CurNSnum%2==1||CurNSnum==4) addlink(Script+'?title='+CurPg+'&dtenable=1', 'Section subscribe'); //WP or any talk namespace
addlink(Script+'?title=Special:PrefixIndex/User:Mandarax/&action=view', 'My userspace');
addlink(Script+'?title=User:Mandarax/u&action=view', 'Util');
addlink(Script+'?title=Special:WhatLinksHere/'+CurPg+'&namespace=0', 'What links here (art.)');
addlink(Script+'?title=User:Mandarax/a&action=edit', 'Edit Wendt');
addlink(Script+'?title=User:Mandarax/b&action=edit', 'Edit Gypsography');
addlink(Script+'?title=User:Mandarax/c&action=edit', 'Edit Fénéon');
addlink('/wiki/Wikipedia:AntiVandal/run', 'AntiVandal');
addlink(Script+'?title='+CurPg+'&safemode=1', 'Safe mode');
addlink(Script+'?title=Special:UserLogout&returnto='+CurPg, 'Log out');
addlink(Script+'?title=Special:NewPages&action=view', '⇒ New pages', 'tb');

// ====================== TEMPLATESCRIPT ========================
/** [[Meta:TemplateScript]]
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 * @update-token [[File:Pathoschild/templatescript.js]]
 */
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
	pathoschild.TemplateScript.add([
		// add your own templates or scripts here
		{ name: 'welcome', template: '{{subst:welcome}} ~~~~', position: 'after', editSummary: 'welcome!', forNamespaces: 'user talk' },
	]);
});

// ========== SHOW DIFF/PERMALINK INFO AT BOTTOM OF PAGE ===========
$.when( $.ready, mw.loader.using(["mediawiki.util"]) ).then( function () {
	var suffix = mw.config.get("wgDiffNewId");
	if (suffix) {
		if (document.getElementsByClassName("diff-multi").length
			|| CurPg === "Special:ComparePages")
			{suffix = mw.config.get("wgDiffOldId") + "/" + suffix;}
		showTxt("[[Special:Diff/" + suffix + "&#124;diff]]");
		}
	else {
		var oldidMatch = mw.util.getParamValue("oldid");
		if(oldidMatch)
			{showTxt("[[Special:Permalink/" + oldidMatch + "&#124;permalink]]");}
		}
	} );

// ======== SHOW {{Unsigned}} AT BOTTOM OF DIFF TALK+ PAGES =========
// For potential unsigned comments on talk, WP, template (for DYK noms)
// Works with any of the four Wiki date formats available in Prefs
if (mw.config.get('wgDiffNewId') && (CurNSnum%2==1||CurNSnum==4||CurNSnum==10)) 
	{
	const month=[];
	month["Jan"]="January"; month["Feb"]="February"; month["Mar"]="March";
	month["Apr"]="April"; month["May"]="May"; month["Jun"]="June";
	month["Jul"]="July"; month["Aug"]="August"; month["Sep"]="September";
	month["Oct"]="October"; month["Nov"]="November"; month["Dec"]="December";

	usr=document.getElementById('mw-diff-ntitle2').firstChild.firstChild.firstChild.nodeValue;
	rev=document.getElementById('mw-diff-ntitle1').firstChild.firstChild.firstChild.nodeValue;
	//Change to format Apple accepts; e.g. 09:31, October 25, 2021 → October 25, 2021 09:31
	var ts = new Date(rev.replace(/(Latest )?Revision as of (..:..), (.*)/i, "$3 $2"));
	ts=ts.toUTCString();
	mth=ts.substr(8, 3);
	//UTCtime:     Sat,   06   Feb   2021   17 : 42  :00 GMT → 09:42, 6 February 2021 (UTC)
	ts=ts.replace(/..., (\d+) (...) (\d+) (\d+):(\d+).*/,     "$4:$5, $1 $2 $3 (UTC)");
	ts=ts.replace(mth, month[mth]).replace(", 0", ", ");
	showTxt("{{subst:Unsigned|" + usr + "|" + ts + "}}");
	}
	
//============= ADD UNREDIRECTED LINK NEXT TO REDIRECTS =============

$(function() {
	$('#mw-content-text .mw-redirect').after(function() {
		return this.href.indexOf('redirect=no') !== -1 || this.href.indexOf('action=') !== -1  || this.href.indexOf('diff=') !== -1 ? ''
			: '<a href="' + this.href 
			+ (this.href.includes('?') ? '&' : '?')
			+ 'redirect=no" title="' + (this.title || this.href)
			+ ' (redirect pg)"><sup style="color:#97ad18"> Я</sup></a>';
	});});

// ================= EDIT SUMMARIES ==================
// modified from MediaWiki:Gadget-defaultsummaries.js

( function () { // Wrap with anonymous function
var $summaryBox = $( '#wpSummary' ),
clearSummary='<clear summary>';
generalSummaries = [
	clearSummary,
	'[[User:Mandarax/litterally|litterally]]',
	'[[MOS:&]]',
	'[[MOS:...]]',
	"[[MOS:']]",
	'[[MOS:AMU]]: "If text is enclosed in quotation marks, do not include the quotation marks in any additional formatting markup"',
	'[[MOS:CAPFRAG]]: "Most captions are ... sentence fragments, which should not end with a period"',
	'[[MOS:CONTRACTIONS]]',
	'[[MOS:CURLY]]',
	'[[MOS:DATECOMMA]]: "Dates in month–day–year format require a comma after the day, as well as after the year, unless followed by other punctuation"',
	'[[MOS:DATERANGE]]',
	'[[MOS:DATESNO]]',
	'[[MOS:DATETIES]]: "Articles on topics with strong ties to a particular English-speaking country should generally use the date format most commonly used in that nation"',
	'[[MOS:DECADE]]',
	'[[WP:DOFIXIT]]: "Spelling errors and other mistakes should be corrected. Don\'t link to a misspelled redirect."',
	'[[MOS:EGG]]',
	'[[MOS:ENDASH]]',
	'[[MOS:ENTO]]',
	'[[MOS:GEOCOMMA]]: "In geographical references that include multiple levels of subordinate divisions ..., a comma separates each element and follows the last element unless followed by other punctuation"',
	'[[MOS:INITIALS]]',
	'[[MOS:LAYOUT]]',
	'[[MOS:LINKINNAME]]',
	'[[WP:MPNOREDIRECT]]',
	'[[MOS:NUMERAL]]: "Integers from zero to nine are spelled out in words"',
	'[[MOS:NUMNOTES]]: "Comparable values nearby one another should be all spelled out or all in figures, even if one of the numbers would normally be written differently"',
	'[[MOS:OVERLINK]]',
	'[[MOS:PIPESTYLE]] - links with plurals and other derived terms and/or initial lower case letters are simpler and clearer when not piped',
	'[[MOS:POINTS]]: "If an abbreviation ending in a full point ends a sentence, do not use an extra full point"',
	'[[MOS:REFPUNCT]] – "All ref tags should immediately follow the text to which the footnote applies, with no intervening space"',
	'[[MOS:SEAOFBLUE]]',
	'[[MOS:SIC]] – "insignificant spelling and typographic errors should simply be silently corrected"',
	'[[WP:STUBSPACING]] – "Leave two blank lines between the first stub template and whatever precedes it"',
	'[[MOS:TIES]] – US spelling for US subject',
	'[[WP:WTAF]], if notable',
	'{{[[Template:--)|--)]]}} to prevent italic character from crashing into ")"',
	'{{[[Template:-"|-"]]}} to prevent italic character from crashing into quotation mark',
	'{{Convert}}',
	'{{R from misspelling}} → {{R from miscapitalisation}}',
	'{{R from misspelling}} → {{R from alternative transliteration}}',
	'Add/edit sort key per [[WP:SORTKEY]], [[WP:NAMESORT]], and/or [[WP:MCSTJR]]',
	'Add hatnote',
	"Add image as [[WP:DYKIMG|required for DYK]]. Feel free to do a different placement and/or size. If you'd like, you may remove it after the Main Page appearance.",
	'Add listas',
	'Add missing space',
	'Add missing word',
	'As in target article',
	'Better link',
	'Better redirect target',
	'Consistent date format',
	'Correct abbreviation form',
	'Correct capitalization',
	'Correct diacritical marks',
	'Correct link/punctuation',
	'Correct name',
	'Correct name; italics',
	'Correct name/punctuation',
	'Correct name – [[MOS:ARTCON]]: "Proper names use the subject\'s own spelling"',
	'Correct name ([[MOS:ARTCON]]) – see http://www.acp.int/',
	'Correct name ([[MOS:ARTCON]]) – see https://www.cgdev.org/',
	'Correct name ([[MOS:ARTCON]]) – see http://www.fao.org/',
	'Correct name ([[MOS:ARTCON]]) – see https://www.icao.int/Pages/Contact_us.aspx',
	'Correct name ([[MOS:ARTCON]]) – see https://www.ilo.org/',
	'Correct name ([[MOS:ARTCON]]) – see International Maritime Organization https://www.imo.org/',
	'Correct name ([[MOS:ARTCON]]) – see International Organization for Standardization https://www.iso.org',
	'Correct name ([[MOS:ARTCON]]) – see https://www.nato.int/',
	'Correct name ([[MOS:ARTCON]]) – see http://www.oecd.org/about/',
	'Correct name ([[MOS:ARTCON]]) – see https://www.opcw.org/',
	'Correct name ([[MOS:ARTCON]]) – see https://www.osce.org/who-we-are',
	'Correct name ([[MOS:ARTCON]]) – see https://www.unesco.org/en/brief',
	'Correct name ([[MOS:ARTCON]]) – see https://www.who.int/',
	'Correct name ([[MOS:ARTCON]]) – see https://www.wipo.int/',
	'Correct name ([[MOS:ARTCON]]) – see World Organization of the Scout Movement https://www.scout.org/governance',
	'Correct name ([[MOS:ARTCON]]) – see World Tourism Organization https://www.unwto.org/contact-us',
	'Correct name ([[MOS:ARTCON]]) – see World Trade Organization https://www.wto.org/',
	'Correct punctuation',
	'Correct spelling',
	'Correct spelling, as in target article',
	'Correct spelling/link',
	'Correct spelling; italics',
	"Correct spelling. The source is not online, so I assume that it was transcribed incorrectly; otherwise, it may be restored, with a [sic].",
	'Correct symbol',
	'Correct term',
	'Correct title',
	'Correct title; italics',
	'Correct word',
	'Create category',
	'Create redirect',
	'Dab',
	'Ditto',
	'En dashes',
	'Fix broken template',
	'Fix broken template, but please complete required fields',
	'Fix DISPLAYTITLE conflict',
	'Fix double word',
	'Fix [[run-on sentence]]',
	'Fix sort key per [[WP:SORTKEY]], [[WP:NAMESORT]], and/or [[WP:MCSTJR]]',
	'Fix sort key conflict; see [[WP:SORTKEY]], [[WP:NAMESORT]], and/or [[WP:MCSTJR]]',
	"Fix sort key conflict, using article's DEFAULTSORT",
	'Fix template',
	'Fix typo',
	'Formatting',
	'Hyphen',
	'Italics',
	'It\'s "[[Its (pronoun)|its]]", not "[[it\'s]]"',
	'It\'s "[[Its (pronoun)|Its]]", not "[[It\'s]]"',
	'lc per [[WP:HEAD]]',
	'Misspelled piped redirect',
	'Misspelled redirect piped to the object of the redirect',
	'More specific redirect target',
	'Nambia is a country that exists only [[American Name Society#Name of the Year|in the mind of Donald Trump]]',
	'Oh, there was another one',
	'Ack! On this iPad, I make an apostrophe by swiping down on the "k".',
	'Piped redirect',
	'Piped, incorrectly punctuated, redirect',
	'publisher → work',
	'Re [[User:X|X]]',
	'Redirect piped to the object of the redirect',
	'Redirects to dab page with no relevant entry',
	'Redirects to wrong page',
	"Replace unnecessary and incorrect apostrophe template – {{[[Template:'|']]}} adds extra space and should only be used with italics",
	'rm category which is no longer applicable',
	'rm duplicate categories',
	'rm inapplicable category',
	'rm deprecated or invalid parameter',
	'rm stray character',
	'rm bizarre pipe',
	'rm useless pipe',
	'Simplify link ([[MOS:PIPESTYLE]])',
	'That use of "[[it\'s]]" was grammatically correct, but see [[MOS:CONTRACTIONS]]',
	'title in italics, not quotation marks – [[MOS:MAJORWORK]]',
	'title in quotation marks, not italics – [[MOS:MINORWORK]]',
	'Undo vandalism by [[Special:Contributions/X|X]] ([[User talk:X|talk]])',
	'Unlink – redirects to a dab page with no relevant entries',
	'Unsourced',
	'Update'
	],
templateSummaries = [
	clearSummary,
	'[[MOS:DYKPIPE]]',
	'[[WP:MPNOREDIRECT]]',
	'[[WP:MPNOREDIRECT]]; if you prefer to display the other spelling, you may pipe',
	'{{[[Template:-?|-?]]}} to prevent italic character from crashing into "?"',
	'{{Reflist-talk}}',
	'{{[[Template:`s|`s]]}} ([[WP:DYKG#C7]])',
	'<small>',
	'"." → "?" ([[WP:DYKMOS]])',
	"A hook shouldn't have more than one link to the same article",
	'Add (pictured) ([[WP:DYKG#F4]])',
	'Add "that" ([[WP:DYKMOS]])',
	'Add bold link to DYK article ([[WP:DYKG#B1]])',
	'Add bold link to DYK article ([[WP:DYKG#B1]]); please feel free to do it differently',
	'Add caption',
	'Add ellipsis ([[WP:DYKMOS]])',
	'Add link to DYK article ([[WP:DYKG#B1]])',
	'Add space after ellipsis ([[WP:DYKMOS]])',
	'Bold ([[WP:DYKG#B1]])',
	'Close nomination',
	'Correct apostrophe template ([[WP:DYKG#C7]])',
	'Correct article title',
	'Current article title',
	'Current username',
	'Fix credits',
	'Fix ellipsis ([[WP:DYKMOS]])',
	'Fix username',
	'Format hook ([[WP:DYKMOS]])',
	'Format image',
	'Format nomination',
	'Include parentheses in italics ([[WP:DYKG#F4]])',
	'Italicize (pictured) ([[WP:DYKG#F4]])',
	'Label ALT',
	'Link to DYK article',
	'Link to review rather than article',
	'mv the "Please do not write below this line" line below what was written below it',
	'note, [[User:XXX]], that the [[WP:DYKG#C3|maximum allowed hook length is 200]], but yours is XXX, so it will have to be trimmed or replaced',
	'note, [[User:XXX]], that you need to supply a hook (see [[WP:DYKHOOK]])',
	'Patch in correct article title',
	'Patch in current article title',
	'Replace ellipsis character with "..." per [[WP:DYKMOS]]',
	'Restore to correct location ([[Special:Diff/1041387620|why?]])',
	'rm "." before "?"',
	'rm {{DYKnom}} (self-nom)',
	'rm extra ellipsis',
	'rm image remnants',
	'rm space before "?"',
	'Simplify "Created" line',
	"Sorry, but it's currently not eligible",
	'Sort of format the hook',
	'Unlink in caption – already linked in hook',
	'Username not registered'
	],
articleSummaries = ['-'],
talkPageSummaries = ['-'],
otherSummaries = ['–'];

	function addOptionsToDropdown( mainDropdown, optionTexts ) {
		mainDropdown.menu.addItems( optionTexts.map( function ( optionText ) {
			return new OO.ui.MenuOptionWidget( { label: optionText } );
		} ) );
	}

	function onSummarySelect( option ) {
		// Save original value of edit summary field
		var editsummOriginalSummary = $summaryBox.val(),
			canned = option.getLabel(),
			newSummary = editsummOriginalSummary;

		// Append any old edit summary with space, if last character != space
		if ( newSummary.length !== 0 && newSummary.charAt( newSummary.length - 1 ) !== ' ' ) {
			newSummary += ' ';
		}
		newSummary += canned;
		if (canned==clearSummary) newSummary = '';
		$summaryBox.val( newSummary ).trigger( 'change' );
	}

	function getSummaryDropdowns() {
		// Add edit summaries dropdown box to the form
		var	mainDropdown = new OO.ui.DropdownWidget( {
				label: 'Edit summaries'
			} );
			auxDropdown = new OO.ui.DropdownWidget( {
				label: 'DYK edit summaries'
			} ),

		mainDropdown.menu.on( 'select', onSummarySelect );
		auxDropdown.menu.on( 'select', onSummarySelect );

		addOptionsToDropdown( mainDropdown, generalSummaries );
		showAuxDropdown=false;

		if ( CurNSnum === 0 ) {
			addOptionsToDropdown( auxDropdown, articleSummaries );
		} else if ( CurNSnum === 10 ) {
			addOptionsToDropdown( auxDropdown, templateSummaries );
			showAuxDropdown=true;
		} else {
			addOptionsToDropdown( auxDropdown, otherSummaries );
			if ( CurNSnum % 2 !== 0 && CurNSnum !== 3 ) {
				addOptionsToDropdown( auxDropdown, talkPageSummaries );
			}
		}
		if (showAuxDropdown) {return mainDropdown.$element.add( auxDropdown.$element );}
		else {return mainDropdown.$element;}
	}
	// WikiEditor
	$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function () {
		var $dropdowns,
			$editCheckboxes = $( '.editCheckboxes' );

		// If we failed to find the editCheckboxes class
		if ( !$editCheckboxes.length ) {
			return;
		}
		$dropdowns = getSummaryDropdowns();
		if (showAuxDropdown) $dropdowns.css( {width: '48%', 'padding-bottom': '1em'} );
		$editCheckboxes.before( $dropdowns );
	} );
}() );

// ================= TWINKLE =================

//importScript('User:AzaToth/twinkle.js')
//importScript('User:AzaToth/morebits.js');

TwinkleConfig = {
  userTalkPageMode	: 'tab',
  showSharedIPNotice	: false,
  watchSpeedyPages		: [ 'g1', 'g2', 'g3', 'g4', 'g5', 'g6', 'g7', 'g8', 'g10', 'g11', 'g12', 'a1', 'a2', 'a3', 'a5', 'a7', 'a9', 'a10', 'r2', 'r3', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1', 't2', 't3' ],
//  welcomeUserOnSpeedyDeletionNotification: [ 'g2', 'g12', 'a1', 'a2', 'a3', 'a5', 'a7', 'a9', 'r2', 'r3', 'u3', 't3' ],
//  watchProdPages	: false,
  watchRevertedPages	: [],
  watchWarnings		: false,
  defaultWarningGroup:	9,
  customWarningList:	[
	{"value": "User:Double sharp/uw/uw-vandalism1",
	"label": "Unconstructive editing"},

	{"value": "User:Double sharp/uw/uw-error1",
	"label": "Introducing factual errors"},

	{"value": "User:Double sharp/uw/uw-delete1",
	"label": "Removal of content"},

	{"value": "User:Double sharp/uw/uw-test1",
	"label": "Editing tests"},

	{"value": "User:Double sharp/uw/uw-unsourced1",
	"label": "Addition of unsourced or improperly cited material"},

	{"value": "User:Double sharp/uw/uw-npov1",
	"label": "Not adhering to neutral point of view"},

	{"value": "User:Double sharp/uw/uw-spam1",
	"label": "Adding spam links"},

	{"value": "User:Double sharp/uw/uw-biog1",
	"label": "Unsourced controversial info about living person"},

	{"value": "User:Double sharp/uw/uw-npa1",
	"label": "Personal attack directed at a specific editor"},

	{"value": "User:Mandarax/uw-selfrvv",
	"label": "Self-reverting vandalism"},

	{"value": "User:Mandarax/uw-selfrvv|un=y",
	"label": "Unsuccessful attempt to self-revert vandalism"}

	],
  markAIVReportAsMinor		: false,
  markSpeedyPagesAsMinor	: false,

  showRollbackLinks		: [],
  revertMaxRevisions		: 50,
  openTalkPage			: [ 'agf', 'norm', 'vand' ],
  openTalkPageOnAutoRevert	: false,
  summaryAd			: " ([[WP:TW|TW]])",
  deletionSummaryAd		: " ([[WP:TW|TW]])",
  protectionSummaryAd		: " ([[WP:TW|TW]])",
  openUserTalkPageOnSpeedyDelete: [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
  markRevertedPagesAsMinor	: [ 'agf', 'norm', 'vand', 'torev' ],
  deleteTalkPageOnDelete	: false,
  offerReasonOnNormalRevert	: true,
  orphanBacklinksOnSpeedyDelete	: {orphan:true, exclude:['g6']}
};

// ================= FRIENDLY =================

if( typeof( FriendlyConfig ) == 'undefined' ) FriendlyConfig = {};
FriendlyConfig.clockStyle	=	"dynamic";
FriendlyConfig.enableClock	=	false;
FriendlyConfig.groupByDefault	=	true;
FriendlyConfig.insertHeadings		=	true;
FriendlyConfig.insertSignature		=	true;
FriendlyConfig.insertUsername		=	false;
FriendlyConfig.markSharedIPAsMinor	=	true;
FriendlyConfig.markTaggedPagesAsMinor	=	true;
FriendlyConfig.markTaggedPagesAsPatrolled=	true;
FriendlyConfig.markTalkbackAsMinor	=	true;
FriendlyConfig.markWelcomesAsMinor	=	false;
FriendlyConfig.maskTemplateInSummary	=	true;
FriendlyConfig.quickWelcomeMode		=	"semiauto";
FriendlyConfig.quickWelcomeTemplate	=	"Welcome";
FriendlyConfig.customWelcomeList	=       [
      { "value": "User:Mandarax/Wel",
        "label": "{{User:Mandarax/Wel}}: Welcome anyone (registered, IPv4, or IPv6)"}
      ];
FriendlyConfig.talkbackHeading		=	"==Talkback==";
FriendlyConfig.topWelcomes		=	false;
FriendlyConfig.watchTaggedPages		=	false;
FriendlyConfig.watchWelcomes		=	false;
FriendlyConfig.welcomeHeading		=	"==Welcome==";

// =================

if (CurPg=="User:Mandarax/common.js") showTxt("This is " + CurPg);

});

// </nowiki>