<commit_before># expressionUI popover v2.0
# * https://github.com/jasoncypret/expressionUI
# *
# * Copyright (c) 2013 <NAME> (http://jasoncypret.com/)
# * Licensed under the MIT License
# 
(($) ->
  methods =
    defaults:
      content: $(".popover")
      padding: 5
      flush: false
      fixed: true
      close_on_scroll: false
      scroll_target: $(document)
      scroll_threshold: 5
      close_on_click: "anywhere"
      restrict_close_click: null
      reposition_on_resize: false
      tooltip: false
      arrow_height: 12
      arrow_offset: 35
      arrow_position: null
      position_top: null
      position_left: null
      outter_height: null
      outter_width: null
      afterOpen: $.noop
      afterClose: $.noop

    init: (options) ->
      options = $.extend({}, methods.defaults, options)
      console.log options
      options.tooltipHeight = 0
      options.tooltipWidth = 0
      $(this).popover "_get_width_height", options
      $(this).popover "_get_center_position", options
      options.arrow_position = $(this).popover("_positionArrow", options)  unless options.arrow_position
      $(this).popover "_init_class_styles", options
      options.tooltipHeight = options.content.outerHeight()
      options.tooltipWidth = options.content.outerWidth()

      $(this).popover "_position_popover", options
      options.content.css(
        left: options.position_left + "px"
        top: options.position_top + "px"
        display: "none"
        visibility: "visible"
      ).show()
      options.afterOpen.apply this, [options.content]
      $(this).popover "_setupEvents", options

    close: (options) ->
      $(".active.popover_target").removeClass "active popover_target"
      options = $.extend({}, methods.defaults, options)
      options.content = this  unless $(options.content).length
      $(options.content).removeClass("popover_container topleft bottomleft topright bottomright tooltip flush").attr("style", "").hide()
      $(this).popover "_destroyEvents", options
      options.afterClose.apply this, [options.content]

    _get_center_position: (options) ->
      
      # POSITION CENTER OF ELEMENT
      if options.position_left is null
        options.position_left = $(this).offset().left + (options.outter_width / 2)
      else
        options.position_left += (options.outter_width / 2)
      if options.position_top is null
        options.position_top = $(this).offset().top + (options.outter_height / 2)
      else
        options.position_top += (options.outter_height / 2)

    _get_width_height: (options) ->
      
      # GET HEIGHT & WIDTH
      options.outter_height = (if ($(this).outerHeight() is 0) then $(this).attr("height") else $(this).outerHeight())  if options.outter_height is null
      options.outter_width = (if ($(this).outerWidth() is 0) then $(this).attr("width") else $(this).outerWidth())  if options.outter_width is null

    _destroyEvents: (options) ->
      $(document).unbind "click.popover"
      $(document).unbind "scroll.popover"
      $(document).unbind "resize.popover"

    _setupEvents: (options) ->
      _this = $(this)
      click = 0
      if options.reposition_on_resize
        $(window).bind "resize.popover", ->
          $(this).popover "reposition_popover", options

      $(document).unbind("click.popover").bind "click.popover", (event) ->
        alert event.target.nodeName
        click++
        if click > 1
          container = $(".popover_container")
          switch options.close_on_click
            when "anywhere"
              if !!options.restrict_close_click
                $(this).popover "close", options  if $.inArray(event.target, options.restrict_close_click)
              else
                $(this).popover "close", options
            when "outside"
              if !!options.restrict_close_click
                $(this).popover "close", options  if not container.is(event.target) and container.has(event.target).length is 0 and $.inArray(event.target, options.restrict_close_click)
              else
                $(this).popover "close", options  if not container.is(event.target) and container.has(event.target).length is 0<commit_msg>removed alert and all set for the best code eva<commit_after># expressionUI popover v2.0
# * https://github.com/jasoncypret/expressionUI
# *
# * Copyright (c) 2013 <NAME> (http://jasoncypret.com/)
# * Licensed under the MIT License
# 
(($) ->
  methods =
    defaults:
      content: $(".popover")
      padding: 5
      flush: false
      fixed: true
      close_on_scroll: false
      scroll_target: $(document)
      scroll_threshold: 5
      close_on_click: "anywhere"
      restrict_close_click: null
      reposition_on_resize: false
      tooltip: false
      arrow_height: 12
      arrow_offset: 35
      arrow_position: null
      position_top: null
      position_left: null
      outter_height: null
      outter_width: null
      afterOpen: $.noop
      afterClose: $.noop

    init: (options) ->
      options = $.extend({}, methods.defaults, options)
      options.tooltipHeight = 0
      options.tooltipWidth = 0
      $(this).popover "_get_width_height", options
      $(this).popover "_get_center_position", options
      options.arrow_position = $(this).popover("_positionArrow", options)  unless options.arrow_position
      $(this).popover "_init_class_styles", options
      options.tooltipHeight = options.content.outerHeight()
      options.tooltipWidth = options.content.outerWidth()

      $(this).popover "_position_popover", options
      options.content.css(
        left: options.position_left + "px"
        top: options.position_top + "px"
        display: "none"
        visibility: "visible"
      ).show()
      options.afterOpen.apply this, [options.content]
      $(this).popover "_setupEvents", options

    close: (options) ->
      $(".active.popover_target").removeClass "active popover_target"
      options = $.extend({}, methods.defaults, options)
      options.content = this  unless $(options.content).length
      $(options.content).removeClass("popover_container topleft bottomleft topright bottomright tooltip flush").attr("style", "").hide()
      $(this).popover "_destroyEvents", options
      options.afterClose.apply this, [options.content]

    _get_center_position: (options) ->
      
      # POSITION CENTER OF ELEMENT
      if options.position_left is null
        options.position_left = $(this).offset().left + (options.outter_width / 2)
      else
        options.position_left += (options.outter_width / 2)
      if options.position_top is null
        options.position_top = $(this).offset().top + (options.outter_height / 2)
      else
        options.position_top += (options.outter_height / 2)

    _get_width_height: (options) ->
      
      # GET HEIGHT & WIDTH
      options.outter_height = (if ($(this).outerHeight() is 0) then $(this).attr("height") else $(this).outerHeight())  if options.outter_height is null
      options.outter_width = (if ($(this).outerWidth() is 0) then $(this).attr("width") else $(this).outerWidth())  if options.outter_width is null

    _destroyEvents: (options) ->
      $(document).unbind "click.popover"
      $(document).unbind "scroll.popover"
      $(document).unbind "resize.popover"

    _setupEvents: (options) ->
      _this = $(this)
      click = 0
      if options.reposition_on_resize
        $(window).bind "resize.popover", ->
          $(this).popover "reposition_popover", options

      $(document).unbind("click.popover").bind "click.popover", (event) ->
        click++
        if click > 1
          container = $(".popover_container")
          switch options.close_on_click
            when "anywhere"
              if !!options.restrict_close_click
                $(this).popover "close", options  if $.inArray(event.target, options.restrict_close_click)
              else
                $(this).popover "close", options
            when "outside"
              if !!options.restrict_close_click
                $(this).popover "close", options  if not container.is(event.target) and container.has(event.target).length is 0 and $.inArray(event.target, options.restrict_close_click)
              else
                $(this).popover "close", options  if not container.is(event.target) and container.has(event.target).length is 0
{'fraction_non_alphanumeric': 0.12266187050359713, 'fraction_numerical': 0.0057553956834532375, 'mean_word_length': 2.7453973955994613, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '6885965', 'n_tokens_mistral': 2450, 'n_tokens_neox': 2370, 'n_words': 548}