PageSourceSearch

https://real-truth-seekers.com/core/views/418c78b86e/js/bootstrap-lib.js

js real-truth-seekers.com collected 2026-10-07 04:00:00 UTC 17,097 bytes, 535 lines download raw bytes

1/*!
2 * Bootstrap v3.3.5 (http://getbootstrap.com)
3 * Copyright 2011-2015 Twitter, Inc.
4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 */
6
7/*!
8 * Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=f42795a614bed55a295a)
9 * Config saved to config.json and https://gist.github.com/f42795a614bed55a295a
10 */
11if (typeof jQuery === 'undefined') {
12  throw new Error('Bootstrap\'s JavaScript requires jQuery')
13}
14+function ($) {
15  'use strict';
16  var version = $.fn.jquery.split(' ')[0].split('.')
17  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) {
18    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher')
19  }
vendor: 16,357 bytes, lines 19-535
19
20}(jQuery);
21
22/* ========================================================================
23 * Bootstrap: tooltip.js v3.3.5
24 * http://getbootstrap.com/javascript/#tooltip
25 * Inspired by the original jQuery.tipsy by Jason Frame
26 * ========================================================================
27 * Copyright 2011-2015 Twitter, Inc.
28 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
29 * ======================================================================== */
30
31
32+function ($) {
33  'use strict';
34
35  // TOOLTIP PUBLIC CLASS DEFINITION
36  // ===============================
37
38  var Tooltip = function (element, options) {
39    this.type       = null
40    this.options    = null
41    this.enabled    = null
42    this.timeout    = null
43    this.hoverState = null
44    this.$element   = null
45    this.inState    = null
46
47    this.init('tooltip', element, options)
48  }
49
50  Tooltip.VERSION  = '3.3.5'
51
52  Tooltip.TRANSITION_DURATION = 150
53
54  Tooltip.DEFAULTS = {
55    animation: true,
56    placement: 'top',
57    selector: false,
58    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
59    trigger: 'hover focus',
60    title: '',
61    delay: 0,
62    html: false,
63    container: false,
64    viewport: {
65      selector: 'body',
66      padding: 0
67    }
68  }
69
70  Tooltip.prototype.init = function (type, element, options) {
71    this.enabled   = true
72    this.type      = type
73    this.$element  = $(element)
74    this.options   = this.getOptions(options)
75    this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
76    this.inState   = { click: false, hover: false, focus: false }
77
78    if (this.$element[0] instanceof document.constructor && !this.options.selector) {
79      throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
80    }
81
82    var triggers = this.options.trigger.split(' ')
83
84    for (var i = triggers.length; i--;) {
85      var trigger = triggers[i]
86
87      if (trigger == 'click') {
88        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
89      } else if (trigger != 'manual') {
90        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
91        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
92
93        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
94        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
95      }
96    }
97
98    this.options.selector ?
99      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
100      this.fixTitle()
101  }
102
103  Tooltip.prototype.getDefaults = function () {
104    return Tooltip.DEFAULTS
105  }
106
107  Tooltip.prototype.getOptions = function (options) {
108    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
109
110    if (options.delay && typeof options.delay == 'number') {
111      options.delay = {
112        show: options.delay,
113        hide: options.delay
114      }
115    }
116
117    return options
118  }
119
120  Tooltip.prototype.getDelegateOptions = function () {
121    var options  = {}
122    var defaults = this.getDefaults()
123
124    this._options && $.each(this._options, function (key, value) {
125      if (defaults[key] != value) options[key] = value
126    })
127
128    return options
129  }
130
131  Tooltip.prototype.enter = function (obj) {
132    var self = obj instanceof this.constructor ?
133      obj : $(obj.currentTarget).data('bs.' + this.type)
134
135    if (!self) {
136      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
137      $(obj.currentTarget).data('bs.' + this.type, self)
138    }
139
140    if (obj instanceof $.Event) {
141      self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
142    }
143
144    if (self.tip().hasClass('in') || self.hoverState == 'in') {
145      self.hoverState = 'in'
146      return
147    }
148
149    clearTimeout(self.timeout)
150
151    self.hoverState = 'in'
152
153    if (!self.options.delay || !self.options.delay.show) return self.show()
154
155    self.timeout = setTimeout(function () {
156      if (self.hoverState == 'in') self.show()
157    }, self.options.delay.show)
158  }
159
160  Tooltip.prototype.isInStateTrue = function () {
161    for (var key in this.inState) {
162      if (this.inState[key]) return true
163    }
164
165    return false
166  }
167
168  Tooltip.prototype.leave = function (obj) {
169    var self = obj instanceof this.constructor ?
170      obj : $(obj.currentTarget).data('bs.' + this.type)
171
172    if (!self) {
173      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
174      $(obj.currentTarget).data('bs.' + this.type, self)
175    }
176
177    if (obj instanceof $.Event) {
178      self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
179    }
180
181    if (self.isInStateTrue()) return
182
183    clearTimeout(self.timeout)
184
185    self.hoverState = 'out'
186
187    if (!self.options.delay || !self.options.delay.hide) return self.hide()
188
189    self.timeout = setTimeout(function () {
190      if (self.hoverState == 'out') self.hide()
191    }, self.options.delay.hide)
192  }
193
194  Tooltip.prototype.show = function () {
195    var e = $.Event('show.bs.' + this.type)
196
197    if (this.hasContent() && this.enabled) {
198      this.$element.trigger(e)
199
200      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
201      if (e.isDefaultPrevented() || !inDom) return
202      var that = this
203
204      var $tip = this.tip()
205
206      var tipId = this.getUID(this.type)
207
208      this.setContent()
209      $tip.attr('id', tipId)
210      this.$element.attr('aria-describedby', tipId)
211
212      if (this.options.animation) $tip.addClass('fade')
213
214      var placement = typeof this.options.placement == 'function' ?
215        this.options.placement.call(this, $tip[0], this.$element[0]) :
216        this.options.placement
217
218      var autoToken = /\s?auto?\s?/i
219      var autoPlace = autoToken.test(placement)
220      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
221
222      $tip
223        .detach()
224        .css({ top: 0, left: 0, display: 'block' })
225        .addClass(placement)
226        .data('bs.' + this.type, this)
227
228      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
229      this.$element.trigger('inserted.bs.' + this.type)
230
231      var pos          = this.getPosition()
232      var actualWidth  = $tip[0].offsetWidth
233      var actualHeight = $tip[0].offsetHeight
234
235      if (autoPlace) {
236        var orgPlacement = placement
237        var viewportDim = this.getPosition(this.$viewport)
238
239        placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :
240                    placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :
241                    placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :
242                    placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :
243                    placement
244
245        $tip
246          .removeClass(orgPlacement)
247          .addClass(placement)
248      }
249
250      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
251
252      this.applyPlacement(calculatedOffset, placement)
253
254      var complete = function () {
255        var prevHoverState = that.hoverState
256        that.$element.trigger('shown.bs.' + that.type)
257        that.hoverState = null
258
259        if (prevHoverState == 'out') that.leave(that)
260      }
261
262      $.support.transition && this.$tip.hasClass('fade') ?
263        $tip
264          .one('bsTransitionEnd', complete)
265          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
266        complete()
267    }
268  }
269
270  Tooltip.prototype.applyPlacement = function (offset, placement) {
271    var $tip   = this.tip()
272    var width  = $tip[0].offsetWidth
273    var height = $tip[0].offsetHeight
274
275    // manually read margins because getBoundingClientRect includes difference
276    var marginTop = parseInt($tip.css('margin-top'), 10)
277    var marginLeft = parseInt($tip.css('margin-left'), 10)
278
279    // we must check for NaN for ie 8/9
280    if (isNaN(marginTop))  marginTop  = 0
281    if (isNaN(marginLeft)) marginLeft = 0
282
283    offset.top  += marginTop
284    offset.left += marginLeft
285
286    // $.fn.offset doesn't round pixel values
287    // so we use setOffset directly with our own function B-0
288    $.offset.setOffset($tip[0], $.extend({
289      using: function (props) {
290        $tip.css({
291          top: Math.round(props.top),
292          left: Math.round(props.left)
293        })
294      }
295    }, offset), 0)
296
297    $tip.addClass('in')
298
299    // check to see if placing tip in new offset caused the tip to resize itself
300    var actualWidth  = $tip[0].offsetWidth
301    var actualHeight = $tip[0].offsetHeight
302
303    if (placement == 'top' && actualHeight != height) {
304      offset.top = offset.top + height - actualHeight
305    }
306
307    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
308
309    if (delta.left) offset.left += delta.left
310    else offset.top += delta.top
311
312    var isVertical          = /top|bottom/.test(placement)
313    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
314    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
315
316    $tip.offset(offset)
317    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
318  }
319
320  Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
321    this.arrow()
322      .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
323      .css(isVertical ? 'top' : 'left', '')
324  }
325
326  Tooltip.prototype.setContent = function () {
327    var $tip  = this.tip()
328    var title = this.getTitle()
329
330    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
331    $tip.removeClass('fade in top bottom left right')
332  }
333
334  Tooltip.prototype.hide = function (callback) {
335    var that = this
336    var $tip = $(this.$tip)
337    var e    = $.Event('hide.bs.' + this.type)
338
339    function complete() {
340      if (that.hoverState != 'in') $tip.detach()
341      that.$element
342        .removeAttr('aria-describedby')
343        .trigger('hidden.bs.' + that.type)
344      callback && callback()
345    }
346
347    this.$element.trigger(e)
348
349    if (e.isDefaultPrevented()) return
350
351    $tip.removeClass('in')
352
353    $.support.transition && $tip.hasClass('fade') ?
354      $tip
355        .one('bsTransitionEnd', complete)
356        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
357      complete()
358
359    this.hoverState = null
360
361    return this
362  }
363
364  Tooltip.prototype.fixTitle = function () {
365    var $e = this.$element
366    if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
367      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
368    }
369  }
370
371  Tooltip.prototype.hasContent = function () {
372    return this.getTitle()
373  }
374
375  Tooltip.prototype.getPosition = function ($element) {
376    $element   = $element || this.$element
377
378    var el     = $element[0]
379    var isBody = el.tagName == 'BODY'
380
381    var elRect    = el.getBoundingClientRect()
382    if (elRect.width == null) {
383      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
384      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
385    }
386    var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()
387    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
388    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
389
390    return $.extend({}, elRect, scroll, outerDims, elOffset)
391  }
392
393  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
394    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :
395           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
396           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
397        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
398
399  }
400
401  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
402    var delta = { top: 0, left: 0 }
403    if (!this.$viewport) return delta
404
405    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
406    var viewportDimensions = this.getPosition(this.$viewport)
407
408    if (/right|left/.test(placement)) {
409      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
410      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
411      if (topEdgeOffset < viewportDimensions.top) { // top overflow
412        delta.top = viewportDimensions.top - topEdgeOffset
413      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
414        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
415      }
416    } else {
417      var leftEdgeOffset  = pos.left - viewportPadding
418      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
419      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
420        delta.left = viewportDimensions.left - leftEdgeOffset
421      } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
422        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
423      }
424    }
425
426    return delta
427  }
428
429  Tooltip.prototype.getTitle = function () {
430    var title
431    var $e = this.$element
432    var o  = this.options
433
434    title = $e.attr('data-original-title')
435      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
436
437    return title
438  }
439
440  Tooltip.prototype.getUID = function (prefix) {
441    do prefix += ~~(Math.random() * 1000000)
442    while (document.getElementById(prefix))
443    return prefix
444  }
445
446  Tooltip.prototype.tip = function () {
447    if (!this.$tip) {
448      this.$tip = $(this.options.template)
449      if (this.$tip.length != 1) {
450        throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
451      }
452    }
453    return this.$tip
454  }
455
456  Tooltip.prototype.arrow = function () {
457    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
458  }
459
460  Tooltip.prototype.enable = function () {
461    this.enabled = true
462  }
463
464  Tooltip.prototype.disable = function () {
465    this.enabled = false
466  }
467
468  Tooltip.prototype.toggleEnabled = function () {
469    this.enabled = !this.enabled
470  }
471
472  Tooltip.prototype.toggle = function (e) {
473    var self = this
474    if (e) {
475      self = $(e.currentTarget).data('bs.' + this.type)
476      if (!self) {
477        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
478        $(e.currentTarget).data('bs.' + this.type, self)
479      }
480    }
481
482    if (e) {
483      self.inState.click = !self.inState.click
484      if (self.isInStateTrue()) self.enter(self)
485      else self.leave(self)
486    } else {
487      self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
488    }
489  }
490
491  Tooltip.prototype.destroy = function () {
492    var that = this
493    clearTimeout(this.timeout)
494    this.hide(function () {
495      that.$element.off('.' + that.type).removeData('bs.' + that.type)
496      if (that.$tip) {
497        that.$tip.detach()
498      }
499      that.$tip = null
500      that.$arrow = null
501      that.$viewport = null
502    })
503  }
504
505
506  // TOOLTIP PLUGIN DEFINITION
507  // =========================
508
509  function Plugin(option) {
510    return this.each(function () {
511      var $this   = $(this)
512      var data    = $this.data('bs.tooltip')
513      var options = typeof option == 'object' && option
514
515      if (!data && /destroy|hide/.test(option)) return
516      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
517      if (typeof option == 'string') data[option]()
518    })
519  }
520
521  var old = $.fn.tooltip
522
523  $.fn.tooltip             = Plugin
524  $.fn.tooltip.Constructor = Tooltip
525
526
527  // TOOLTIP NO CONFLICT
528  // ===================
529
530  $.fn.tooltip.noConflict = function () {
531    $.fn.tooltip = old
532    return this
533  }
534
535}(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.