<commit_before>import $ from 'jquery'
import { View } from 'backbone'

const EmbedView = View.extend({
  className: 'extplug-chat-image',

  render() {
    this.$close = $('<div />')
      .addClass('extplug-close')
      .append($('<i />').addClass('icon icon-dialog-close'))

    this.$link = $('<a />')
      .attr('href', this.options.url)
      .attr('title', this.options.url)
      .attr('target', '_blank')

    let image = this.getImage().on('load', () => {
      this.trigger('load')
    })

    this.$el
      .empty()
      .append(this.$close)
      .append(this.$link.append(image))

    this.$close.on('click', this.close.bind(this))

    return this
  },

  close() {
    this.$link.text(this.options.url)
    this.$el.replaceWith(this.$link)
    this.destroy()
  }

})

export default EmbedView<commit_msg>ctrl+click close to close all<commit_after>import $ from 'jquery'
import { View } from 'backbone'

const EmbedView = View.extend({
  className: 'extplug-chat-image',

  render() {
    this.$close = $('<div />')
      .addClass('extplug-close')
      .append($('<i />').addClass('icon icon-dialog-close'))

    this.$link = $('<a />')
      .attr('href', this.options.url)
      .attr('title', this.options.url)
      .attr('target', '_blank')

    let image = this.getImage().on('load', () => {
      this.trigger('load')
    })

    this.$el
      .empty()
      .append(this.$close)
      .append(this.$link.append(image))

    this.$close.on('click', e => {
      // ctrl+click closes all
      if (e.ctrlKey) {
        $('#chat-messages .extplug-chat-image .extplug-close').click()
      }
      else {
        this.close()
      }
    })

    return this
  },

  close() {
    this.$link.text(this.options.url)
    this.$el.replaceWith(this.$link)
    this.destroy()
  }

})

export default EmbedView
{'fraction_non_alphanumeric': 0.20076586433260393, 'fraction_numerical': 0.0, 'mean_word_length': 2.503831417624521, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, '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': '1951413', 'n_tokens_mistral': 623, 'n_tokens_neox': 608, 'n_words': 105}