<commit_before>DropTooltip = Drop.createContext()

defaults =
    attach: 'top center'

class Tooltip
    constructor: (@options) ->
        @options.attach ?= defaults.attach

        @drop = new DropTooltip
            target: @options.el
            className: 'drop-tooltip-theme-arrows'
            attach: @options.attach
            constrainToWindow: true
            constrainToScrollParent: false
            openOn: 'hover'
            content: @options.content ? @$target.attr('data-tooltip-content')

window.Tooltip = Tooltip<commit_msg>Add autoinit<commit_after>DropTooltip = Drop.createContext()

defaults =
  attach: 'top center'

class Tooltip
  constructor: (@options) ->
    @options.attach ?= @options.el.getAttribute('data-tooltip-attach') ? defaults.attach
    @options.content ?= @options.el.getAttribute('data-tooltip')

    @drop = new DropTooltip
      target: @options.el
      className: 'drop-tooltip-theme-arrows'
      attach: @options.attach
      constrainToWindow: true
      constrainToScrollParent: false
      openOn: 'hover'
      content: @options.content

initialized = []
Tooltip.init = ->
  for el in document.querySelectorAll('[data-tooltip]') when el not in initialized
    new Tooltip {el}

    initialized.push el

if document.documentElement?.doScroll? and document.createEventObject?
  # IE < 9
  _old = document.onreadystatechange
  document.onreadystatechange = ->
    if document.readyState is 'complete'
      Tooltip.init()

    _old?.apply this, arguments
else
  document.addEventListener 'DOMContentLoaded', ->
    Tooltip.init()
  , false

window.Tooltip = Tooltip
{'fraction_non_alphanumeric': 0.10802469135802469, 'fraction_numerical': 0.0006172839506172839, 'mean_word_length': 3.0934343434343434, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, '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': '2918717', 'n_tokens_mistral': 460, 'n_tokens_neox': 462, 'n_words': 104}