<commit_before>import * as $ from 'jquery';
import { H5PDataRepository, IDataRepository } from './services/data-repository';
import { AdvancedBlanksController } from './controllers/advanced-blanks-controller';
import { H5PLocalization } from "./services/localization";

export default class AdvancedBlanks extends (H5P.EventDispatcher as { new(): any; }) {
  private app: AdvancedBlanksController;
  private repository: IDataRepository;

  /**
   * @constructor
   *
   * @param {object} config
   * @param {string} contentId
   * @param {object} contentData
   */
  constructor(config: any, contentId: string, contentData: any = {}) {
    super();

    this.repository = new H5PDataRepository(config);
    H5PLocalization.getInstance(config);
  }

  /**
   * Attach library to wrapper
   *
   * @param {jQuery} $wrapper
   */
  attach = function ($wrapper: JQuery) {
    $wrapper.get(0).classList.add('h5p-advanced-blanks');
    this.app = new AdvancedBlanksController(this.repository, $wrapper);
    this.app.initialize($wrapper.get(0));
  }
}<commit_msg>AdvancedBlanks class now derives from H5P.Question<commit_after>import * as $ from 'jquery';
import { H5PDataRepository, IDataRepository } from './services/data-repository';
import { AdvancedBlanksController } from './controllers/advanced-blanks-controller';
import { H5PLocalization } from "./services/localization";

export default class AdvancedBlanks extends (H5P.Question as { new(): any; }) {
  private app: AdvancedBlanksController;
  private repository: IDataRepository;
  private contentContainer: JQuery;
  private jQuery: JQuery = H5P.jQuery;

  /**
   * @constructor
   *
   * @param {object} config
   * @param {string} contentId
   * @param {object} contentData
   */
  constructor(config: any, contentId: string, contentData: any = {}) {
    super();

    this.repository = new H5PDataRepository(config);
    H5PLocalization.getInstance(config);
  }

  /**
   * Overrides the attach method of the superclass (H5P.Question) and calls it
   * at the same time. (equivalent to super.attach($container)).
   * This is necessary, as Ractive needs to be initialized with an existing DOM
   * element. DOM elements are created in H5P.Question.attach, so initializing 
   * Ractive in registerDomElements doesn't work.
   */
  attach = (function (original) {
    return function ($container) {
      original($container);
      this.app = new AdvancedBlanksController(this.repository, $container);
      this.app.initialize(this.container.get(0));
    }
  })(this.attach);

  /**
   * Called by H5P.Question.attach(). 
   */
  registerDomElements = function () {
    this.container = this.jQuery("<div/>", { "class": "h5p-advanced-blanks" });
    this.setContent(this.container);
  }
}
{'fraction_non_alphanumeric': 0.12841033102946525, 'fraction_numerical': 0.007275372862859221, 'mean_word_length': 3.963898916967509, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7014321', 'n_tokens_mistral': 817, 'n_tokens_neox': 799, 'n_words': 203}