added periodic title change
This commit is contained in:
parent
6e8611266b
commit
cb47786810
@ -30,16 +30,21 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
]
|
]
|
||||||
|
|
||||||
function putString(element, s, i) {
|
function setTitle(element, s, i) {
|
||||||
i++
|
i++
|
||||||
element.textContent = s.substring(0, i)
|
element.textContent = s.substring(0, i)
|
||||||
|
|
||||||
if (i >=s.length) return;
|
if (i >=s.length) return;
|
||||||
setTimeout(() => putString(element, s, i), 100);
|
setTimeout(() => setTitle(element, s, i), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function titleChanger(element) {
|
||||||
|
setTitle(element, phrases[Math.floor(Math.random()*phrases.length)], 0);
|
||||||
|
setTimeout(() => titleChanger(element), 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
Array.from(document.querySelectorAll(".phrases")).forEach(element => {
|
Array.from(document.querySelectorAll(".phrases")).forEach(element => {
|
||||||
putString(element, phrases[Math.floor(Math.random()*phrases.length)], 0)
|
titleChanger(element);
|
||||||
})
|
})
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user