-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Follow: https://github.com/reactjs/react.dev/blob/main/src/pages/_document.tsx | ||
*/ | ||
|
||
export function enableUwu() { | ||
|
||
try { | ||
var preferredUwu | ||
try { | ||
preferredUwu = localStorage.getItem('uwu') | ||
} catch (err) {} | ||
|
||
const isUwuValue = | ||
window.location && window.location.search && window.location.search.match(/uwu=(true|false)/) | ||
|
||
if (isUwuValue) { | ||
const isUwu = isUwuValue[1] === 'true' | ||
if (isUwu) { | ||
try { | ||
localStorage.setItem('uwu', true) | ||
} catch (err) {} | ||
document.documentElement.classList.add('uwu') | ||
console.log( | ||
'uwu mode enabled. logo credits to @sawaratsuki1004 via https://github.com/SAWARATSUKI/ServiceLogos' | ||
) | ||
} else { | ||
try { | ||
localStorage.removeItem('uwu', false) | ||
} catch (err) {} | ||
} | ||
} else if (preferredUwu) { | ||
document.documentElement.classList.add('uwu') | ||
} | ||
} catch (err) {} | ||
|
||
document.addEventListener('DOMContentLoaded', async () => { | ||
var logo | ||
while (!logo) { | ||
await new Promise((resolve) => setTimeout(resolve, 100)) | ||
logo = document.querySelector('img.logo') | ||
} | ||
if (document.documentElement.classList.contains('uwu')) { | ||
logo.src = '/images/uwu.png' | ||
} | ||
}) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.