-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
f93d4a6
commit dc442cb
Showing
3 changed files
with
245 additions
and
247 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Script to auto toggle dark mode | ||
function toggleDarkMode() { | ||
const currentHour = new Date().getHours(); | ||
const isDayTime = currentHour >= 8 && currentHour < 18; | ||
document.body.classList.toggle('dark-mode', !isDayTime); | ||
} | ||
// Call the function initially | ||
toggleDarkMode(); | ||
// Check every 10 minutes | ||
setInterval(toggleDarkMode, 10 * 60 * 1000); | ||
|
||
function copyToClipboard(codeId) { | ||
const codeElement = document.getElementById(codeId); | ||
const text = codeElement.innerText; | ||
navigator.clipboard.writeText(text).then(() => { | ||
const copyIcon = codeElement.parentElement.nextElementSibling; | ||
copyIcon.innerText = '✔'; | ||
copyIcon.classList.add('copied'); | ||
copyIcon.title = "Command copied to clipboard"; | ||
setTimeout(() => { | ||
copyIcon.innerText = '📋'; | ||
copyIcon.classList.remove('copied'); | ||
copyIcon.title = "Copy Command"; | ||
}, 2000); | ||
}).catch(err => { | ||
console.error('Failed to copy text: ', err); | ||
}); | ||
} |
Oops, something went wrong.