awacke1 commited on
Commit
18a5d47
Β·
1 Parent(s): a05eb3e

Update backupindex.html

Browse files
Files changed (1) hide show
  1. backupindex.html +24 -2
backupindex.html CHANGED
@@ -26,6 +26,14 @@
26
  padding: 10px 20px;
27
  margin-top: 20px;
28
  }
 
 
 
 
 
 
 
 
29
  </style>
30
  </head>
31
  <body>
@@ -36,6 +44,8 @@
36
  <div class="slot" id="slot3">🍌</div>
37
  </div>
38
  <button id="spin-btn">Spin</button>
 
 
39
 
40
  <script>
41
  document.getElementById('spin-btn').addEventListener('click', function () {
@@ -43,13 +53,25 @@
43
  var slot1 = document.getElementById('slot1');
44
  var slot2 = document.getElementById('slot2');
45
  var slot3 = document.getElementById('slot3');
 
 
 
 
 
 
 
 
 
46
  slot1.textContent = emojis[Math.floor(Math.random() * emojis.length)];
47
  slot2.textContent = emojis[Math.floor(Math.random() * emojis.length)];
48
  slot3.textContent = emojis[Math.floor(Math.random() * emojis.length)];
49
  if (slot1.textContent === slot2.textContent && slot2.textContent === slot3.textContent) {
50
- alert('You won! πŸŽ‰');
 
 
 
51
  }
52
  });
53
  </script>
54
  </body>
55
- </html>
 
26
  padding: 10px 20px;
27
  margin-top: 20px;
28
  }
29
+ #balance {
30
+ font-size: 1.25rem;
31
+ margin-top: 10px;
32
+ }
33
+ #history {
34
+ font-size: 1rem;
35
+ margin-top: 10px;
36
+ }
37
  </style>
38
  </head>
39
  <body>
 
44
  <div class="slot" id="slot3">🍌</div>
45
  </div>
46
  <button id="spin-btn">Spin</button>
47
+ <div id="balance">Balance: $<span id="balance-amount">10.00</span></div>
48
+ <div id="history"></div>
49
 
50
  <script>
51
  document.getElementById('spin-btn').addEventListener('click', function () {
 
53
  var slot1 = document.getElementById('slot1');
54
  var slot2 = document.getElementById('slot2');
55
  var slot3 = document.getElementById('slot3');
56
+ var balanceAmount = document.getElementById('balance-amount');
57
+ var history = document.getElementById('history');
58
+ // Deduct 25 cents
59
+ var newBalance = parseFloat(balanceAmount.textContent) - 0.25;
60
+ if (newBalance < 0) {
61
+ alert("Insufficient balance.");
62
+ return;
63
+ }
64
+ balanceAmount.textContent = newBalance.toFixed(2);
65
  slot1.textContent = emojis[Math.floor(Math.random() * emojis.length)];
66
  slot2.textContent = emojis[Math.floor(Math.random() * emojis.length)];
67
  slot3.textContent = emojis[Math.floor(Math.random() * emojis.length)];
68
  if (slot1.textContent === slot2.textContent && slot2.textContent === slot3.textContent) {
69
+ var winAmount = Math.floor(Math.random() * 100) + 1;
70
+ newBalance = parseFloat(balanceAmount.textContent) + winAmount;
71
+ balanceAmount.textContent = newBalance.toFixed(2);
72
+ history.innerHTML += '<p>You won $' + winAmount + '! πŸŽ‰</p>';
73
  }
74
  });
75
  </script>
76
  </body>
77
+ </html>