Skip to content
Snippets Groups Projects
Select Git revision
  • eef3cde27ec278decb6c32c87f61ec8191a56731
  • master default protected
  • pymilter-1.0.4
  • pymilter-1.0.3
  • pymilter-1.0.2
  • pymilter-1.0.1
  • pymilter-1_0
  • milter-0_8_18
  • pymilter-0_9_8
  • pymilter-0_9_7
  • pymilter-0_9_6
  • pymilter-0_9_5
  • pymilter-0_9_4
  • pymilter-0_9_2
  • pymilter-0_9_1
  • pymilter-0_9_0
  • pymilter-0_8_12
  • pymilter-0_8_11
  • pymilter-0_8_10
  • pymilter-0_8_9
  • milter-0_8_8
  • milter-0_8_7
22 results

pymilter.spec

Blame
  • editor.js 1.25 KiB
    (function($) {
    
      /**
       * Get closest row of element
       *
       * @param {jQuery} $el
       * @returns {jQuery}
       */
      function getRow($el) {
        return $el.closest('.fitem');
      }
    
        /**
         * Initializes editor
         */
      function init() {
        var $editor = $('.h5p-editor');
        var $fileField = $('input[name="h5pfile"]');
    
        if (H5PIntegration.hubIsEnabled) {
          // TODO: This can easily break in new themes. Improve robustness of this
          // by not including h5paction in form, when it should not be used.
          $('input[name="h5paction"]').parents('.fitem').last().hide();
        }
    
        const mformId = H5PIntegration.editor && H5PIntegration.editor.formId !== null
          ? H5PIntegration.editor.formId
          : 'mform1';
    
        // Cancel validation and submission of form if clicking cancel button
        const cancelSubmitCallback = function ($button) {
          return $button.is('[name="cancel"]');
        };
    
        H5PEditor.init(
          $('#' + mformId),
          $('input[name="h5paction"]'),
          getRow($fileField),
          getRow($editor),
          $editor,
          $('input[name="h5plibrary"]'),
          $('input[name="h5pparams"]'),
          $('input[name="h5pmaxscore"]'),
          $('input[name="name"]'),
          cancelSubmitCallback
        );
      }
    
      $(document).ready(init);
    })(H5P.jQuery);