User:Daask/scripts/Some MOSNUM dates.js

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.
// For documentation, see
// https://en.wikipedia.org/wiki/User:Sondra.kinsey/scripts/Some_MOSNUM_dates
// 2017

toolbar_items = $('#p-tb li').map(function(i,el){return el.id}).toArray();
// This sets a default value.
if (typeof mosnum_keep_items == 'undefined') {
	mosnum_keep_items = ['dmy-unitfixer', 'mdy-unitfixer'];
}
// For documentation, see
// https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#mw.loader.using
// https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Client-side_.28dynamically.29
$(function() {
	mw.loader.load( 'https://en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/MOSNUM_dates.js&action=raw&ctype=text/javascript' ).done(function(){
		toolbar_items_after=$('#p-tb li').map(function(i,el){return el.id}).toArray();
		alert('toolbar_items_after' + toolbar_items_after.length);
		new_items = toolbar_items_after.filter(function(val){return !toolbar_items.includes(val)});
		alert('new_items' + new_items.length);
		hidden_items = new_items.filter(function(val){return !mosnum_keep_items.includes(val)});
		alert('hidden_items' + hidden_items.length);
		for (let i of hidden_items) {
			$('#' + i).hide();
		}
	});
});