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.
//See also global js page: https://meta.wikimedia.org/wiki/User:Evad37/global.js
//Global scripts include: [[d:User:Yair rand/WikidataInfo.js]], [[User:Evad37/WikidataWatchlistLabels.js]]
/* jshint maxerr: 999 */


/* ### Sandbox ################################################################################## */

importScript('User:Evad37/sandbox3.js'); //my JS sandbox


//importScript('User:Evad37/TimestampDiffs.js');


/* ### EditWarChecker ########################################################################### */

importScript('User:Evad37/EditWarChecker.js');


/* ### TextDiff ################################################################################# */

//importScript( 'User:Evad37/TextDiff.js' ); // [[User:Evad37/TextDiff]]
importScript( 'User:Evad37/TextDiff/sandbox.js' ); // [[User:Evad37/TextDiff]]
importScript( 'User:Evad37/TextDiff/test.js' );


/* ### Rater #################################################################################### */

//importScript( 'User:Evad37/rater.js' );
importScript( 'User:Evad37/rater/sandbox.js' );
//importScript( 'User:Evad37/rater/beta.js' );

//importScript( 'User:Evad37/rater/test.js' );
//var rater_watchlist = 'watch'; // Set to one of the following values: watch, unwatch, preferences, nochange
//rater_autostartNamespaces = 0;// ( mw.config.get('wgPageName').includes('/') ) ? -5 : 100;

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


/* ### MoveToDraft ############################################################################## */

importScript('User:Evad37/MoveToDraft/sandbox.js');
var m2d_doNotLog = true;


/* ### ToDoLister ############################################################################### */

importScript('User:Evad37/ToDoLister/sandbox.js');
	var todo_portlet = "p-cactions";           // Defines which portlet menu the link is added to - see [[Help:Customizing toolbars]] for options (choose one of the valid values for portletId)
	var todo_subpage = "to do list";           // Subpage where the to-do list entry is to be added
	var todo_viewlabel = "ToDo";          // Custom label for the link. Replace quoted text with your desired name.
	var todo_addlabel = "Add→";         // Custom label for the link. Replace quoted text with your desired name.
	var todo_addfirst = "yes";                  // Replace null with any value, e.g. "yes" (including quotation marks) to show the Add link before the View link.
	var todo_viewnew = "yes";                   // Replace null with any value, e.g. "yes" (including quotation marks) to make the View link open in a new tab or window.


/* ### XFDCloser ################################################################################ */
/*
// Sandbox config settings
// <nowiki>
var XFDC_MAKE_SANDBOX_CONFIG = function(config) {
	config.user.isSysop = true;
	config.user.sig = config.user.isSysop ? '~~~~' : '<small>[[Wikipedia:NACD|(non-admin closure)]]</small> ~~~~';
	config.xfd.path = 'User:Evad37/sandbox/' + config.xfd.path;
	config.xfd.subpagePath = 'User:Evad37/sandbox/' + config.xfd.subpagePath;
	config.script.advert = ' ([[User:Evad37/XFDcloser/sandbox.js|XFDcloser/sandbox]])';
	config.script.version += '-sandbox';
	config.xfd.ns_logpages = 2; // User
	config.xfd.ns_unlink = ['3']; // User_talk
	console.log('[XFDcloser] isSysop: ' + config.user.isSysop);
	return config;
};
// </nowiki>
var XFDC_SANDBOX = true;

//mw.loader.load('ext.gadget.XFDcloser')
importScript('User:Evad37/extra/sandbox.js');
//importScript('User:Evad37/XFDcloser.js');
//importScript('User:Evad37/XFDcloser/sandbox-loader.js');
//importScript('User:Evad37/XFDcloser/beta.js');
//importScript('User:Evad37/XFDcloser.js');
//var xfdc_beta = true;
/*
var xfdcDevUrl = "http://localhost:8125/dist/loader-dev.js";
mw.loader.getScript(xfdcDevUrl).catch(function(e) {
	e.message += " " + xfdcDevUrl;
	console.error(e);
});
*/
/* ### Xunlink ################################################################################## */

importScript('User:Evad37/Xunlink/sandbox.js');


/* ### OneClickArchiver ######################################################################### */

//importScript('User:Equazcion/OneClickArchiver.js'); // Backlink: [[User:Equazcion/OneClickArchiver.js]]
//importScript('User:Technical 13/Scripts/OneClickArchiver.js'); // Backlink: [[User:Technical 13/Scripts/OneClickArchiver]]
//importScript('User:Technical_13/SandBox/OneClickArchiver.js'); // Beta version of [[User:Technical 13/Scripts/OneClickArchiver]]
importScript('User:Evad37/OneClickArchiver.js');


/* ### Signpost publishing script ############################################################### */

//importScript( 'User:Evad37/SPS.js' );
importScript( 'User:Evad37/SPS/sandbox.js' );


/* ### Watchlist-* ########################################################################### */

importScript('User:Evad37/Watchlist-openUnread/sandbox.js'); // [[User:Evad37/Watchlist-openUnread]]
var openUnread_maxnum = "2";
var openUnread_showAbove = true;

importScript( 'User:Evad37/Watchlist-hideAWB.js' );

//importScript('User:Evad37/Watchlist-hideCustom.js');

importScript('User:Evad37/Thanky/sandbox.js');


/* ### Various ############################################################################### */

importScript('User:Evad37/livenotifications.js'); // [[User:Evad37/livenotifications]]

importScript('User:Evad37/TimestampDiffs/sandbox.js'); // [[User:Evad37/TimestampDiffs]]

importScript( 'User:Evad37/Covery/sandbox.js' ); // [[User:Evad37/Covery]]

importScript( 'User:Evad37/kmlToJson.js' ); // [[User:Evad37/kmlToJson]]

//importScript('User:Evad37/Custom GeoHack replacement.js'); // 
//importScript('User:Evad37/GeoHack replacement script/sandbox.js');
//ghrs_mapprovider = "http://maps.google.com/maps?ll={latdegdec},{londegdec}&spn={span},{span}&q={latdegdec},{londegdec}";

importScript('User:Evad37/showhardspaces.js');             // [[User:Evad37/showhardspaces]]

// importScript('User:Evad37/duplinks-alt.js');             // [[User:Evad37/duplinks-alt]]
importScript('User:Evad37/duplinks-alt/sandbox.js');             // [[User:Evad37/duplinks-alt]]


/* ### Scripts from others ################################################################### */

importScript( 'User:Fred_Gandt/confirmLogout.js' ); // Backlink: [[User:Fred_Gandt/confirmLogout.js]]

importScript( 'User:Enterprisey/undo-last-edit.js' ); // Backlink: [[User:Enterprisey/undo-last-edit.js]]

importScript('User:Equazcion/ContribsTabVector.js'); // Backlink: [[User:Equazcion/ContribsTabVector.js]]
var contribsTabName = "±"; 
var contribsTabStatsName = "σ";

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool  Backlink: [['User:Shubinator/DYKcheck.js]]

importScript('User:Anomie/previewtemplatelastmod.js'); // Backlink: [[User:Anomie/previewtemplatelastmod.js]]  
  
importScript('User:PrimeHunter/Image tabs.js'); // Linkback: [[User:PrimeHunter/Image tabs.js]]


/* ### Inline scripts ######################################################################## */


$( function($) {
	/* --- Hide preview on .js pages --- */
    if ( mw.config.get('wgPageContentModel') === "javascript") {
        $("#wikiPreview").hide();
    }

	/* --- Edit link adjustments --- */
	var doEditLinkAdjustments = function() {
		// "Edit this page" tab → "VE" tab
		var veTabA = document.querySelectorAll("#ca-ve-edit a");
		if (veTabA) { veTabA.innerText = "VE"; }
		// "edit source" (section) → "edit" (section)
		document.querySelectorAll(".mw-editsection a:not(.external):not(.text)")
			.forEach( function(a) { a.innerText = "edit"; } );
		// Fix template documentation links
		var docEditLinks = document.querySelectorAll("#doc_editlinks");
		if (docEditLinks && docEditLinks.children && docEditLinks.children.length===4) {
			docEditLinks.children[0].innerText = "view";
			docEditLinks.children[2].innerText = "history";
			docEditLinks.children[3].innerText = "purge";
		}
	};
	doEditLinkAdjustments();
	
	var firstEditSection = document.querySelector(".mw-editsection a:not(.external):not(.text)");
	if (firstEditSection) {
		// Watch for VisualEditor changing text back to "edit source", and undo it
		var mutObsv;
		mutObsv = new MutationObserver(function() {
			console.log("element mutation");
			mutObsv.disconnect();
			doEditLinkAdjustments();
		});
		mutObsv.observe(
			firstEditSection,
			{ childList: true, attributes: true, subtree: true}
		);
	}
});

/*Script modules:
$.getScript('https://en.wikipedia.org/w/index.php?title=User:Evad37/ScriptModules/sandbox.js&action=raw&ctype=text/javascript')
.then(function() {
	importScript('User:Evad37/ScriptModulesDemo.js');
	importScript('User:Evad37/ScriptModulesDemo2/sandbox.js');
	importScript('User:Evad37/ScriptModulesDemo3.js');
	importScript('User:Evad37/ScriptModulesDemo4.js');
});
*/

//--- Testcase runners ---
//importScript('User:Evad37/extra/test.js');
importScript('User:Evad37/WikiUnit.js');