Pulse kibozed lines when clicked

This commit is contained in:
Neale Pickett 2014-07-24 16:56:37 +00:00
parent a21005323e
commit 692380c876
1 changed files with 17 additions and 0 deletions

17
irc.js
View File

@ -13,6 +13,22 @@ function addMessagePart(p, className, text) {
p.appendChild(document.createTextNode(" "));
}
function focus(e) {
var pct = 1;
var timeout;
e.scrollIntoView(false);
e.style.backgroundColor = "yellow";
timeout = setInterval(function() {
pct = pct - 0.1;
e.style.backgroundColor = "rgba(255, 255, 0, " + pct + ")";
if (pct <= 0) {
e.style.backgroundColor = "inherit";
clearInterval(timeout);
}
}, 50)
}
function addMessage(txt) {
var lhs = txt.split(" :", 1)[0]
@ -43,6 +59,7 @@ function addMessage(txt) {
var k = document.getElementById("kiboze");
var p2 = p.cloneNode(true);
k.insertBefore(p2, k.firstChild);
p2.onclick = function() { focus(p); }
}
break;
default: