Skip to content

Commit

Permalink
Re-introduce try-catch and document
Browse files Browse the repository at this point in the history
  • Loading branch information
Tritlo committed May 5, 2024
1 parent 729b72e commit 7faab02
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions site/templates/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
<script>
(function () {
try {
var preferredUwu = localStorage.getItem('uwu');
var preferredUwu = false;
// localStorage might be inaccessible due to device permissions,
// hence the try-catch.
try {
preferredUwu = localStorage.getItem('uwu');
} catch (err) {} ;

const isUwuValue = window.location
&& window.location.search
Expand All @@ -24,13 +29,17 @@
if (isUwuValue) {
const isUwu = isUwuValue[1] === 'true';
if (isUwu) {
localStorage.setItem('uwu', true);
try {
localStorage.setItem('uwu', true);
} catch (err) {} ;

document.documentElement.classList.add('alternative-logo');
console.log('alternative logo enabled. turn off with ?uwu=false')
console.log('logo credit to @sawaratsuki1004 via https://github.com/SAWARATSUKI/ServiceLogos. Slightly tweaked by @Tritlo');
console.log('logo credit to @sawaratsuki1004. Slightly tweaked by @Tritlo');
} else {
localStorage.removeItem('uwu', false);
try {
localStorage.removeItem('uwu', false);
} catch (err) {} ;
}
} else if (preferredUwu) {
document.documentElement.classList.add('alternative-logo');
Expand Down

0 comments on commit 7faab02

Please sign in to comment.