<commit_before>$.fn.romoInline = function() {
  return $.map(this, function(elem) {
    return new RomoInline($(elem))
  })
}

var RomoInline = function(element) {
  this.elem = $(element)
  this.toggleElem = $(this.elem.data('romo-inline-toggle'))

  this.elem.on('invoke:invoke', $.proxy(function(e, invoke) {
    this.doInvoke()
  }, this))
  this.elem.on('invoke:loadStart', $.proxy(function(e, invoke) {
    this.doLoadStart()
  }, this))
  this.elem.on('invoke:loadSuccess', $.proxy(function(e, data, invoke) {
    this.doLoadSuccess(data)
  }, this))
  this.elem.on('invoke:loadError', $.proxy(function(e, xhr, invoke) {
    this.doLoadError(xhr)
  }, this))

  this.doInit()
  this.elem.trigger('inline:ready', [this])
}

RomoInline.prototype.doInit = function() {
  // override as needed
}

RomoInline.prototype.doInvoke = function() {
  this.elem.show()
  this.toggleElem.hide()
  this.elem.trigger('inline:invoke', [this])
}

RomoInline.prototype.doLoadStart = function() {
  this.elem.html('')
  this.elem.trigger('inline:loadStart', [this])
}

RomoInline.prototype.doLoadSuccess = function(data) {
  Romo.initHtml(this.elem, data)

  var dismissElem = this.elem.find('[data-romo-inline-dismiss="true"]')
  dismissElem.unbind('click')
  dismissElem.on('click', $.proxy(this.onDismissClick, this))

  this.elem.trigger('inline:loadSuccess', [data, this])
}

RomoInline.prototype.doLoadError = function(xhr) {
  this.elem.trigger('inline:loadError', [xhr, this])
}

RomoInline.prototype.onDismissClick = function(e) {
  if (e !== undefined) {
    e.preventDefault()
  }

  this.doDismiss()
}

RomoInline.prototype.doDismiss = function() {
  this.toggleElem.show()<commit_msg>inline: bind dismiss on init as well as on load success<commit_after>$.fn.romoInline = function() {
  return $.map(this, function(elem) {
    return new RomoInline($(elem))
  })
}

var RomoInline = function(element) {
  this.elem = $(element)
  this.toggleElem = $(this.elem.data('romo-inline-toggle'))

  this.elem.on('invoke:invoke', $.proxy(function(e, invoke) {
    this.doInvoke()
  }, this))
  this.elem.on('invoke:loadStart', $.proxy(function(e, invoke) {
    this.doLoadStart()
  }, this))
  this.elem.on('invoke:loadSuccess', $.proxy(function(e, data, invoke) {
    this.doLoadSuccess(data)
  }, this))
  this.elem.on('invoke:loadError', $.proxy(function(e, xhr, invoke) {
    this.doLoadError(xhr)
  }, this))

  this.doBindDismiss()
  this.doInit()
  this.elem.trigger('inline:ready', [this])
}

RomoInline.prototype.doInit = function() {
  // override as needed
}

RomoInline.prototype.doInvoke = function() {
  this.elem.show()
  this.toggleElem.hide()
  this.elem.trigger('inline:invoke', [this])
}

RomoInline.prototype.doLoadStart = function() {
  this.elem.html('')
  this.elem.trigger('inline:loadStart', [this])
}

RomoInline.prototype.doLoadSuccess = function(data) {
  Romo.initHtml(this.elem, data)
  this.doBindDismiss()
  this.elem.trigger('inline:loadSuccess', [data, this])
}

RomoInline.prototype.doLoadError = function(xhr) {
  this.elem.trigger('inline:loadError', [xhr, this])
}

RomoInline.prototype.doBindDismiss = function() {
  var dismissElem = this.elem.find('[data-romo-inline-dismiss="true"]')
  dismissElem.unbind('click')
  dismissElem.on('click', $.proxy(this.onDismissClick, this))
}

RomoInline.prototype.onDismissClick = function(e) {
  if (e !== undefined) {
    e.preventDefault()
  }

  this.doDismiss()
}

RomoInline.prototype.doDismiss = function() {
  this.toggleElem.show()
{'fraction_non_alphanumeric': 0.17896836705614136, 'fraction_numerical': 0.0, 'mean_word_length': 4.670436187399031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6505013', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1256, 'n_words': 183}