User:Iritscen/TestSpace.js: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(first try at hovertable script)
 
m (wait, this *does* work? +cat test)
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
function showDescrip(typeID, show_or_not)
/* Put test JS here! */
{
    var DescripPanel = document.getElementByClassName("hovertable_descrip");
    var Descrip = DescripPanel.getElementById(typeID);


    if (!DescripPanel || !Descrip)
/*[[Category:Userspace]]*/
        return false;
 
    if (show_or_not)
        Descrip.style.display = "block";
    else
        Descrip.style.display = "none";
}
 
function initHoverTables()
{
    var Tables = document.getElementsByClassName("hovertable");
    if (!Tables)
        return false;
 
    for (var i = 0; i < Tables.length; i++)
    {
            var Cells = Tables.getElementsByTagName("td")[0];
            if (!Cells) continue;
 
            for (var j = 0; j < Cells.length; j++)
            {
                if (hasClass(Cells[j], "hovertable_descrip") continue;
                addHandler(Cells[j],  "mouseover", new Function("evt", "showDescrip(" + this.id + ", true);"));
                addHandler(Cells[j],  "mouseout", new Function("evt", "showDescrip(" + this.id + ", false);"));
            }
        }
    }
}
 
addOnloadHook(initHoverTables);

Latest revision as of 15:10, 8 April 2023

/* Put test JS here! */

/*[[Category:Userspace]]*/