20 lines
786 B
JavaScript
20 lines
786 B
JavaScript
/* Fulfilment tab of the product: shows only the fields of the chosen type. */
|
|
(function () {
|
|
'use strict';
|
|
function paint() {
|
|
var sel = document.getElementById('mozout_reseller_type');
|
|
if (!sel) { return; }
|
|
var t = sel.value;
|
|
document.querySelectorAll('#mozout_reseller_product_data .mozout-reseller-only').forEach(function (box) {
|
|
var on = (' ' + box.getAttribute('data-for') + ' ').indexOf(' ' + t + ' ') > -1;
|
|
box.style.display = on ? '' : 'none';
|
|
});
|
|
}
|
|
function init() {
|
|
var sel = document.getElementById('mozout_reseller_type');
|
|
if (!sel) { return; }
|
|
sel.addEventListener('change', paint);
|
|
paint();
|
|
}
|
|
if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); }
|
|
})();
|