User:Ultimate Dark Carnage/util.js

var $ut = {}; $ut.skin = function(a, b){ var mw = mediaWiki; if (typeof a == 'object'){ for (var i in a){ if (mw.config.get('skin') == i){ var s = mw.config.get('skin') || i;               a[i].call(s); }       }    } else if (typeof a == 'string') { var sk = skin; if (mw.config.get('skin') == sk){ sk = mw.config.get('skin') || sk; b.call(sk); }   } };

$ut.button = function(a, b, c){ var el, button; if (typeof a == 'object'){ for (var i in a){ el = $(a[i].elem); button = $('', {               "class": "wikia-button",                "id": a[i].id,                text: i,                on: {                    'click': a[i].handler                }            }); if (a[i].add == 'append'){ el.append(button); } else if (a[i].add == 'prepend'){ el.prepend(button); } else if (a[i].add == 'before'){ el.before(button); } else if (a[i].add == 'after'){ el.after(button); }       }    } else if (typeof a == 'string'){ el = $(b.elem); button = $('', {           "class": "wikia-button",            "id": b.id,            text: a,            on: {                "click": c            }        }); if (b.add == 'append'){ el.append(button); } else if (b.add == 'prepend'){ el.prepend(button); } else if (b.add == 'before'){ el.before(button); } else if (b.add == 'after'){ el.after(button); }   }    return button; };