Blame view

app/bower_components/bootstrap/js/popover.js 3.09 KB
f986e111b   TRUONG   add libs
1
  /* ========================================================================
87c93a029   Dang YoungWorld   add modal
2
   * Bootstrap: popover.js v3.3.7
f986e111b   TRUONG   add libs
3
4
   * http://getbootstrap.com/javascript/#popovers
   * ========================================================================
87c93a029   Dang YoungWorld   add modal
5
6
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
f986e111b   TRUONG   add libs
7
   * ======================================================================== */
87c93a029   Dang YoungWorld   add modal
8
9
  +function ($) {
    'use strict';
f986e111b   TRUONG   add libs
10
11
12
13
14
15
16
17
18
  
    // POPOVER PUBLIC CLASS DEFINITION
    // ===============================
  
    var Popover = function (element, options) {
      this.init('popover', element, options)
    }
  
    if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
87c93a029   Dang YoungWorld   add modal
19
20
21
22
23
24
25
    Popover.VERSION  = '3.3.7'
  
    Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
      placement: 'right',
      trigger: 'click',
      content: '',
      template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
f986e111b   TRUONG   add libs
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    })
  
  
    // NOTE: POPOVER EXTENDS tooltip.js
    // ================================
  
    Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
  
    Popover.prototype.constructor = Popover
  
    Popover.prototype.getDefaults = function () {
      return Popover.DEFAULTS
    }
  
    Popover.prototype.setContent = function () {
      var $tip    = this.tip()
      var title   = this.getTitle()
      var content = this.getContent()
  
      $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
87c93a029   Dang YoungWorld   add modal
46
47
48
      $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
        this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
      ](content)
f986e111b   TRUONG   add libs
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  
      $tip.removeClass('fade top bottom left right in')
  
      // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
      // this manually by checking the contents.
      if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
    }
  
    Popover.prototype.hasContent = function () {
      return this.getTitle() || this.getContent()
    }
  
    Popover.prototype.getContent = function () {
      var $e = this.$element
      var o  = this.options
  
      return $e.attr('data-content')
        || (typeof o.content == 'function' ?
              o.content.call($e[0]) :
              o.content)
    }
  
    Popover.prototype.arrow = function () {
87c93a029   Dang YoungWorld   add modal
72
      return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
f986e111b   TRUONG   add libs
73
74
75
76
77
    }
  
  
    // POPOVER PLUGIN DEFINITION
    // =========================
87c93a029   Dang YoungWorld   add modal
78
    function Plugin(option) {
f986e111b   TRUONG   add libs
79
80
81
82
      return this.each(function () {
        var $this   = $(this)
        var data    = $this.data('bs.popover')
        var options = typeof option == 'object' && option
87c93a029   Dang YoungWorld   add modal
83
        if (!data && /destroy|hide/.test(option)) return
f986e111b   TRUONG   add libs
84
85
86
87
        if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
        if (typeof option == 'string') data[option]()
      })
    }
87c93a029   Dang YoungWorld   add modal
88
89
90
    var old = $.fn.popover
  
    $.fn.popover             = Plugin
f986e111b   TRUONG   add libs
91
92
93
94
95
96
97
98
99
100
101
102
    $.fn.popover.Constructor = Popover
  
  
    // POPOVER NO CONFLICT
    // ===================
  
    $.fn.popover.noConflict = function () {
      $.fn.popover = old
      return this
    }
  
  }(jQuery);