Download script.js from basjj/galactic-garage-customizer: direct link, hf CLI and curl.
- Browser
- Download file 6.62 kB
-
https://huggingface.co/spaces/basjj/galactic-garage-customizer/resolve/main/script.js
- Command line
-
hf download hf://spaces/basjj/galactic-garage-customizer/script.js
-
curl -L -o script.js https://huggingface.co/spaces/basjj/galactic-garage-customizer/resolve/main/script.js
6.62 kB
| // Extended customization data | |
| const carData = { | |
| // Vehicle Types | |
| types: [ | |
| { id: 'car', name: 'Cars' }, | |
| { id: 'rocket', name: 'Rockets' }, | |
| { id: 'spaceship', name: 'Spaceships' }, | |
| { id: 'hovercraft', name: 'Hovercrafts' }, | |
| { id: 'mech', name: 'Mechs' } | |
| ], | |
| // Bodies | |
| bodies: [ | |
| { id: 'octane', name: 'Octane', type: 'car', image: 'http://static.photos/automotive/640x360/1' }, | |
| { id: 'dominus', name: 'Dominus', type: 'car', image: 'http://static.photos/automotive/640x360/2' }, | |
| { id: 'rocket1', name: 'Nova Rocket', type: 'rocket', image: 'http://static.photos/technology/640x360/1' }, | |
| { id: 'spaceship1', name: 'Galaxy Cruiser', type: 'spaceship', image: 'http://static.photos/technology/640x360/2' }, | |
| { id: 'hover1', name: 'Sky Glider', type: 'hovercraft', image: 'http://static.photos/technology/640x360/3' }, | |
| { id: 'mech1', name: 'Titan Walker', type: 'mech', image: 'http://static.photos/technology/640x360/4' }, | |
| { id: 'rocket2', name: 'Solar Flare', type: 'rocket', image: 'http://static.photos/technology/640x360/5' } | |
| ], | |
| decals: [ | |
| { id: 'none', name: 'None' }, | |
| { id: 'stripes', name: 'Racing Stripes' }, | |
| { id: 'flames', name: 'Flame Decals' }, | |
| { id: 'galaxy', name: 'Galaxy Pattern' }, | |
| { id: 'circuit', name: 'Circuit Board' }, | |
| { id: 'holographic', name: 'Holographic' }, | |
| { id: 'neon', name: 'Neon Glow' }, | |
| { id: 'carbon', name: 'Carbon Fiber' } | |
| ], | |
| wheels: [ | |
| { id: 'default', name: 'Standard' }, | |
| { id: 'spinner', name: 'Spinners' }, | |
| { id: 'offroad', name: 'Off-Road' }, | |
| { id: 'futuristic', name: 'Futuristic' }, | |
| { id: 'chrome', name: 'Chrome' }, | |
| { id: 'hover', name: 'Hover Discs' }, | |
| { id: 'ion', name: 'Ion Thrusters' }, | |
| { id: 'plasma', name: 'Plasma Rings' } | |
| ], | |
| boosts: [ | |
| { id: 'standard', name: 'Standard' }, | |
| { id: 'flamethrower', name: 'Flamethrower' }, | |
| { id: 'ion', name: 'Ion Drive' }, | |
| { id: 'plasma', name: 'Plasma Jet' }, | |
| { id: 'lightning', name: 'Lightning' }, | |
| { id: 'quantum', name: 'Quantum Field' }, | |
| { id: 'gravity', name: 'Gravity Warp' }, | |
| { id: 'antimatter', name: 'Antimatter' } | |
| ], | |
| toppers: [ | |
| { id: 'none', name: 'None' }, | |
| { id: 'halo', name: 'Energy Halo' }, | |
| { id: 'crown', name: 'Neon Crown' }, | |
| { id: 'antenna', name: 'Comm Antenna' }, | |
| { id: 'propeller', name: 'VTOL Propeller' }, | |
| { id: 'satellite', name: 'Mini Satellite' }, | |
| { id: 'drone', name: 'Companion Drone' }, | |
| { id: 'hologram', name: 'Hologram Projector' } | |
| ], | |
| antennas: [ | |
| { id: 'none', name: 'None' }, | |
| { id: 'flag', name: 'Team Flag' }, | |
| { id: 'balloon', name: 'Hover Balloon' }, | |
| { id: 'disco', name: 'Disco Ball' }, | |
| { id: 'flower', name: 'Solar Flower' }, | |
| { id: 'radar', name: 'Radar Dish' }, | |
| { id: 'sensor', name: 'Sensor Array' }, | |
| { id: 'beacon', name: 'Tracking Beacon' } | |
| ], | |
| colors: [ | |
| { id: 'red', name: 'Crimson', value: '#ef4444' }, | |
| { id: 'blue', name: 'Nebula Blue', value: '#3b82f6' }, | |
| { id: 'green', name: 'Toxic Green', value: '#10b981' }, | |
| { id: 'yellow', name: 'Solar Flare', value: '#f59e0b' }, | |
| { id: 'purple', name: 'Quantum Purple', value: '#8b5cf6' }, | |
| { id: 'black', name: 'Void Black', value: '#1f2937' }, | |
| { id: 'white', name: 'Cosmic White', value: '#f3f4f6' }, | |
| { id: 'pink', name: 'Neon Pink', value: '#ec4899' }, | |
| { id: 'orange', name: 'Plasma Orange', value: '#f97316' }, | |
| { id: 'teal', name: 'Holographic Teal', value: '#14b8a6' }, | |
| { id: 'metallic', name: 'Chrome', value: 'linear-gradient(135deg, #c0c0c0 0%, #ffffff 50%, #c0c0c0 100%)' }, | |
| { id: 'galaxy', name: 'Galaxy', value: 'linear-gradient(135deg, #000000 0%, #4c1d95 50%, #000000 100%)' } | |
| ] | |
| }; | |
| // New customization categories | |
| engines: [ | |
| { id: 'standard', name: 'Standard' }, | |
| { id: 'turbo', name: 'Turbo' }, | |
| { id: 'ion', name: 'Ion Drive' }, | |
| { id: 'plasma', name: 'Plasma Core' }, | |
| { id: 'antimatter', name: 'Antimatter' } | |
| ], | |
| weaponry: [ | |
| { id: 'none', name: 'None' }, | |
| { id: 'laser', name: 'Laser Cannons' }, | |
| { id: 'missiles', name: 'Missile Pods' }, | |
| { id: 'plasma', name: 'Plasma Launchers' }, | |
| { id: 'railgun', name: 'Railgun' } | |
| ], | |
| interiors: [ | |
| { id: 'standard', name: 'Standard' }, | |
| { id: 'luxury', name: 'Luxury' }, | |
| { id: 'racing', name: 'Racing' }, | |
| { id: 'futuristic', name: 'Futuristic' }, | |
| { id: 'military', name: 'Military' } | |
| ], | |
| lighting: [ | |
| { id: 'standard', name: 'Standard' }, | |
| { id: 'neon', name: 'Neon' }, | |
| { id: 'pulse', name: 'Pulse' }, | |
| { id: 'strobe', name: 'Strobe' }, | |
| { id: 'hologram', name: 'Hologram' } | |
| ] | |
| }; | |
| // Current vehicle configuration | |
| let currentCar = { | |
| type: 'car', | |
| body: 'octane', | |
| engine: 'standard', | |
| weapons: 'none', | |
| interior: 'standard', | |
| lighting: 'standard', | |
| primaryColor: '#3b82f6', | |
| secondaryColor: '#f59e0b', | |
| decal: 'none', | |
| wheels: 'default', | |
| boost: 'standard', | |
| topper: 'none', | |
| antenna: 'none' | |
| }; | |
| // Initialize the app | |
| document.addEventListener('DOMContentLoaded', () => { | |
| updateCarView(); | |
| populateCustomizationOptions(); | |
| }); | |
| function updateCarView() { | |
| const carViewer = document.querySelector('custom-car-viewer'); | |
| if (carViewer) { | |
| carViewer.setAttribute('body', currentCar.body); | |
| carViewer.setAttribute('primary-color', currentCar.primaryColor); | |
| carViewer.setAttribute('secondary-color', currentCar.secondaryColor); | |
| carViewer.setAttribute('decal', currentCar.decal); | |
| carViewer.setAttribute('wheels', currentCar.wheels); | |
| carViewer.setAttribute('boost', currentCar.boost); | |
| carViewer.setAttribute('topper', currentCar.topper); | |
| carViewer.setAttribute('antenna', currentCar.antenna); | |
| } | |
| } | |
| function populateCustomizationOptions() { | |
| const panel = document.querySelector('custom-customization-panel'); | |
| if (panel) { | |
| panel.setAttribute('car-data', JSON.stringify(carData)); | |
| panel.setAttribute('current-car', JSON.stringify(currentCar)); | |
| } | |
| } | |
| // Listen for customization changes | |
| document.addEventListener('customization-change', (e) => { | |
| currentCar = { ...currentCar, ...e.detail }; | |
| updateCarView(); | |
| }); |