22 lines
No EOL
776 B
JavaScript
22 lines
No EOL
776 B
JavaScript
function switchTheme(e) {
|
|
let actualTheme = document.documentElement.getAttribute('data-theme');
|
|
if (actualTheme === null || actualTheme === 'light') {
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
return false;
|
|
}
|
|
|
|
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
|
|
if (currentTheme) {
|
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
|
}
|
|
|
|
copiedText = function copyText(e) {
|
|
navigator.clipboard.writeText(e.nextElementSibling.value);
|
|
alert("Link copied to clipboard");
|
|
return false;
|
|
} |