Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
importScript('MediaWiki:Gadget-InformationToCOA.js');
importScript('User:Slomox/LastCategories.js');

separateQPreviewbutton=true;

$(function() {
	if ((mw.config.get( 'wgCanonicalNamespace' ) === 'Category') && (mw.config.get( 'wgAction' ) === 'view')) {
		var link = 'https://tools.wmflabs.org/osm4wiki/cgi-bin/wiki/wiki-osm.pl?project=Commons&article=Category%3A' + mw.config.get( 'wgTitle' );
		$('#firstHeading').append(' <a href="' + link + '">🌐</a>');
	}
	// set links to map for UploadWizard coordinates
	var observer = new MutationObserver(function(mutations) {
		mutations.forEach(function(mutation) {
			if ((mutation.type === "childList") && (mutation.addedNodes) && (mutation.addedNodes.length > 0)) {
				for (var i = 0; i < mutation.addedNodes.length; ++i) {
					var node = mutation.addedNodes[i];
					if ($(node).find('.oo-ui-fieldLayout-body .mwe-upwiz-locationDetailsWidget').length > 0) {
						$(node).find('.oo-ui-fieldLayout-body .mwe-upwiz-locationDetailsWidget').parents('.oo-ui-fieldLayout-body').find('.mwe-upwiz-details-fieldname').html('Standoort <small>(Koort wiesen: <a class="uploadwizard-location-map" href="#" target="uploadwizardMap">Toolserver</a> • <a class="uploadwizard-location-map-geohack" href="#" target="uploadwizardMap">annere Deensten</a>)</small>');
						$(node).find('.oo-ui-fieldLayout-body .mwe-upwiz-locationDetailsWidget input').trigger('change');
					}
				}
			}
        });
	});
	observer.observe($('body').get(0), { attributes: true, childList: true, characterData: true, subtree: true });

	// update link to map when coordinates in UploadWizard are changed
	$('body').on('change', '.mwe-upwiz-locationDetailsWidget input', function() {
		var inputs = $(this).parents('.mwe-upwiz-locationDetailsWidget').find('input');
		$(this).parents('.mwe-upwiz-fieldLayout').find('.uploadwizard-location-map').attr('href', 'https://tools.wmflabs.org/wiwosm/osm-on-ol/commons-on-osm.php?zoom=15&lat=' + inputs.eq(0).val() + '&lon=' + inputs.eq(1).val() + '&heading=' + inputs.eq(2).val());
		$(this).parents('.mwe-upwiz-fieldLayout').find('.uploadwizard-location-map-geohack').attr('href', 'https://tools.wmflabs.org/geohack/geohack.php?params=' + inputs.eq(0).val() + '_' + ((inputs.eq(0).val() > 0) ? 'N' : 'S') + '_' + inputs.eq(1).val() + '_' + ((inputs.eq(1).val() > 0) ? 'E' : 'W') + '_dim:1000&language=' + mw.config.get( 'wgPageContentLanguage' ) + '&heading=' + inputs.eq(2).val());
	});
});
//<nowiki>

//catALot///////////////////////////////////////
////////// Cat-a-lot user preferences //////////
window.catALotPrefs = {"disambig_category":"Disambiguation","redir_category":"Category redirects","watchlist":"nochange","minor":false,"editpages":false,"docleanup":false,"subcatcount":50,"uncat":true,"button":true};
////////////////////////////////////catALotEnd//
//</nowiki>