30 lines
533 B
JavaScript
30 lines
533 B
JavaScript
initOption = function(str)
|
|
{
|
|
for (var i of $(str + " :button"))
|
|
{
|
|
$("#" + i.id).on("click", setOption)
|
|
}
|
|
}
|
|
|
|
setOption = function(e)
|
|
{
|
|
var btn = e.target;
|
|
for (var s of $("#" + btn.id).siblings())
|
|
{
|
|
if (s.id)
|
|
{
|
|
$("#" + s.id).removeClass("activeButton");
|
|
}
|
|
}
|
|
$("#" + btn.id).addClass("activeButton");
|
|
options[e.target.parentElement.id] = btn.name;
|
|
if (updateFuncs != undefined)
|
|
{
|
|
for (var f of updateFuncs)
|
|
{
|
|
f();
|
|
}
|
|
}
|
|
console.log(options[e.target.parentElement.id])
|
|
}
|
|
|