Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
var wagonSelection; | var wagonSelection; | ||
− | var wagonImages = {"wagonBrake" : "https://unrailed-wiki.com/images/8/83/BrakeWagon_3.png", " | + | var wagonImages = {"wagonNone" : "", "wagonBrake" : "https://unrailed-wiki.com/images/8/83/BrakeWagon_3.png", "wagonBuckinator" : "https://unrailed-wiki.com/images/0/01/BuckinatorWagon_3.png", "wagonCannon" : "https://unrailed-wiki.com/images/7/75/CannonWagon_1.png", "wagonCollector" : "https://unrailed-wiki.com/images/0/0a/CollectorWagon_3.png", "wagonCompass" : "https://unrailed-wiki.com/images/8/88/CompassWagon_1.png", "wagonCrafter" : "https://unrailed-wiki.com/images/f/f8/CraftingWagon_3.png", "wagonDynamite" : "https://unrailed-wiki.com/images/8/89/DynamiteWagon_3.png", "wagonGhost" : "https://unrailed-wiki.com/images/1/1f/GhostWagon_1.png", "wagonLight" : "https://unrailed-wiki.com/images/7/7a/LightWagon_2.png", "wagonMilk" : "https://unrailed-wiki.com/images/5/59/MilkWagon_3.png", "wagonMiner" : "https://unrailed-wiki.com/images/a/ab/MinerWagon_3.png", "wagonSlots" : "https://unrailed-wiki.com/images/1/13/SlotMachineWagon_3.png", "wagonStorage" : "https://unrailed-wiki.com/images/1/1f/StorageWagon_3.png", "wagonSupercharger" : "https://unrailed-wiki.com/images/7/70/SuperchargerWagon_3.png", "wagonTank" : "https://unrailed-wiki.com/images/f/f1/TankWagon_3.png", "wagonTransformer" : "https://unrailed-wiki.com/images/4/4b/TransformerWagon_3.png"}; |
$('#wagon-configurator-list li').click(function(){ | $('#wagon-configurator-list li').click(function(){ |
Revision as of 12:02, 3 August 2021
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function(){ var wagonConfiguratorList; var wagonSelection; var wagonImages = {"wagonNone" : "", "wagonBrake" : "https://unrailed-wiki.com/images/8/83/BrakeWagon_3.png", "wagonBuckinator" : "https://unrailed-wiki.com/images/0/01/BuckinatorWagon_3.png", "wagonCannon" : "https://unrailed-wiki.com/images/7/75/CannonWagon_1.png", "wagonCollector" : "https://unrailed-wiki.com/images/0/0a/CollectorWagon_3.png", "wagonCompass" : "https://unrailed-wiki.com/images/8/88/CompassWagon_1.png", "wagonCrafter" : "https://unrailed-wiki.com/images/f/f8/CraftingWagon_3.png", "wagonDynamite" : "https://unrailed-wiki.com/images/8/89/DynamiteWagon_3.png", "wagonGhost" : "https://unrailed-wiki.com/images/1/1f/GhostWagon_1.png", "wagonLight" : "https://unrailed-wiki.com/images/7/7a/LightWagon_2.png", "wagonMilk" : "https://unrailed-wiki.com/images/5/59/MilkWagon_3.png", "wagonMiner" : "https://unrailed-wiki.com/images/a/ab/MinerWagon_3.png", "wagonSlots" : "https://unrailed-wiki.com/images/1/13/SlotMachineWagon_3.png", "wagonStorage" : "https://unrailed-wiki.com/images/1/1f/StorageWagon_3.png", "wagonSupercharger" : "https://unrailed-wiki.com/images/7/70/SuperchargerWagon_3.png", "wagonTank" : "https://unrailed-wiki.com/images/f/f1/TankWagon_3.png", "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(){ wagonConfiguratorList = $('#wagon-configurator-list li.selected')[0].classList[0]; window['wagonConfiguratorList'] = wagonConfiguratorList; $(this).css("background-size", 'cover'); $(this).css("background-image", 'url(' + wagonImages[wagonConfiguratorList] + ')'); alert("You selected " + wagonConfiguratorList); }); });