User:Mudbringer/HL.js

function HLoverHandler (event) { var cn = event.target.className var tn = event.target.tagName if (cn == "ruby" || tn == "I") { cn = event.target.parentElement.className } if (-1 == cn.search(/^text\d+$/)) { return } var x = document.getElementsByClassName(cn) for (var i = 0; i < x.length; i++) { x[i].style.color = "red" } }

function HLoffHandler (event) { var cn = event.target.className var tn = event.target.tagName if (cn == "ruby" || tn == "I") { cn = event.target.parentElement.className } if (-1 == cn.search(/^text\d+$/)) { return } var x = document.getElementsByClassName(cn) for (var i = 0; i < x.length; i++) { if (x[i].style.fontWeight == "bold") { x[i].style.color = "blue" } else { x[i].style.color = "black" } } }

function HLclickHandler (event) { var cn = event.target.className; var tn = event.target.tagName; if (cn == "ruby" || tn == "I") { cn = event.target.parentElement.className } if (-1 == cn.search(/^text\d+$/)) { return } var x = document.getElementsByClassName(cn) for (var i = 0; i < x.length; i++) { if (x[i].style.fontWeight == "bold") { x[i].style.color = "red" x[i].style.fontWeight = "normal" } else { x[i].style.color = "blue" x[i].style.fontWeight = "bold" } } }