Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyKamau committed Dec 29, 2023
1 parent 5857308 commit e2e2bd1
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 11 deletions.
Binary file removed android-chrome-192x192.png
Binary file not shown.
Binary file removed android-chrome-512x512.png
Binary file not shown.
Binary file removed apple-touch-icon.png
Binary file not shown.
Binary file removed favicon-16x16.png
Binary file not shown.
Binary file removed favicon-32x32.png
Binary file not shown.
Binary file removed favicon.ico
Binary file not shown.
Binary file added images/wesmilk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 28 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
}

#image {
max-width: 100%;
max-height: 100%;
max-width: 100%; /* Adjust the height as needed */
border-radius: 10px; /* Optional: Add border radius for a rounded appearance */
}

Expand All @@ -30,6 +29,13 @@
font-size: 18px;
color: #333;
}

@media (max-width: 600px) {
#container {
max-width: 100vw; /* Adjust the width for smaller screens */
padding: 0 20px; /* Adjust padding for better spacing on small screens */
}
}
</style>
</head>
<body>
Expand All @@ -40,6 +46,10 @@
</div>

<script>
// Check if the user has been thanked or spilled
const firstEvent = localStorage.getItem('firstEvent');
const currentVersion = '3.0';

// Function to set the image state in localStorage
function setState(imageSrc, caption, event, title, favicon) {
localStorage.setItem('imageSrc', imageSrc);
Expand Down Expand Up @@ -72,9 +82,6 @@
link.href = imageState.favicon;
}

// Check if the user has been thanked or spilled
const firstEvent = localStorage.getItem('firstEvent');

// Event listener for visibility change
document.addEventListener('visibilitychange', function () {
const firstEvent = localStorage.getItem('firstEvent');
Expand All @@ -85,18 +92,29 @@
}
});

// Set timeout for 10 seconds
// Set timeout for a few seconds
setTimeout(function () {
const firstEvent = localStorage.getItem('firstEvent');
if (firstEvent == "null" || firstEvent == null) {
// If the user hasn't been thanked or spilled, and hasn't left the tab, change the image and caption to "Thank you"
setState('images/thanks.png', 'oh my god, thank you sooooo much for watching my milk! i was pretty worried it was gonna spill','thanked', 'ur the goat. seriously','favicons\\thanks.ico');
if (getRandomInt(100) <= 50){
setState('images/thanks.png', 'oh my god, thank you sooooo much for watching my milk! i was pretty worried it was gonna spill','thanked', 'ur the goat. seriously','favicons\\thanks.ico');
} else {
setState('images/wesmilk.png', 'thanks for watching it','thanked', 'preciate it','favicons\\thanks.ico');
}
updateImageAndCaption();
}
}, 60000);
}, getRandomInt(10000)+15000);

function getRandomInt(max) {
return Math.floor(Math.random() * max);
}

// If the user has been thanked or spilled, change the image and caption accordingly
if (!(firstEvent == "null" || firstEvent == null)) {
if (localStorage.getItem('version') != currentVersion){
localStorage.clear();
localStorage.setItem('version', currentVersion);
console.log('cleared!');
} else if (!(firstEvent == "null" || firstEvent == null)) {
updateImageAndCaption();
}
</script>
Expand Down
1 change: 0 additions & 1 deletion site.webmanifest

This file was deleted.

0 comments on commit e2e2bd1

Please sign in to comment.