mirror of
https://github.com/e107inc/e107.git
synced 2025-10-12 05:24:38 +02:00
32 lines
679 B
JavaScript
32 lines
679 B
JavaScript
var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
|
|
|
(function ($)
|
|
{
|
|
|
|
/**
|
|
* @type {{attach: e107.behaviors.bootstrapSwitchInit.attach}}
|
|
*/
|
|
e107.behaviors.bootstrapSwitchInit = {
|
|
attach: function (context, settings)
|
|
{
|
|
if(typeof settings.bsSwitch === 'undefined' || settings.bsSwitch.length == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
$.each(settings.bsSwitch, function (name, options)
|
|
{
|
|
$('input[name="' + name + '"]', context).once('bootstrap-switch-init').each(function ()
|
|
{
|
|
$(this).bootstrapSwitch({
|
|
size: options.size || 'mini',
|
|
onText: options.onText || null,
|
|
offText: options.offText || null
|
|
});
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
})(jQuery);
|