Skip to content

Commit

Permalink
coins!
Browse files Browse the repository at this point in the history
  • Loading branch information
silvereengames committed Sep 4, 2024
1 parent 92c1aae commit 2f8ab8d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
8 changes: 4 additions & 4 deletions public/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@
};

function countTime() {
localStorage.setItem('timeplayed', parseInt(localStorage.getItem('timeplayed')) + 1)
console.log(localStorage.getItem('timeplayed'))
localStorage.setItem('timeplayed', parseInt(localStorage.getItem('timeplayed')) + 1);
console.log(localStorage.getItem('timeplayed'));
}

if (localStorage.getItem('timeplayed') !== null) {
setInterval(countTime, 1000)
var timer = setInterval(countTime, 1000);
} else {
localStorage.setItem('timeplayed', 0);
setInterval(countTime, 1000)
var timer = setInterval(countTime, 1000);
}
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7001820938357122"
Expand Down
21 changes: 21 additions & 0 deletions public/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,25 @@ hr {

.learning {
display: none;
}

::-webkit-scrollbar {
width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
background: var(--third-color);
border-radius: 10px;
}

/* Handle */
::-webkit-scrollbar-thumb {
background: var(--primary-color);
border-radius: 10px;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
background: var(--secondary-color);
}
6 changes: 3 additions & 3 deletions public/load.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@
}
});
});

function countTime() {
localStorage.setItem('timesearched', parseInt(localStorage.getItem('timesearched')) + 1)
console.log(localStorage.getItem('timesearched'))
}

if (localStorage.getItem('timesearched')) {
setInterval(countTime, 1000)
var timer = setInterval(countTime, 1000)
} else {
localStorage.setItem('timesearched', 0);
setInterval(countTime, 1000)
var timer = setInterval(countTime, 1000)
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/eruda/3.0.1/eruda.min.js"></script>
Expand Down
25 changes: 18 additions & 7 deletions public/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ <h2 class="center">Stats</h2>
<h4 class="center">Time Played: <span id="timeplayed"></span></h4>
<h4 class="center">Time using proxy: <span id="timesearched"></span></h4>
<h4 class="center">Total time: <span id="totaltime"></span></h4>
<h4 class="center">Total coins: <span id="coins"></span></h4>
</div>

<div class="settings-container">
Expand Down Expand Up @@ -221,7 +222,7 @@ <h2 class="center">Other info</h2>

<div class="settings-container">
<h2 class="center">Credits</h2>
<div style="height: 175px; overflow-y: scroll;" class="center">
<div style="height: 300px; overflow-y: scroll;" class="center">
<div>
<h3 class="sticky">Project Lead</h3>
<p>Silvereen</p>
Expand Down Expand Up @@ -392,13 +393,21 @@ <h3 class="sticky">Code Stuff</h3>
window.open('../iframe.html')
}

if (localStorage.getItem('timeplayed') == null) {
localStorage.setItem('timeplayed', 0);
}

if (localStorage.getItem('timesearched') == null) {
localStorage.setItem('timesearched', 0);
}

const hours = document.getElementById('timeplayed');
const timeplayedSeconds = parseInt(localStorage.getItem('timeplayed'));

if (timeplayedSeconds >= 3600) {
hours.innerHTML = Math.round(timeplayedSeconds / 60 / 60) + " Hours";
hours.innerHTML = Math.round(timeplayedSeconds / 60 / 60*10)/10 + " Hours";
} else if (timeplayedSeconds >= 60) {
hours.innerHTML = Math.round(timeplayedSeconds / 60) + " Minutes";
hours.innerHTML = Math.round(timeplayedSeconds / 60*10)/10 + " Minutes";
} else {
hours.innerHTML = Math.round(timeplayedSeconds) + " Seconds";
}
Expand All @@ -407,23 +416,25 @@ <h3 class="sticky">Code Stuff</h3>
const timesearchedSeconds = parseInt(localStorage.getItem('timesearched'));

if (timesearchedSeconds >= 3600) {
timesearched.innerHTML = Math.round(timesearchedSeconds / 60 / 60) + " Hours";
timesearched.innerHTML = Math.round(timesearchedSeconds / 60 / 60*10)/10 + " Hours";
} else if (timesearchedSeconds >= 60) {
timesearched.innerHTML = Math.round(timesearchedSeconds / 60) + " Minutes";
timesearched.innerHTML = Math.round(timesearchedSeconds / 60*10)/10 + " Minutes";
} else {
timesearched.innerHTML = Math.round(timesearchedSeconds) + " Seconds";
}

const totaltime = document.getElementById('totaltime');
const totalTimeSeconds = timeplayedSeconds + timesearchedSeconds;
if (totalTimeSeconds >= 3600) {
totaltime.innerHTML = Math.round(totalTimeSeconds / 60 / 60) + " Hours";
totaltime.innerHTML = Math.round(totalTimeSeconds / 60 / 60*10)/10 + " Hours";
} else if (totalTimeSeconds >= 60) {
totaltime.innerHTML = Math.round(totalTimeSeconds / 60) + " Minutes";
totaltime.innerHTML = Math.round(totalTimeSeconds / 60*10)/10 + " Minutes";
} else {
totaltime.innerHTML = Math.round(totalTimeSeconds) + " Seconds";
}

const coins = Math.round((timeplayedSeconds + timesearchedSeconds)/30)
document.getElementById('coins').innerHTML = coins+" Coins"

let obj = new Date();
let day = obj.getUTCDate();
Expand Down

0 comments on commit 2f8ab8d

Please sign in to comment.