Files
aowow/setup/tools/filegen/templates/global.js/redbutton.js
Sarjuuk 6557e70d5c Template/Update (Part 47)
* split global.js into its components, so it can be reasonably processed by setup
 * make reputation requirements configurable
 * move Markup and Locale back into global.js (removed associated build scripts)
 * extend Icon to display iconId in lightbox popup
2025-09-25 16:01:14 +02:00

49 lines
1.1 KiB
JavaScript

var RedButton = {
create: function(text, enabled, func)
{
var
a = $WH.ce('a'),
em = $WH.ce('em'),
b = $WH.ce('b'),
i = $WH.ce('i'),
span = $WH.ce('span');
a.href = 'javascript:;';
a.className = 'button-red';
$WH.ae(b, i);
$WH.ae(em, b);
$WH.ae(em, span);
$WH.ae(a, em);
RedButton.setText(a, text);
RedButton.enable(a, enabled);
RedButton.setFunc(a, func);
return a;
},
setText: function(button, text)
{
$WH.st(button.firstChild.childNodes[0].firstChild, text); // em, b, i
$WH.st(button.firstChild.childNodes[1], text); // em, span
},
enable: function(button, enabled)
{
if (enabled || enabled == null)
{
button.className = button.className.replace('button-red-disabled', '');
}
else if (button.className.indexOf('button-red-disabled') == -1)
button.className += ' button-red-disabled';
},
setFunc: function(button, func)
{
$(button).unbind();
if(func)
$(button).click(func);
}
};