PageSourceSearch

https://mastersmetall.ru/bitrix/templates/aspro_max_copy_copy_copy_copy_copy/js/lite.bootstrap.js

js mastersmetall.ru collected 2026-10-06 16:15:54 UTC 19,575 bytes, 678 lines download raw bytes

vendor: 19,575 bytes, lines 1-678
1+function ($) { "use strict";
2
3  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
4  // ============================================================
5
6  function transitionEnd() {
7    var el = document.createElement('bootstrap')
8
9    var transEndEventNames = {
10      'WebkitTransition' : 'webkitTransitionEnd'
11    , 'MozTransition'    : 'transitionend'
12    , 'OTransition'      : 'oTransitionEnd otransitionend'
13    , 'transition'       : 'transitionend'
14    }
15
16    for (var name in transEndEventNames) {
17      if (el.style[name] !== undefined) {
18        return { end: transEndEventNames[name] }
19      }
20    }
21  }
22
23  // http://blog.alexmaccaw.com/css-transitions
24  $.fn.emulateTransitionEnd = function (duration) {
25    var called = false, $el = this
26    $(this).one($.support.transition.end, function () { called = true })
27    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
28    setTimeout(callback, duration)
29    return this
30  }
31
32  $(function () {
33    $.support.transition = transitionEnd()
34  })
35
36}(window.jQuery);
37
38+function ($) { "use strict";
39
40  // TOOLTIP PUBLIC CLASS DEFINITION
41  // ===============================
42
43  var Tooltip = function (element, options) {
44    this.type       =
45    this.options    =
46    this.enabled    =
47    this.timeout    =
48    this.hoverState =
49    this.$element   = null
50
51    this.init('tooltip', element, options)
52  }
53
54  Tooltip.DEFAULTS = {
55    animation: true
56  , placement: 'top'
57  , selector: false
58  , template: '<div class="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  }
65
66  Tooltip.prototype.init = function (type, element, options) {
67    this.enabled  = true
68    this.type     = type
69    this.$element = $(element)
70    this.options  = this.getOptions(options)
71
72    var triggers = this.options.trigger.split(' ')
73
74    for (var i = triggers.length; i--;) {
75      var trigger = triggers[i]
76
77      if (trigger == 'click') {
78        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
79      } else if (trigger != 'manual') {
80        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focus'
81        var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
82
83        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
84        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
85      }
86    }
87
88    this.options.selector ?
89      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
90      this.fixTitle()
91  }
92
93  Tooltip.prototype.getDefaults = function () {
94    return Tooltip.DEFAULTS
95  }
96
97  Tooltip.prototype.getOptions = function (options) {
98    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
99
100    if (options.delay && typeof options.delay == 'number') {
101      options.delay = {
102        show: options.delay
103      , hide: options.delay
104      }
105    }
106
107    return options
108  }
109
110  Tooltip.prototype.getDelegateOptions = function () {
111    var options  = {}
112    var defaults = this.getDefaults()
113
114    this._options && $.each(this._options, function (key, value) {
115      if (defaults[key] != value) options[key] = value
116    })
117
118    return options
119  }
120
121  Tooltip.prototype.enter = function (obj) {
122    var self = obj instanceof this.constructor ?
123      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
124
125    clearTimeout(self.timeout)
126
127    self.hoverState = 'in'
128
129    if (!self.options.delay || !self.options.delay.show) return self.show()
130
131    self.timeout = setTimeout(function () {
132      if (self.hoverState == 'in') self.show()
133    }, self.options.delay.show)
134  }
135
136  Tooltip.prototype.leave = function (obj) {
137    var self = obj instanceof this.constructor ?
138      obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
139
140    clearTimeout(self.timeout)
141
142    self.hoverState = 'out'
143
144    if (!self.options.delay || !self.options.delay.hide) return self.hide()
145
146    self.timeout = setTimeout(function () {
147      if (self.hoverState == 'out') self.hide()
148    }, self.options.delay.hide)
149  }
150
151  Tooltip.prototype.show = function () {
152    var e = $.Event('show.bs.'+ this.type)
153
154    if (this.hasContent() && this.enabled) {
155      this.$element.trigger(e)
156
157      if (e.isDefaultPrevented()) return
158
159      var $tip = this.tip()
160
161      this.setContent()
162
163      if (this.options.animation) $tip.addClass('fade')
164
165      var placement = typeof this.options.placement == 'function' ?
166        this.options.placement.call(this, $tip[0], this.$element[0]) :
167        this.options.placement
168
169      var autoToken = /\s?auto?\s?/i
170      var autoPlace = autoToken.test(placement)
171      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
172
173      $tip
174        .detach()
175        .css({ top: 0, left: 0, display: 'block' })
176        .addClass(placement)
177
178      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
179
180      var pos          = this.getPosition()
181      var actualWidth  = $tip[0].offsetWidth
182      var actualHeight = $tip[0].offsetHeight
183
184      if (autoPlace) {
185        var $parent = this.$element.parent()
186
187        var orgPlacement = placement
188        var docScroll    = document.documentElement.scrollTop || document.body.scrollTop
189        var parentWidth  = this.options.container == 'body' ? window.innerWidth  : $parent.outerWidth()
190        var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
191        var parentLeft   = this.options.container == 'body' ? 0 : $parent.offset().left
192
193        placement = placement == 'bottom' && pos.top   + pos.height  + actualHeight - docScroll > parentHeight  ? 'top'    :
194                    placement == 'top'    && pos.top   - docScroll   - actualHeight < 0                         ? 'bottom' :
195                    placement == 'right'  && pos.right + actualWidth > parentWidth                              ? 'left'   :
196                    placement == 'left'   && pos.left  - actualWidth < parentLeft                               ? 'right'  :
197                    placement
198
199        $tip
200          .removeClass(orgPlacement)
201          .addClass(placement)
202      }
203
204      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
205
206      this.applyPlacement(calculatedOffset, placement)
207      this.$element.trigger('shown.bs.' + this.type)
208    }
209  }
210
211  Tooltip.prototype.applyPlacement = function(offset, placement) {
212    var replace
213    var $tip   = this.tip()
214    var width  = $tip[0].offsetWidth
215    var height = $tip[0].offsetHeight
216
217    // manually read margins because getBoundingClientRect includes difference
218    var marginTop = parseInt($tip.css('margin-top'), 10)
219    var marginLeft = parseInt($tip.css('margin-left'), 10)
220
221    // we must check for NaN for ie 8/9
222    if (isNaN(marginTop))  marginTop  = 0
223    if (isNaN(marginLeft)) marginLeft = 0
224
225    offset.top  = offset.top  + marginTop
226    offset.left = offset.left + marginLeft
227
228    $tip
229      .offset(offset)
230      .addClass('in')
231
232    // check to see if placing tip in new offset caused the tip to resize itself
233    var actualWidth  = $tip[0].offsetWidth
234    var actualHeight = $tip[0].offsetHeight
235
236    if (placement == 'top' && actualHeight != height) {
237      replace = true
238      offset.top = offset.top + height - actualHeight
239    }
240
241    if (/bottom|top/.test(placement)) {
242      var delta = 0
243
244      if (offset.left < 0) {
245        delta       = offset.left * -2
246        offset.left = 0
247
248        $tip.offset(offset)
249
250        actualWidth  = $tip[0].offsetWidth
251        actualHeight = $tip[0].offsetHeight
252      }
253
254      this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
255    } else {
256      this.replaceArrow(actualHeight - height, actualHeight, 'top')
257    }
258
259    if (replace) $tip.offset(offset)
260  }
261
262  Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
263    this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
264  }
265
266  Tooltip.prototype.setContent = function () {
267    var $tip  = this.tip()
268    var title = this.getTitle()
269
270    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
271    $tip.removeClass('fade in top bottom left right')
272  }
273
274  Tooltip.prototype.hide = function () {
275    var that = this
276    var $tip = this.tip()
277    var e    = $.Event('hide.bs.' + this.type)
278
279    function complete() {
280      if (that.hoverState != 'in') $tip.detach()
281    }
282
283    this.$element.trigger(e)
284
285    if (e.isDefaultPrevented()) return
286
287    $tip.removeClass('in')
288
289    $.support.transition && this.$tip.hasClass('fade') ?
290      $tip
291        .one($.support.transition.end, complete)
292        .emulateTransitionEnd(150) :
293      complete()
294
295    this.$element.trigger('hidden.bs.' + this.type)
296
297    return this
298  }
299
300  Tooltip.prototype.fixTitle = function () {
301    var $e = this.$element
302    if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
303      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
304    }
305  }
306
307  Tooltip.prototype.hasContent = function () {
308    return this.getTitle()
309  }
310
311  Tooltip.prototype.getPosition = function () {
312    var el = this.$element[0]
313    return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
314      width: el.offsetWidth
315    , height: el.offsetHeight
316    }, this.$element.offset())
317  }
318
319  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
320    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2  } :
321           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2  } :
322           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
323        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width   }
324  }
325
326  Tooltip.prototype.getTitle = function () {
327    var title
328    var $e = this.$element
329    var o  = this.options
330
331    title = $e.attr('data-original-title')
332      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
333
334    return title
335  }
336
337  Tooltip.prototype.tip = function () {
338    return this.$tip = this.$tip || $(this.options.template)
339  }
340
341  Tooltip.prototype.arrow = function () {
342    return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
343  }
344
345  Tooltip.prototype.validate = function () {
346    if (!this.$element[0].parentNode) {
347      this.hide()
348      this.$element = null
349      this.options  = null
350    }
351  }
352
353  Tooltip.prototype.enable = function () {
354    this.enabled = true
355  }
356
357  Tooltip.prototype.disable = function () {
358    this.enabled = false
359  }
360
361  Tooltip.prototype.toggleEnabled = function () {
362    this.enabled = !this.enabled
363  }
364
365  Tooltip.prototype.toggle = function (e) {
366    var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
367    self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
368  }
369
370  Tooltip.prototype.destroy = function () {
371    this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
372  }
373
374
375  // TOOLTIP PLUGIN DEFINITION
376  // =========================
377
378  var old = $.fn.tooltip
379
380  $.fn.tooltip = function (option) {
381    return this.each(function () {
382      var $this   = $(this)
383      var data    = $this.data('bs.tooltip')
384      var options = typeof option == 'object' && option
385
386      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
387      if (typeof option == 'string') data[option]()
388    })
389  }
390
391  $.fn.tooltip.Constructor = Tooltip
392
393
394  // TOOLTIP NO CONFLICT
395  // ===================
396
397  $.fn.tooltip.noConflict = function () {
398    $.fn.tooltip = old
399    return this
400  }
401
402}(window.jQuery);
403
404+function ($) { "use strict";
405
406  // COLLAPSE PUBLIC CLASS DEFINITION
407  // ================================
408
409  var Collapse = function (element, options) {
410    this.$element      = $(element)
411    this.options       = $.extend({}, Collapse.DEFAULTS, options)
412    this.transitioning = null
413
414    if (this.options.parent) this.$parent = $(this.options.parent)
415    if (this.options.toggle) this.toggle()
416  }
417
418  Collapse.DEFAULTS = {
419    toggle: true
420  }
421
422  Collapse.prototype.dimension = function () {
423    var hasWidth = this.$element.hasClass('width')
424    return hasWidth ? 'width' : 'height'
425  }
426
427  Collapse.prototype.show = function () {
428    if (this.transitioning || this.$element.hasClass('in')) return
429
430    var startEvent = $.Event('show.bs.collapse')
431    this.$element.trigger(startEvent)
432    if (startEvent.isDefaultPrevented()) return
433
434    var actives = this.$parent && this.$parent.find('> .panel > .in')
435
436    if (actives && actives.length) {
437      var hasData = actives.data('bs.collapse')
438      if (hasData && hasData.transitioning) return
439      actives.collapse('hide')
440      hasData || actives.data('bs.collapse', null)
441    }
442
443    var dimension = this.dimension()
444
445    this.$element
446      .removeClass('collapse')
447      .addClass('collapsing')
448      [dimension](0)
449
450    this.transitioning = 1
451
452    var complete = function () {
453      this.$element
454        .removeClass('collapsing')
455        .addClass('in')
456        [dimension]('auto')
457      this.transitioning = 0
458      this.$element.trigger('shown.bs.collapse')
459    }
460
461    if (!$.support.transition) return complete.call(this)
462
463    var scrollSize = $.camelCase(['scroll', dimension].join('-'))
464
465    this.$element
466      .one($.support.transition.end, $.proxy(complete, this))
467      .emulateTransitionEnd(350)
468      [dimension](this.$element[0][scrollSize])
469  }
470
471  Collapse.prototype.hide = function () {
472    if (this.transitioning || !this.$element.hasClass('in')) return
473
474    var startEvent = $.Event('hide.bs.collapse')
475    this.$element.trigger(startEvent)
476    if (startEvent.isDefaultPrevented()) return
477
478    var dimension = this.dimension()
479
480    this.$element
481      [dimension](this.$element[dimension]())
482      [0].offsetHeight
483
484    this.$element
485      .addClass('collapsing')
486      .removeClass('collapse')
487      .removeClass('in')
488
489    this.transitioning = 1
490
491    var complete = function () {
492      this.transitioning = 0
493      this.$element
494        .trigger('hidden.bs.collapse')
495        .removeClass('collapsing')
496        .addClass('collapse')
497    }
498
499    if (!$.support.transition) return complete.call(this)
500
501    this.$element
502      [dimension](0)
503      .one($.support.transition.end, $.proxy(complete, this))
504      .emulateTransitionEnd(350)
505  }
506
507  Collapse.prototype.toggle = function () {
508    this[this.$element.hasClass('in') ? 'hide' : 'show']()
509  }
510
511
512  // COLLAPSE PLUGIN DEFINITION
513  // ==========================
514
515  var old = $.fn.collapse
516
517  $.fn.collapse = function (option) {
518    return this.each(function () {
519      var $this   = $(this)
520      var data    = $this.data('bs.collapse')
521      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
522
523      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
524      if (typeof option == 'string') data[option]()
525    })
526  }
527
528  $.fn.collapse.Constructor = Collapse
529
530
531  // COLLAPSE NO CONFLICT
532  // ====================
533
534  $.fn.collapse.noConflict = function () {
535    $.fn.collapse = old
536    return this
537  }
538
539
540  // COLLAPSE DATA-API
541  // =================
542
543  $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
544    var $this   = $(this), href
545    var target  = $this.attr('data-target')
546        || e.preventDefault()
547        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
548    var $target = $(target)
549    var data    = $target.data('bs.collapse')
550    var option  = data ? 'toggle' : $this.data()
551    var parent  = $this.attr('data-parent')
552    var $parent = parent && $(parent)
553
554    if (!data || !data.transitioning) {
555      if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
556      $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
557    }
558
559    $target.collapse(option)
560  })
561
562}(window.jQuery);
563
564+function ($) { "use strict";
565
566  // TAB CLASS DEFINITION
567  // ====================
568
569  var Tab = function (element) {
570    this.element = $(element)
571  }
572
573  Tab.prototype.show = function () {
574    var $this    = this.element
575    var $ul      = $this.closest('ul:not(.dropdown-menu)')
576    var selector = $this.attr('data-target')
577
578    if (!selector) {
579      selector = $this.attr('href')
580      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
581    }
582
583    if ($this.parent('li').hasClass('active')) return
584
585    var previous = $ul.find('.active:last a')[0]
586    var e        = $.Event('show.bs.tab', {
587      relatedTarget: previous
588    })
589
590    $this.trigger(e)
591
592    if (e.isDefaultPrevented()) return
593
594    var $target = $(selector)
595
596    this.activate($this.parent('li'), $ul)
597    this.activate($target, $target.parent(), function () {
598      $this.trigger({
599        type: 'shown.bs.tab'
600      , relatedTarget: previous
601      })
602    })
603  }
604
605  Tab.prototype.activate = function (element, container, callback) {
606    var $active    = container.find('> .active')
607    var transition = callback
608      && $.support.transition
609      && $active.hasClass('fade')
610
611    function next() {
612      $active
613        .removeClass('active')
614        .find('> .dropdown-menu > .active')
615        .removeClass('active')
616
617      element.addClass('active')
618
619      if (transition) {
620        element[0].offsetWidth // reflow for transition
621        element.addClass('in')
622      } else {
623        element.removeClass('fade')
624      }
625
626      if (element.parent('.dropdown-menu')) {
627        element.closest('li.dropdown').addClass('active')
628      }
629
630      callback && callback()
631    }
632
633    transition ?
634      $active
635        .one($.support.transition.end, next)
636        .emulateTransitionEnd(150) :
637      next()
638
639    $active.removeClass('in')
640  }
641
642
643  // TAB PLUGIN DEFINITION
644  // =====================
645
646  var old = $.fn.tab
647
648  $.fn.tab = function ( option ) {
649    return this.each(function () {
650      var $this = $(this)
651      var data  = $this.data('bs.tab')
652
653      if (!data) $this.data('bs.tab', (data = new Tab(this)))
654      if (typeof option == 'string') data[option]()
655    })
656  }
657
658  $.fn.tab.Constructor = Tab
659
660
661  // TAB NO CONFLICT
662  // ===============
663
664  $.fn.tab.noConflict = function () {
665    $.fn.tab = old
666    return this
667  }
668
669
670  // TAB DATA-API
671  // ============
672
673  $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
674    e.preventDefault()
675    $(this).tab('show')
676  })
677
678}(window.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.