-
Notifications
You must be signed in to change notification settings - Fork 1
/
cars.html
101 lines (100 loc) · 8.75 KB
/
cars.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title>Get a Car - Parking Master 2.0</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/Parking-Master/Simple-Alert@latest/simplealert.min.js"></script>
<style>
body {
background: #fefefe;
border-top: 8px solid #ddd;
border-radius: 6px;
font-family: Arial, Helvetica, sans-serif;
color: #ddd;
font-weight: bold;
}
.wrapper {
position: relative;
margin: 0;
width: 90vw;
left: 50%;
margin-top: 10%;
margin-left: -45vw !important;
}
.tab {
position: relative;
background: #fff;
width: 130px;
height: 130px;
border-radius: 6px;
box-shadow: 0 0 5px 3px #ddd;
display: inline-block;
margin: 1vw;
margin-right: 4vw;
justify-content: center;
padding: 10px;
cursor: pointer !important;
user-select: none !important;
transition: transform .2s;
left: 7.5%;
}
/* .tab:active, .tab:focus {
box-shadow: 0 0 0px 10px #ddd !important;
outline: none !important;
} */
.tab img {
transition: transform .2s, box-shadow .15s;
}
.tab img:hover {
transform: scale(1.2);
cursor: zoom-in;
box-shadow: none !important;
}
.tab:hover {
transform: scale(1.2);
}
.wrapper .tab#0 {
}
.-center {
text-align: center;
}
</style>
</head>
<body onmousedown="for (let i = 0; i < document.querySelectorAll('.tab').length; i++) { event.target == document.querySelectorAll('.tab')[i] || (document.querySelectorAll('.tab')[i].style.boxShadow = '0 0 5px 3px #ddd') }">
<h1 class="-center" style="fill:#ddd;color:#ddd;margin-top:5%;"><svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd"><path d="M16 1c-4.418 0-8 3.582-8 8 0 .585.063 1.155.182 1.704l-8.182 7.296v5h6v-2h2v-2h2l3.066-2.556c.909.359 1.898.556 2.934.556 4.418 0 8-3.582 8-8s-3.582-8-8-8zm-6.362 17l3.244-2.703c.417.164 1.513.703 3.118.703 3.859 0 7-3.14 7-7s-3.141-7-7-7c-3.86 0-7 3.14-7 7 0 .853.139 1.398.283 2.062l-8.283 7.386v3.552h4v-2h2v-2h2.638zm.168-4l-.667-.745-7.139 6.402v1.343l7.806-7zm10.194-7c0-1.104-.896-2-2-2s-2 .896-2 2 .896 2 2 2 2-.896 2-2zm-1 0c0-.552-.448-1-1-1s-1 .448-1 1 .448 1 1 1 1-.448 1-1z"/></svg> Available Cars</h1>
<div class="wrapper">
<div onfocus="this.style.boxShadow = '0 0 0px 10px #ddd';" tabindex="1" class="tab" id="0" onclick="simple.alert('You already own this car.')"><img src="images/default_car.png" style="box-shadow:-5px 5px 5px #ddd, 5px 5px 5px #ddd;width:100%;margin:0!important;padding:0!important;" /><br><p class="-center" style="font-size:12px;">OWNED</p></div>
<div onfocus="this.style.boxShadow = '0 0 0px 10px #ddd';" tabindex="2" class="tab" id="1" onclick="let owned = false; if (!localStorage['owned_cars']) { return (equip(100, 'small_car') == false && simple.alert('You do not have enough PTS to purchase this car.')); } for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'] && localStorage['owned_cars'].split(',')[i] == '1') { owned = true } } !owned && simple.confirm('Do you want to purchase the Small Car for 100 PTS?', () => (equip(100, 'small_car') == false && simple.alert('You do not have enough PTS to purchase this car.')))"><img style="box-shadow:-5px 5px 5px #ddd, 5px 5px 5px #ddd;" width="100%" src="images/small_car.png" /><br><p class="-center" style="font-size:12px;">100 PTS</p></div>
<div onfocus="this.style.boxShadow = '0 0 0px 10px #ddd';" tabindex="3" class="tab" id="2" onclick="let owned = false; if (!localStorage['owned_cars']) { return (equip(500, 'town_car') == false && simple.alert('You do not have enough PTS to purchase this car.')); } for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'] && localStorage['owned_cars'].split(',')[i] == '2') { owned = true } } !owned && simple.confirm('Do you want to purchase the Town Car for 500 PTS?', () => (equip(500, 'town_car') == false && simple.alert('You do not have enough PTS to purchase this car.')))"><img style="box-shadow:-5px 5px 5px #ddd, 5px 5px 5px #ddd;" width="100%" src="images/town_car.png" /><br><p class="-center" style="font-size:12px;">500 PTS</p></div>
<div onfocus="this.style.boxShadow = '0 0 0px 10px #ddd';" tabindex="4" class="tab" id="3" onclick="let owned = false; if (!localStorage['owned_cars']) { return (equip(800, 'pickup_truck') == false && simple.alert('You do not have enough PTS to purchase this car.')); } for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'] && localStorage['owned_cars'].split(',')[i] == '3') { owned = true } } !owned && simple.confirm('Do you want to purchase the Pickup Truck for 800 PTS?', () => (equip(800, 'pickup_truck') == false && simple.alert('You do not have enough PTS to purchase this car.')))"><img style="box-shadow:-5px 5px 5px #ddd, 5px 5px 5px #ddd;" width="100%" src="images/pickup_truck.png" /><br><p class="-center" style="font-size:12px;">800 PTS</p></div>
<div onfocus="this.style.boxShadow = '0 0 0px 10px #ddd';" tabindex="5" class="tab" id="4" onclick="let owned = false; if (!localStorage['owned_cars']) { return (equip(1500, 'limo_car') == false && simple.alert('You do not have enough PTS to purchase this car.')); } for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'] && localStorage['owned_cars'].split(',')[i] == '4') { owned = true } } !owned && simple.confirm('Do you want to purchase the Limousine for 1500 PTS?', () => (equip(1500, 'limo_car') == false && simple.alert('You do not have enough PTS to purchase this car.')))"><img style="box-shadow:-5px 5px 5px #ddd, 5px 5px 5px #ddd;" width="100%" src="images/limo_car.png" /><br><p class="-center" style="font-size:12px;">1500 PTS</p></div>
</div>
<script>
(() => { let owned = false; for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'].split(',')[i] == '1') { owned = true } } (!!owned && (document.querySelector('p#1').textContent = 'OWNED')) });
(() => { let owned = false; for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'].split(',')[i] == '2') { owned = true } } (!!owned && (document.querySelector('p#2').textContent = 'OWNED')) });
(() => { let owned = false; for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'].split(',')[i] == '3') { owned = true } } (!!owned && (document.querySelector('p#3').textContent = 'OWNED')) });
(() => { let owned = false; for (let i = 0; i < localStorage['owned_cars'].split(',').length; i++) { if (localStorage['owned_cars'].split(',')[i] == '4') { owned = true } } (!!owned && (document.querySelector('p#4').textContent = 'OWNED')) });
function equip(price, car) {
if (parseFloat(localStorage["current_pts"], 0) < price || !localStorage["owned_cars"]) {
return false;
}
if (car == "small_car") {
localStorage.setItem("current_pts", (parseFloat(localStorage["current_pts"], 0) - price).toString());
localStorage.setItem("owned_cars", localStorage["owned_cars"] + ",3")
localStorage.setItem("car", "{\"baseColor\":\"#eee\",\"windowColor\":\"#333\",\"roofColor\":\"#fff\",\"minSpeed\":10,\"maxSpeed\":50,\"default_specs\":[45,-15,12,35,-4]}");
} else if (car == "town_car") {
localStorage.setItem("current_pts", (parseFloat(localStorage["current_pts"], 0) - price).toString());
localStorage.setItem("owned_cars", localStorage["owned_cars"] + ",1")
localStorage.setItem("car", "{\"baseColor\":\"#fefefe\",\"wheelColor\":\"#333\",\"windowColor\":\"#333\",\"minSpeed\":5,\"maxSpeed\":30,\"default_specs\":[80, -22, 26, 40]}");
} else if (car == "pickup_truck") {
localStorage.setItem("current_pts", (parseFloat(localStorage["current_pts"], 0) - price).toString());
localStorage.setItem("owned_cars", localStorage["owned_cars"] + ",2")
localStorage.setItem("car", "{\"baseColor\":\"#ff4400\",\"wheelColor\":\"#444\",\"windowColor\":\"#333\",\"minSpeed\":5,\"maxSpeed\":30,\"default_specs\":[80, -22, 26, 100]}");
} else if (car == "limo_car") {
localStorage.setItem("current_pts", (parseFloat(localStorage["current_pts"], 0) - price).toString());
localStorage.setItem("owned_cars", localStorage["owned_cars"] + ",3")
localStorage.setItem("car", "{\"baseColor\":\"#eee\",\"windowColor\":\"#333\",\"roofColor\":\"#fff\",\"minSpeed\":10,\"maxSpeed\":50,\"default_specs\":[45,-15,12,35,-4]}");
}
}
</script>
</body>
</html>