openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

checkbox.min.js (826B)


      1 import $ from  '../../../../cms/ui/themes/default/script/jquery-global.min.js';
      2 import Workbench from "../../../../cms/ui/themes/default/script/openrat/workbench.min.js";
      3 export default function(element ) {
      4 $(element).find('.or-form-checkbox').change(function(e) {
      5 this.nextElementSibling.value = this.checked ? '1' : '0';
      6 });
      7 $(element).find('.or-form-checkbox.or-remember').each( function() {
      8 let key = 'preset.'+Workbench.state.action+'.'+this.dataset['name'];
      9 if   ( window.localStorage )
     10 this.checked = !!localStorage.getItem(key);
     11 this.nextElementSibling.value = this.checked ? '1' : '0';
     12 });
     13 $(element).find('.or-form-checkbox.or-remember').change(function() {
     14 let key = 'preset.'+Workbench.state.action+'.'+this.dataset['name'];
     15 if   ( window.localStorage )
     16 window.localStorage.setItem(key,this.checked?'1':'');
     17 });
     18 };