MediaWiki:Common.js

From Unrailed! Wiki
Revision as of 22:20, 2 August 2021 by Stencil (talk | contribs)
Jump to navigation Jump to search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */

$(document).ready(function(){
	var wagonConfiguratorList;
	var wagonSelection;

	var wagonBrake = "https://unrailed-wiki.com/images/8/83/BrakeWagon_3.png";
	var wagonwagonBuckinator = "https://unrailed-wiki.com/images/0/01/BuckinatorWagon_3.png";
	var wagonCannon = "https://unrailed-wiki.com/images/7/75/CannonWagon_1.png";
	var wagonCollector = "https://unrailed-wiki.com/images/0/0a/CollectorWagon_3.png";
	var wagonCompass = "https://unrailed-wiki.com/images/8/88/CompassWagon_1.png";
	var wagonCrafter = "https://unrailed-wiki.com/images/f/f8/CraftingWagon_3.png";
	var wagonDynamite = "https://unrailed-wiki.com/images/8/89/DynamiteWagon_3.png";
	var wagonGhost = "https://unrailed-wiki.com/images/1/1f/GhostWagon_1.png";
	var wagonLight = "https://unrailed-wiki.com/images/7/7a/LightWagon_2.png";
	var wagonMilk = "https://unrailed-wiki.com/images/5/59/MilkWagon_3.png";
	var wagonMiner = "https://unrailed-wiki.com/images/a/ab/MinerWagon_3.png";
	var wagonSlots = "https://unrailed-wiki.com/images/1/13/SlotMachineWagon_3.png";
	var wagonStorage = "https://unrailed-wiki.com/images/1/1f/StorageWagon_3.png";
	var wagonSupercharger = "https://unrailed-wiki.com/images/7/70/SuperchargerWagon_3.png";
	var wagonTank = "https://unrailed-wiki.com/images/f/f1/TankWagon_3.png";
	var wagonTransformer = "https://unrailed-wiki.com/images/4/4b/TransformerWagon_3.png";
	
	$('#wagon-configurator-list li').click(function(){
		$(this).addClass('selected');
		$(this).siblings().removeClass('selected');
		var wagonSelection = this.classList[0];
		alert("You selected " + wagonSelection);
		console.log(wagonSelection);
	});

	$('#wagon-configurator li.wagon-slot').click(function(){
		var wagonConfiguratorList = $('#wagon-configurator-list li.selected')[0].classList[0];
		window['wagonConfiguratorList'] = wagonConfiguratorList;
		$(this).css("background-image", "url(${myList})");
		alert("You selected " + wagonConfiguratorList);
	});
});