function DisposableBoolean(parent, field, params, setValue) {
    var self = this;

    // Inherit event support
    EventDispatcher.call(self);

    var $element;
    var checked = (params !== undefined && params);
    setValue(field, checked);

    // Expose field props
    self.field = field;

    /**
     * Build the DOM element string and then create the HTML.
     *
     * @private
     * @returns {H5P.jQuery}
     */
    var createElement = function () {
      var state = checked ? ' checked="checked" disabled="disabled"' : '';
      var content = '<input type="checkbox"' + state + ' />';

      $element = $(ns.createBooleanFieldMarkup(field, content));

      if (checked) {
        $element.addClass('disabled');
      }

      var $input = $element.find('input').on('change', function () {
        if (confirm(H5PEditor.t('H5PEditor.CoursePresentation', 'activeSurfaceWarning'))) {
          checked = $input.is(':checked');
          setValue(field, checked);
          $input.attr('disabled', true);
          $element.addClass('disabled');
          self.trigger('checked');
        }
        else {
          // Reset
          $input.attr('checked', false);
        }
      });
    };

    /**
     * Appends this fields elements to the given container.
     *
     * @param {H5P.jQuery} $container
     */
    self.appendTo = function ($container) {
      if ($element === undefined) {
        createElement();
      }
      $element.appendTo($container);
    };

    /**
     * Checks to see if this fields value is valid.
     *
     * @returns {boolean}
     */
    self.validate = function () {
      return true; // Always valid
    };

    /**
     * Removes this field from the DOM.
     */
    self.remove = function () {
      $element.detach();
    };
  }
/**
   * A special boolean option that only can be used once.
   * Requires confirmation before checking it.
   *
   * @class
   * @param {object} parent
   * @param {object} field
   * @param {boolean} params
   * @param {function} setValue
   */
A special boolean option that only can be used once.
Requires confirmation before checking it.


A special boolean option that only can be used once . Requires confirmation before checking it .
function DisposableBoolean(parent, field, params, setValue) {
    var self = this;
    EventDispatcher.call(self);
    var $element;
    var checked = (params !== undefined && params);
    setValue(field, checked);
    self.field = field;
    var createElement = function () {
      var state = checked ? ' checked="checked" disabled="disabled"' : '';
      var content = '<input type="checkbox"' + state + ' />';
      $element = $(ns.createBooleanFieldMarkup(field, content));
      if (checked) {
        $element.addClass('disabled');
      }
      var $input = $element.find('input').on('change', function () {
        if (confirm(H5PEditor.t('H5PEditor.CoursePresentation', 'activeSurfaceWarning'))) {
          checked = $input.is(':checked');
          setValue(field, checked);
          $input.attr('disabled', true);
          $element.addClass('disabled');
          self.trigger('checked');
        }
        else {
          $input.attr('checked', false);
        }
      });
    };
    self.appendTo = function ($container) {
      if ($element === undefined) {
        createElement();
      }
      $element.appendTo($container);
    };
    self.validate = function () {
      return true; 
    };
    self.remove = function () {
      $element.detach();
    };
  }
function DisposableBoolean ( parent , field , params , setValue ) { var self = this ; EventDispatcher . call ( self ) ; var $element ; var checked = ( params !== undefined && params ) ; setValue ( field , checked ) ; self . field = field ; var createElement = function ( ) { var state = checked ? ' checked="checked" disabled="disabled"' : '' ; var content = '<input type="checkbox"' + state + ' />' ; $element = $ ( ns . createBooleanFieldMarkup ( field , content ) ) ; if ( checked ) { $element . addClass ( 'disabled' ) ; } var $input = $element . find ( 'input' ) . on ( 'change' , function ( ) { if ( confirm ( H5PEditor . t ( 'H5PEditor.CoursePresentation' , 'activeSurfaceWarning' ) ) ) { checked = $input . is ( ':checked' ) ; setValue ( field , checked ) ; $input . attr ( 'disabled' , true ) ; $element . addClass ( 'disabled' ) ; self . trigger ( 'checked' ) ; } else { $input . attr ( 'checked' , false ) ; } } ) ; } ; self . appendTo = function ( $container ) { if ( $element === undefined ) { createElement ( ) ; } $element . appendTo ( $container ) ; } ; self . validate = function ( ) { return true ; } ; self . remove = function ( ) { $element . detach ( ) ; } ; }
A special boolean option that only can be used once.
A special boolean option that only can be used once .
// Inherit event support // Expose field props /**
     * Build the DOM element string and then create the HTML.
     *
     * @private
     * @returns {H5P.jQuery}
     */ // Reset /**
     * Appends this fields elements to the given container.
     *
     * @param {H5P.jQuery} $container
     */ /**
     * Checks to see if this fields value is valid.
     *
     * @returns {boolean}
     */ // Always valid /**
     * Removes this field from the DOM.
     */