a
This commit is contained in:
24
favicon.js
Normal file
24
favicon.js
Normal file
@@ -0,0 +1,24 @@
|
||||
document.head = document.head || document.getElementsByTagName('head')[0];
|
||||
|
||||
function changeFavicon(src) {
|
||||
var link = document.createElement('link'),
|
||||
oldLink = document.getElementById('dynamic-favicon');
|
||||
link.id = 'dynamic-favicon';
|
||||
link.rel = 'shortcut icon';
|
||||
link.href = src;
|
||||
if (oldLink) {
|
||||
document.head.removeChild(oldLink);
|
||||
}
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
while (true) {
|
||||
changeFavicon('/favicon.ico');
|
||||
await sleep(2000);
|
||||
changeFavicon('/favicon2.ico');
|
||||
await sleep(2000);
|
||||
}
|
||||
Reference in New Issue
Block a user