flipper-ui 0.2.0.beta2 → 0.2.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -11
- data/README.md +5 -7
- data/examples/basic.ru +27 -26
- data/flipper-ui.gemspec +5 -3
- data/lib/flipper-ui.rb +1 -0
- data/lib/flipper/ui.rb +11 -2
- data/lib/flipper/ui/action.rb +45 -4
- data/lib/flipper/ui/actions/actors_gate.rb +48 -0
- data/lib/flipper/ui/actions/add_feature.rb +20 -0
- data/lib/flipper/ui/actions/boolean_gate.rb +26 -0
- data/lib/flipper/ui/actions/feature.rb +32 -0
- data/lib/flipper/ui/actions/features.rb +23 -3
- data/lib/flipper/ui/actions/file.rb +1 -1
- data/lib/flipper/ui/actions/gate.rb +11 -117
- data/lib/flipper/ui/actions/groups_gate.rb +43 -0
- data/lib/flipper/ui/actions/{index.rb → home.rb} +3 -3
- data/lib/flipper/ui/actions/percentage_of_actors_gate.rb +27 -0
- data/lib/flipper/ui/actions/percentage_of_time_gate.rb +27 -0
- data/lib/flipper/ui/actor.rb +13 -0
- data/lib/flipper/ui/assets/javascripts/application.coffee +0 -305
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/_bootstrap.scss +50 -0
- data/lib/flipper/ui/assets/stylesheets/application.scss +33 -216
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_badges.scss +68 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_buttons.scss +160 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_carousel.scss +269 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_close.scss +36 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_component-animations.scss +37 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_forms.scss +578 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_glyphicons.scss +305 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_list-group.scss +124 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_media.scss +61 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_navbar.scss +662 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_pagination.scss +88 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_panels.scss +265 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_popovers.scss +135 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_print.scss +107 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_scaffolding.scss +162 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_theme.scss +273 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_tooltip.scss +102 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_type.scss +298 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_variables.scss +866 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/lib/flipper/ui/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/lib/flipper/ui/assets/stylesheets/primer/.scss-lint.yml +446 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_alerts.scss +106 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_avatars.scss +36 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_base.scss +40 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_blankslate.scss +96 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_buttons.scss +404 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_counter.scss +10 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_filter-list.scss +68 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_flex-table.scss +20 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_forms.scss +756 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_layout.scss +69 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_menu.scss +113 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_mixins.scss +53 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_normalize.scss +425 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_states.scss +32 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_tabnav.scss +65 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_tooltips.scss +255 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_truncate.scss +27 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_type.scss +92 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_utility.scss +73 -0
- data/lib/flipper/ui/assets/stylesheets/primer/_variables.scss +34 -0
- data/lib/flipper/ui/assets/stylesheets/primer/primer.scss +39 -0
- data/lib/flipper/ui/decorators/feature.rb +37 -4
- data/lib/flipper/ui/middleware.rb +12 -3
- data/lib/flipper/ui/public/css/application.css +2563 -144
- data/lib/flipper/ui/public/css/primer.css +1 -0
- data/lib/flipper/ui/public/css/primer/primer.css +1933 -0
- data/lib/flipper/ui/public/css/scss/primer.css +1933 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/lib/flipper/ui/public/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/lib/flipper/ui/public/js/application.js +0 -539
- data/lib/flipper/ui/public/js/bootstrap-sprockets.js +12 -0
- data/lib/flipper/ui/public/js/bootstrap.js +2317 -0
- data/lib/flipper/ui/public/js/bootstrap.min.js +7 -0
- data/lib/flipper/ui/public/js/bootstrap/affix.js +162 -0
- data/lib/flipper/ui/public/js/bootstrap/alert.js +94 -0
- data/lib/flipper/ui/public/js/bootstrap/button.js +116 -0
- data/lib/flipper/ui/public/js/bootstrap/carousel.js +237 -0
- data/lib/flipper/ui/public/js/bootstrap/collapse.js +211 -0
- data/lib/flipper/ui/public/js/bootstrap/dropdown.js +161 -0
- data/lib/flipper/ui/public/js/bootstrap/modal.js +339 -0
- data/lib/flipper/ui/public/js/bootstrap/popover.js +108 -0
- data/lib/flipper/ui/public/js/bootstrap/scrollspy.js +172 -0
- data/lib/flipper/ui/public/js/bootstrap/tab.js +153 -0
- data/lib/flipper/ui/public/js/bootstrap/tooltip.js +476 -0
- data/lib/flipper/ui/public/js/bootstrap/transition.js +59 -0
- data/lib/flipper/ui/public/octicons/LICENSE.txt +9 -0
- data/lib/flipper/ui/public/octicons/README.md +1 -0
- data/lib/flipper/ui/public/octicons/octicons-local.ttf +0 -0
- data/lib/flipper/ui/public/octicons/octicons.css +236 -0
- data/lib/flipper/ui/public/octicons/octicons.eot +0 -0
- data/lib/flipper/ui/public/octicons/octicons.less +235 -0
- data/lib/flipper/ui/public/octicons/octicons.svg +200 -0
- data/lib/flipper/ui/public/octicons/octicons.ttf +0 -0
- data/lib/flipper/ui/public/octicons/octicons.woff +0 -0
- data/lib/flipper/ui/public/octicons/sprockets-octicons.scss +232 -0
- data/lib/flipper/ui/util.rb +4 -0
- data/lib/flipper/ui/version.rb +1 -1
- data/lib/flipper/ui/views/add_actor.erb +22 -0
- data/lib/flipper/ui/views/add_feature.erb +18 -0
- data/lib/flipper/ui/views/add_group.erb +31 -0
- data/lib/flipper/ui/views/feature.erb +209 -0
- data/lib/flipper/ui/views/features.erb +46 -0
- data/lib/flipper/ui/views/layout.erb +31 -149
- data/script/release +15 -0
- data/spec/flipper/ui/actions/actors_gate_spec.rb +68 -0
- data/spec/flipper/ui/actions/add_feature_spec.rb +17 -0
- data/spec/flipper/ui/actions/boolean_gate_spec.rb +41 -0
- data/spec/flipper/ui/actions/feature_spec.rb +59 -0
- data/spec/flipper/ui/actions/features_spec.rb +37 -0
- data/spec/flipper/ui/actions/file_spec.rb +43 -0
- data/spec/flipper/ui/actions/gate_spec.rb +24 -0
- data/spec/flipper/ui/actions/groups_gate_spec.rb +80 -0
- data/spec/flipper/ui/actions/home_spec.rb +16 -0
- data/spec/flipper/ui/actions/percentage_of_actors_gate_spec.rb +40 -0
- data/spec/flipper/ui/actions/percentage_of_time_gate_spec.rb +39 -0
- data/spec/flipper/ui/decorators/feature_spec.rb +38 -1
- data/spec/flipper/ui/decorators/gate_spec.rb +1 -1
- data/spec/flipper/ui_spec.rb +18 -441
- data/spec/helper.rb +22 -7
- metadata +199 -52
- data/examples/flipper.html +0 -14
- data/examples/flipper.png +0 -0
- data/lib/flipper/ui/assets/javascripts/spine/ajax.coffee +0 -223
- data/lib/flipper/ui/assets/javascripts/spine/list.coffee +0 -43
- data/lib/flipper/ui/assets/javascripts/spine/local.coffee +0 -16
- data/lib/flipper/ui/assets/javascripts/spine/manager.coffee +0 -83
- data/lib/flipper/ui/assets/javascripts/spine/relation.coffee +0 -148
- data/lib/flipper/ui/assets/javascripts/spine/route.coffee +0 -146
- data/lib/flipper/ui/assets/javascripts/spine/spine.coffee +0 -542
- data/lib/flipper/ui/assets/javascripts/spine/version +0 -1
- data/lib/flipper/ui/public/css/images/animated-overlay.gif +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/lib/flipper/ui/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/flipper/ui/public/css/jquery-ui-1.10.3.slider.min.css +0 -5
- data/lib/flipper/ui/public/js/handlebars.js +0 -1992
- data/lib/flipper/ui/public/js/jquery-ui-1.10.3.slider.min.js +0 -6
- data/lib/flipper/ui/public/js/jquery.js +0 -9555
- data/lib/flipper/ui/public/js/jquery.min.js +0 -4
- data/lib/flipper/ui/public/js/jquery.min.map +0 -1
- data/lib/flipper/ui/public/js/spine/ajax.js +0 -320
- data/lib/flipper/ui/public/js/spine/list.js +0 -72
- data/lib/flipper/ui/public/js/spine/local.js +0 -29
- data/lib/flipper/ui/public/js/spine/manager.js +0 -157
- data/lib/flipper/ui/public/js/spine/relation.js +0 -260
- data/lib/flipper/ui/public/js/spine/route.js +0 -223
- data/lib/flipper/ui/public/js/spine/spine.js +0 -927
- data/lib/flipper/ui/views/index.erb +0 -9
@@ -0,0 +1,108 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: popover.js v3.3.4
|
3
|
+
* http://getbootstrap.com/javascript/#popovers
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2015 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// POPOVER PUBLIC CLASS DEFINITION
|
14
|
+
// ===============================
|
15
|
+
|
16
|
+
var Popover = function (element, options) {
|
17
|
+
this.init('popover', element, options)
|
18
|
+
}
|
19
|
+
|
20
|
+
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
21
|
+
|
22
|
+
Popover.VERSION = '3.3.4'
|
23
|
+
|
24
|
+
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
25
|
+
placement: 'right',
|
26
|
+
trigger: 'click',
|
27
|
+
content: '',
|
28
|
+
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
29
|
+
})
|
30
|
+
|
31
|
+
|
32
|
+
// NOTE: POPOVER EXTENDS tooltip.js
|
33
|
+
// ================================
|
34
|
+
|
35
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
|
36
|
+
|
37
|
+
Popover.prototype.constructor = Popover
|
38
|
+
|
39
|
+
Popover.prototype.getDefaults = function () {
|
40
|
+
return Popover.DEFAULTS
|
41
|
+
}
|
42
|
+
|
43
|
+
Popover.prototype.setContent = function () {
|
44
|
+
var $tip = this.tip()
|
45
|
+
var title = this.getTitle()
|
46
|
+
var content = this.getContent()
|
47
|
+
|
48
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
49
|
+
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
|
50
|
+
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
|
51
|
+
](content)
|
52
|
+
|
53
|
+
$tip.removeClass('fade top bottom left right in')
|
54
|
+
|
55
|
+
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
56
|
+
// this manually by checking the contents.
|
57
|
+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
|
58
|
+
}
|
59
|
+
|
60
|
+
Popover.prototype.hasContent = function () {
|
61
|
+
return this.getTitle() || this.getContent()
|
62
|
+
}
|
63
|
+
|
64
|
+
Popover.prototype.getContent = function () {
|
65
|
+
var $e = this.$element
|
66
|
+
var o = this.options
|
67
|
+
|
68
|
+
return $e.attr('data-content')
|
69
|
+
|| (typeof o.content == 'function' ?
|
70
|
+
o.content.call($e[0]) :
|
71
|
+
o.content)
|
72
|
+
}
|
73
|
+
|
74
|
+
Popover.prototype.arrow = function () {
|
75
|
+
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
// POPOVER PLUGIN DEFINITION
|
80
|
+
// =========================
|
81
|
+
|
82
|
+
function Plugin(option) {
|
83
|
+
return this.each(function () {
|
84
|
+
var $this = $(this)
|
85
|
+
var data = $this.data('bs.popover')
|
86
|
+
var options = typeof option == 'object' && option
|
87
|
+
|
88
|
+
if (!data && /destroy|hide/.test(option)) return
|
89
|
+
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
|
90
|
+
if (typeof option == 'string') data[option]()
|
91
|
+
})
|
92
|
+
}
|
93
|
+
|
94
|
+
var old = $.fn.popover
|
95
|
+
|
96
|
+
$.fn.popover = Plugin
|
97
|
+
$.fn.popover.Constructor = Popover
|
98
|
+
|
99
|
+
|
100
|
+
// POPOVER NO CONFLICT
|
101
|
+
// ===================
|
102
|
+
|
103
|
+
$.fn.popover.noConflict = function () {
|
104
|
+
$.fn.popover = old
|
105
|
+
return this
|
106
|
+
}
|
107
|
+
|
108
|
+
}(jQuery);
|
@@ -0,0 +1,172 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: scrollspy.js v3.3.4
|
3
|
+
* http://getbootstrap.com/javascript/#scrollspy
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2015 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// SCROLLSPY CLASS DEFINITION
|
14
|
+
// ==========================
|
15
|
+
|
16
|
+
function ScrollSpy(element, options) {
|
17
|
+
this.$body = $(document.body)
|
18
|
+
this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
|
19
|
+
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
20
|
+
this.selector = (this.options.target || '') + ' .nav li > a'
|
21
|
+
this.offsets = []
|
22
|
+
this.targets = []
|
23
|
+
this.activeTarget = null
|
24
|
+
this.scrollHeight = 0
|
25
|
+
|
26
|
+
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
|
27
|
+
this.refresh()
|
28
|
+
this.process()
|
29
|
+
}
|
30
|
+
|
31
|
+
ScrollSpy.VERSION = '3.3.4'
|
32
|
+
|
33
|
+
ScrollSpy.DEFAULTS = {
|
34
|
+
offset: 10
|
35
|
+
}
|
36
|
+
|
37
|
+
ScrollSpy.prototype.getScrollHeight = function () {
|
38
|
+
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
|
39
|
+
}
|
40
|
+
|
41
|
+
ScrollSpy.prototype.refresh = function () {
|
42
|
+
var that = this
|
43
|
+
var offsetMethod = 'offset'
|
44
|
+
var offsetBase = 0
|
45
|
+
|
46
|
+
this.offsets = []
|
47
|
+
this.targets = []
|
48
|
+
this.scrollHeight = this.getScrollHeight()
|
49
|
+
|
50
|
+
if (!$.isWindow(this.$scrollElement[0])) {
|
51
|
+
offsetMethod = 'position'
|
52
|
+
offsetBase = this.$scrollElement.scrollTop()
|
53
|
+
}
|
54
|
+
|
55
|
+
this.$body
|
56
|
+
.find(this.selector)
|
57
|
+
.map(function () {
|
58
|
+
var $el = $(this)
|
59
|
+
var href = $el.data('target') || $el.attr('href')
|
60
|
+
var $href = /^#./.test(href) && $(href)
|
61
|
+
|
62
|
+
return ($href
|
63
|
+
&& $href.length
|
64
|
+
&& $href.is(':visible')
|
65
|
+
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
|
66
|
+
})
|
67
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
68
|
+
.each(function () {
|
69
|
+
that.offsets.push(this[0])
|
70
|
+
that.targets.push(this[1])
|
71
|
+
})
|
72
|
+
}
|
73
|
+
|
74
|
+
ScrollSpy.prototype.process = function () {
|
75
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
76
|
+
var scrollHeight = this.getScrollHeight()
|
77
|
+
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
|
78
|
+
var offsets = this.offsets
|
79
|
+
var targets = this.targets
|
80
|
+
var activeTarget = this.activeTarget
|
81
|
+
var i
|
82
|
+
|
83
|
+
if (this.scrollHeight != scrollHeight) {
|
84
|
+
this.refresh()
|
85
|
+
}
|
86
|
+
|
87
|
+
if (scrollTop >= maxScroll) {
|
88
|
+
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
|
89
|
+
}
|
90
|
+
|
91
|
+
if (activeTarget && scrollTop < offsets[0]) {
|
92
|
+
this.activeTarget = null
|
93
|
+
return this.clear()
|
94
|
+
}
|
95
|
+
|
96
|
+
for (i = offsets.length; i--;) {
|
97
|
+
activeTarget != targets[i]
|
98
|
+
&& scrollTop >= offsets[i]
|
99
|
+
&& (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
|
100
|
+
&& this.activate(targets[i])
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
ScrollSpy.prototype.activate = function (target) {
|
105
|
+
this.activeTarget = target
|
106
|
+
|
107
|
+
this.clear()
|
108
|
+
|
109
|
+
var selector = this.selector +
|
110
|
+
'[data-target="' + target + '"],' +
|
111
|
+
this.selector + '[href="' + target + '"]'
|
112
|
+
|
113
|
+
var active = $(selector)
|
114
|
+
.parents('li')
|
115
|
+
.addClass('active')
|
116
|
+
|
117
|
+
if (active.parent('.dropdown-menu').length) {
|
118
|
+
active = active
|
119
|
+
.closest('li.dropdown')
|
120
|
+
.addClass('active')
|
121
|
+
}
|
122
|
+
|
123
|
+
active.trigger('activate.bs.scrollspy')
|
124
|
+
}
|
125
|
+
|
126
|
+
ScrollSpy.prototype.clear = function () {
|
127
|
+
$(this.selector)
|
128
|
+
.parentsUntil(this.options.target, '.active')
|
129
|
+
.removeClass('active')
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
// SCROLLSPY PLUGIN DEFINITION
|
134
|
+
// ===========================
|
135
|
+
|
136
|
+
function Plugin(option) {
|
137
|
+
return this.each(function () {
|
138
|
+
var $this = $(this)
|
139
|
+
var data = $this.data('bs.scrollspy')
|
140
|
+
var options = typeof option == 'object' && option
|
141
|
+
|
142
|
+
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
|
143
|
+
if (typeof option == 'string') data[option]()
|
144
|
+
})
|
145
|
+
}
|
146
|
+
|
147
|
+
var old = $.fn.scrollspy
|
148
|
+
|
149
|
+
$.fn.scrollspy = Plugin
|
150
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
151
|
+
|
152
|
+
|
153
|
+
// SCROLLSPY NO CONFLICT
|
154
|
+
// =====================
|
155
|
+
|
156
|
+
$.fn.scrollspy.noConflict = function () {
|
157
|
+
$.fn.scrollspy = old
|
158
|
+
return this
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
// SCROLLSPY DATA-API
|
163
|
+
// ==================
|
164
|
+
|
165
|
+
$(window).on('load.bs.scrollspy.data-api', function () {
|
166
|
+
$('[data-spy="scroll"]').each(function () {
|
167
|
+
var $spy = $(this)
|
168
|
+
Plugin.call($spy, $spy.data())
|
169
|
+
})
|
170
|
+
})
|
171
|
+
|
172
|
+
}(jQuery);
|
@@ -0,0 +1,153 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tab.js v3.3.4
|
3
|
+
* http://getbootstrap.com/javascript/#tabs
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2011-2015 Twitter, Inc.
|
6
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
|
+
* ======================================================================== */
|
8
|
+
|
9
|
+
|
10
|
+
+function ($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
// TAB CLASS DEFINITION
|
14
|
+
// ====================
|
15
|
+
|
16
|
+
var Tab = function (element) {
|
17
|
+
this.element = $(element)
|
18
|
+
}
|
19
|
+
|
20
|
+
Tab.VERSION = '3.3.4'
|
21
|
+
|
22
|
+
Tab.TRANSITION_DURATION = 150
|
23
|
+
|
24
|
+
Tab.prototype.show = function () {
|
25
|
+
var $this = this.element
|
26
|
+
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
27
|
+
var selector = $this.data('target')
|
28
|
+
|
29
|
+
if (!selector) {
|
30
|
+
selector = $this.attr('href')
|
31
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
32
|
+
}
|
33
|
+
|
34
|
+
if ($this.parent('li').hasClass('active')) return
|
35
|
+
|
36
|
+
var $previous = $ul.find('.active:last a')
|
37
|
+
var hideEvent = $.Event('hide.bs.tab', {
|
38
|
+
relatedTarget: $this[0]
|
39
|
+
})
|
40
|
+
var showEvent = $.Event('show.bs.tab', {
|
41
|
+
relatedTarget: $previous[0]
|
42
|
+
})
|
43
|
+
|
44
|
+
$previous.trigger(hideEvent)
|
45
|
+
$this.trigger(showEvent)
|
46
|
+
|
47
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
|
48
|
+
|
49
|
+
var $target = $(selector)
|
50
|
+
|
51
|
+
this.activate($this.closest('li'), $ul)
|
52
|
+
this.activate($target, $target.parent(), function () {
|
53
|
+
$previous.trigger({
|
54
|
+
type: 'hidden.bs.tab',
|
55
|
+
relatedTarget: $this[0]
|
56
|
+
})
|
57
|
+
$this.trigger({
|
58
|
+
type: 'shown.bs.tab',
|
59
|
+
relatedTarget: $previous[0]
|
60
|
+
})
|
61
|
+
})
|
62
|
+
}
|
63
|
+
|
64
|
+
Tab.prototype.activate = function (element, container, callback) {
|
65
|
+
var $active = container.find('> .active')
|
66
|
+
var transition = callback
|
67
|
+
&& $.support.transition
|
68
|
+
&& (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
|
69
|
+
|
70
|
+
function next() {
|
71
|
+
$active
|
72
|
+
.removeClass('active')
|
73
|
+
.find('> .dropdown-menu > .active')
|
74
|
+
.removeClass('active')
|
75
|
+
.end()
|
76
|
+
.find('[data-toggle="tab"]')
|
77
|
+
.attr('aria-expanded', false)
|
78
|
+
|
79
|
+
element
|
80
|
+
.addClass('active')
|
81
|
+
.find('[data-toggle="tab"]')
|
82
|
+
.attr('aria-expanded', true)
|
83
|
+
|
84
|
+
if (transition) {
|
85
|
+
element[0].offsetWidth // reflow for transition
|
86
|
+
element.addClass('in')
|
87
|
+
} else {
|
88
|
+
element.removeClass('fade')
|
89
|
+
}
|
90
|
+
|
91
|
+
if (element.parent('.dropdown-menu').length) {
|
92
|
+
element
|
93
|
+
.closest('li.dropdown')
|
94
|
+
.addClass('active')
|
95
|
+
.end()
|
96
|
+
.find('[data-toggle="tab"]')
|
97
|
+
.attr('aria-expanded', true)
|
98
|
+
}
|
99
|
+
|
100
|
+
callback && callback()
|
101
|
+
}
|
102
|
+
|
103
|
+
$active.length && transition ?
|
104
|
+
$active
|
105
|
+
.one('bsTransitionEnd', next)
|
106
|
+
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
|
107
|
+
next()
|
108
|
+
|
109
|
+
$active.removeClass('in')
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
// TAB PLUGIN DEFINITION
|
114
|
+
// =====================
|
115
|
+
|
116
|
+
function Plugin(option) {
|
117
|
+
return this.each(function () {
|
118
|
+
var $this = $(this)
|
119
|
+
var data = $this.data('bs.tab')
|
120
|
+
|
121
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
122
|
+
if (typeof option == 'string') data[option]()
|
123
|
+
})
|
124
|
+
}
|
125
|
+
|
126
|
+
var old = $.fn.tab
|
127
|
+
|
128
|
+
$.fn.tab = Plugin
|
129
|
+
$.fn.tab.Constructor = Tab
|
130
|
+
|
131
|
+
|
132
|
+
// TAB NO CONFLICT
|
133
|
+
// ===============
|
134
|
+
|
135
|
+
$.fn.tab.noConflict = function () {
|
136
|
+
$.fn.tab = old
|
137
|
+
return this
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
// TAB DATA-API
|
142
|
+
// ============
|
143
|
+
|
144
|
+
var clickHandler = function (e) {
|
145
|
+
e.preventDefault()
|
146
|
+
Plugin.call($(this), 'show')
|
147
|
+
}
|
148
|
+
|
149
|
+
$(document)
|
150
|
+
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
|
151
|
+
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
|
152
|
+
|
153
|
+
}(jQuery);
|
@@ -0,0 +1,476 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tooltip.js v3.3.4
|
3
|
+
* http://getbootstrap.com/javascript/#tooltip
|
4
|
+
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
|
+
* ========================================================================
|
6
|
+
* Copyright 2011-2015 Twitter, Inc.
|
7
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
8
|
+
* ======================================================================== */
|
9
|
+
|
10
|
+
|
11
|
+
+function ($) {
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
// TOOLTIP PUBLIC CLASS DEFINITION
|
15
|
+
// ===============================
|
16
|
+
|
17
|
+
var Tooltip = function (element, options) {
|
18
|
+
this.type = null
|
19
|
+
this.options = null
|
20
|
+
this.enabled = null
|
21
|
+
this.timeout = null
|
22
|
+
this.hoverState = null
|
23
|
+
this.$element = null
|
24
|
+
|
25
|
+
this.init('tooltip', element, options)
|
26
|
+
}
|
27
|
+
|
28
|
+
Tooltip.VERSION = '3.3.4'
|
29
|
+
|
30
|
+
Tooltip.TRANSITION_DURATION = 150
|
31
|
+
|
32
|
+
Tooltip.DEFAULTS = {
|
33
|
+
animation: true,
|
34
|
+
placement: 'top',
|
35
|
+
selector: false,
|
36
|
+
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
|
37
|
+
trigger: 'hover focus',
|
38
|
+
title: '',
|
39
|
+
delay: 0,
|
40
|
+
html: false,
|
41
|
+
container: false,
|
42
|
+
viewport: {
|
43
|
+
selector: 'body',
|
44
|
+
padding: 0
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
Tooltip.prototype.init = function (type, element, options) {
|
49
|
+
this.enabled = true
|
50
|
+
this.type = type
|
51
|
+
this.$element = $(element)
|
52
|
+
this.options = this.getOptions(options)
|
53
|
+
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
|
54
|
+
|
55
|
+
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
|
56
|
+
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
|
57
|
+
}
|
58
|
+
|
59
|
+
var triggers = this.options.trigger.split(' ')
|
60
|
+
|
61
|
+
for (var i = triggers.length; i--;) {
|
62
|
+
var trigger = triggers[i]
|
63
|
+
|
64
|
+
if (trigger == 'click') {
|
65
|
+
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
66
|
+
} else if (trigger != 'manual') {
|
67
|
+
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
|
68
|
+
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
|
69
|
+
|
70
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
71
|
+
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
this.options.selector ?
|
76
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
77
|
+
this.fixTitle()
|
78
|
+
}
|
79
|
+
|
80
|
+
Tooltip.prototype.getDefaults = function () {
|
81
|
+
return Tooltip.DEFAULTS
|
82
|
+
}
|
83
|
+
|
84
|
+
Tooltip.prototype.getOptions = function (options) {
|
85
|
+
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
|
86
|
+
|
87
|
+
if (options.delay && typeof options.delay == 'number') {
|
88
|
+
options.delay = {
|
89
|
+
show: options.delay,
|
90
|
+
hide: options.delay
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
return options
|
95
|
+
}
|
96
|
+
|
97
|
+
Tooltip.prototype.getDelegateOptions = function () {
|
98
|
+
var options = {}
|
99
|
+
var defaults = this.getDefaults()
|
100
|
+
|
101
|
+
this._options && $.each(this._options, function (key, value) {
|
102
|
+
if (defaults[key] != value) options[key] = value
|
103
|
+
})
|
104
|
+
|
105
|
+
return options
|
106
|
+
}
|
107
|
+
|
108
|
+
Tooltip.prototype.enter = function (obj) {
|
109
|
+
var self = obj instanceof this.constructor ?
|
110
|
+
obj : $(obj.currentTarget).data('bs.' + this.type)
|
111
|
+
|
112
|
+
if (self && self.$tip && self.$tip.is(':visible')) {
|
113
|
+
self.hoverState = 'in'
|
114
|
+
return
|
115
|
+
}
|
116
|
+
|
117
|
+
if (!self) {
|
118
|
+
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
|
119
|
+
$(obj.currentTarget).data('bs.' + this.type, self)
|
120
|
+
}
|
121
|
+
|
122
|
+
clearTimeout(self.timeout)
|
123
|
+
|
124
|
+
self.hoverState = 'in'
|
125
|
+
|
126
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
127
|
+
|
128
|
+
self.timeout = setTimeout(function () {
|
129
|
+
if (self.hoverState == 'in') self.show()
|
130
|
+
}, self.options.delay.show)
|
131
|
+
}
|
132
|
+
|
133
|
+
Tooltip.prototype.leave = function (obj) {
|
134
|
+
var self = obj instanceof this.constructor ?
|
135
|
+
obj : $(obj.currentTarget).data('bs.' + this.type)
|
136
|
+
|
137
|
+
if (!self) {
|
138
|
+
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
|
139
|
+
$(obj.currentTarget).data('bs.' + this.type, self)
|
140
|
+
}
|
141
|
+
|
142
|
+
clearTimeout(self.timeout)
|
143
|
+
|
144
|
+
self.hoverState = 'out'
|
145
|
+
|
146
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
147
|
+
|
148
|
+
self.timeout = setTimeout(function () {
|
149
|
+
if (self.hoverState == 'out') self.hide()
|
150
|
+
}, self.options.delay.hide)
|
151
|
+
}
|
152
|
+
|
153
|
+
Tooltip.prototype.show = function () {
|
154
|
+
var e = $.Event('show.bs.' + this.type)
|
155
|
+
|
156
|
+
if (this.hasContent() && this.enabled) {
|
157
|
+
this.$element.trigger(e)
|
158
|
+
|
159
|
+
var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
|
160
|
+
if (e.isDefaultPrevented() || !inDom) return
|
161
|
+
var that = this
|
162
|
+
|
163
|
+
var $tip = this.tip()
|
164
|
+
|
165
|
+
var tipId = this.getUID(this.type)
|
166
|
+
|
167
|
+
this.setContent()
|
168
|
+
$tip.attr('id', tipId)
|
169
|
+
this.$element.attr('aria-describedby', tipId)
|
170
|
+
|
171
|
+
if (this.options.animation) $tip.addClass('fade')
|
172
|
+
|
173
|
+
var placement = typeof this.options.placement == 'function' ?
|
174
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
175
|
+
this.options.placement
|
176
|
+
|
177
|
+
var autoToken = /\s?auto?\s?/i
|
178
|
+
var autoPlace = autoToken.test(placement)
|
179
|
+
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
|
180
|
+
|
181
|
+
$tip
|
182
|
+
.detach()
|
183
|
+
.css({ top: 0, left: 0, display: 'block' })
|
184
|
+
.addClass(placement)
|
185
|
+
.data('bs.' + this.type, this)
|
186
|
+
|
187
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
188
|
+
|
189
|
+
var pos = this.getPosition()
|
190
|
+
var actualWidth = $tip[0].offsetWidth
|
191
|
+
var actualHeight = $tip[0].offsetHeight
|
192
|
+
|
193
|
+
if (autoPlace) {
|
194
|
+
var orgPlacement = placement
|
195
|
+
var $container = this.options.container ? $(this.options.container) : this.$element.parent()
|
196
|
+
var containerDim = this.getPosition($container)
|
197
|
+
|
198
|
+
placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
|
199
|
+
placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
|
200
|
+
placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
|
201
|
+
placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
|
202
|
+
placement
|
203
|
+
|
204
|
+
$tip
|
205
|
+
.removeClass(orgPlacement)
|
206
|
+
.addClass(placement)
|
207
|
+
}
|
208
|
+
|
209
|
+
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
210
|
+
|
211
|
+
this.applyPlacement(calculatedOffset, placement)
|
212
|
+
|
213
|
+
var complete = function () {
|
214
|
+
var prevHoverState = that.hoverState
|
215
|
+
that.$element.trigger('shown.bs.' + that.type)
|
216
|
+
that.hoverState = null
|
217
|
+
|
218
|
+
if (prevHoverState == 'out') that.leave(that)
|
219
|
+
}
|
220
|
+
|
221
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
222
|
+
$tip
|
223
|
+
.one('bsTransitionEnd', complete)
|
224
|
+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
|
225
|
+
complete()
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
Tooltip.prototype.applyPlacement = function (offset, placement) {
|
230
|
+
var $tip = this.tip()
|
231
|
+
var width = $tip[0].offsetWidth
|
232
|
+
var height = $tip[0].offsetHeight
|
233
|
+
|
234
|
+
// manually read margins because getBoundingClientRect includes difference
|
235
|
+
var marginTop = parseInt($tip.css('margin-top'), 10)
|
236
|
+
var marginLeft = parseInt($tip.css('margin-left'), 10)
|
237
|
+
|
238
|
+
// we must check for NaN for ie 8/9
|
239
|
+
if (isNaN(marginTop)) marginTop = 0
|
240
|
+
if (isNaN(marginLeft)) marginLeft = 0
|
241
|
+
|
242
|
+
offset.top = offset.top + marginTop
|
243
|
+
offset.left = offset.left + marginLeft
|
244
|
+
|
245
|
+
// $.fn.offset doesn't round pixel values
|
246
|
+
// so we use setOffset directly with our own function B-0
|
247
|
+
$.offset.setOffset($tip[0], $.extend({
|
248
|
+
using: function (props) {
|
249
|
+
$tip.css({
|
250
|
+
top: Math.round(props.top),
|
251
|
+
left: Math.round(props.left)
|
252
|
+
})
|
253
|
+
}
|
254
|
+
}, offset), 0)
|
255
|
+
|
256
|
+
$tip.addClass('in')
|
257
|
+
|
258
|
+
// check to see if placing tip in new offset caused the tip to resize itself
|
259
|
+
var actualWidth = $tip[0].offsetWidth
|
260
|
+
var actualHeight = $tip[0].offsetHeight
|
261
|
+
|
262
|
+
if (placement == 'top' && actualHeight != height) {
|
263
|
+
offset.top = offset.top + height - actualHeight
|
264
|
+
}
|
265
|
+
|
266
|
+
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
|
267
|
+
|
268
|
+
if (delta.left) offset.left += delta.left
|
269
|
+
else offset.top += delta.top
|
270
|
+
|
271
|
+
var isVertical = /top|bottom/.test(placement)
|
272
|
+
var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
|
273
|
+
var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'
|
274
|
+
|
275
|
+
$tip.offset(offset)
|
276
|
+
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
|
277
|
+
}
|
278
|
+
|
279
|
+
Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
|
280
|
+
this.arrow()
|
281
|
+
.css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
|
282
|
+
.css(isVertical ? 'top' : 'left', '')
|
283
|
+
}
|
284
|
+
|
285
|
+
Tooltip.prototype.setContent = function () {
|
286
|
+
var $tip = this.tip()
|
287
|
+
var title = this.getTitle()
|
288
|
+
|
289
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
290
|
+
$tip.removeClass('fade in top bottom left right')
|
291
|
+
}
|
292
|
+
|
293
|
+
Tooltip.prototype.hide = function (callback) {
|
294
|
+
var that = this
|
295
|
+
var $tip = $(this.$tip)
|
296
|
+
var e = $.Event('hide.bs.' + this.type)
|
297
|
+
|
298
|
+
function complete() {
|
299
|
+
if (that.hoverState != 'in') $tip.detach()
|
300
|
+
that.$element
|
301
|
+
.removeAttr('aria-describedby')
|
302
|
+
.trigger('hidden.bs.' + that.type)
|
303
|
+
callback && callback()
|
304
|
+
}
|
305
|
+
|
306
|
+
this.$element.trigger(e)
|
307
|
+
|
308
|
+
if (e.isDefaultPrevented()) return
|
309
|
+
|
310
|
+
$tip.removeClass('in')
|
311
|
+
|
312
|
+
$.support.transition && $tip.hasClass('fade') ?
|
313
|
+
$tip
|
314
|
+
.one('bsTransitionEnd', complete)
|
315
|
+
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
|
316
|
+
complete()
|
317
|
+
|
318
|
+
this.hoverState = null
|
319
|
+
|
320
|
+
return this
|
321
|
+
}
|
322
|
+
|
323
|
+
Tooltip.prototype.fixTitle = function () {
|
324
|
+
var $e = this.$element
|
325
|
+
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
|
326
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
Tooltip.prototype.hasContent = function () {
|
331
|
+
return this.getTitle()
|
332
|
+
}
|
333
|
+
|
334
|
+
Tooltip.prototype.getPosition = function ($element) {
|
335
|
+
$element = $element || this.$element
|
336
|
+
|
337
|
+
var el = $element[0]
|
338
|
+
var isBody = el.tagName == 'BODY'
|
339
|
+
|
340
|
+
var elRect = el.getBoundingClientRect()
|
341
|
+
if (elRect.width == null) {
|
342
|
+
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
|
343
|
+
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
|
344
|
+
}
|
345
|
+
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset()
|
346
|
+
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
|
347
|
+
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
|
348
|
+
|
349
|
+
return $.extend({}, elRect, scroll, outerDims, elOffset)
|
350
|
+
}
|
351
|
+
|
352
|
+
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
|
353
|
+
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
354
|
+
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
|
355
|
+
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
|
356
|
+
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
|
357
|
+
|
358
|
+
}
|
359
|
+
|
360
|
+
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
|
361
|
+
var delta = { top: 0, left: 0 }
|
362
|
+
if (!this.$viewport) return delta
|
363
|
+
|
364
|
+
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
|
365
|
+
var viewportDimensions = this.getPosition(this.$viewport)
|
366
|
+
|
367
|
+
if (/right|left/.test(placement)) {
|
368
|
+
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
|
369
|
+
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
|
370
|
+
if (topEdgeOffset < viewportDimensions.top) { // top overflow
|
371
|
+
delta.top = viewportDimensions.top - topEdgeOffset
|
372
|
+
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
|
373
|
+
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
|
374
|
+
}
|
375
|
+
} else {
|
376
|
+
var leftEdgeOffset = pos.left - viewportPadding
|
377
|
+
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
|
378
|
+
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
|
379
|
+
delta.left = viewportDimensions.left - leftEdgeOffset
|
380
|
+
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
|
381
|
+
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
|
382
|
+
}
|
383
|
+
}
|
384
|
+
|
385
|
+
return delta
|
386
|
+
}
|
387
|
+
|
388
|
+
Tooltip.prototype.getTitle = function () {
|
389
|
+
var title
|
390
|
+
var $e = this.$element
|
391
|
+
var o = this.options
|
392
|
+
|
393
|
+
title = $e.attr('data-original-title')
|
394
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
395
|
+
|
396
|
+
return title
|
397
|
+
}
|
398
|
+
|
399
|
+
Tooltip.prototype.getUID = function (prefix) {
|
400
|
+
do prefix += ~~(Math.random() * 1000000)
|
401
|
+
while (document.getElementById(prefix))
|
402
|
+
return prefix
|
403
|
+
}
|
404
|
+
|
405
|
+
Tooltip.prototype.tip = function () {
|
406
|
+
return (this.$tip = this.$tip || $(this.options.template))
|
407
|
+
}
|
408
|
+
|
409
|
+
Tooltip.prototype.arrow = function () {
|
410
|
+
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
|
411
|
+
}
|
412
|
+
|
413
|
+
Tooltip.prototype.enable = function () {
|
414
|
+
this.enabled = true
|
415
|
+
}
|
416
|
+
|
417
|
+
Tooltip.prototype.disable = function () {
|
418
|
+
this.enabled = false
|
419
|
+
}
|
420
|
+
|
421
|
+
Tooltip.prototype.toggleEnabled = function () {
|
422
|
+
this.enabled = !this.enabled
|
423
|
+
}
|
424
|
+
|
425
|
+
Tooltip.prototype.toggle = function (e) {
|
426
|
+
var self = this
|
427
|
+
if (e) {
|
428
|
+
self = $(e.currentTarget).data('bs.' + this.type)
|
429
|
+
if (!self) {
|
430
|
+
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
|
431
|
+
$(e.currentTarget).data('bs.' + this.type, self)
|
432
|
+
}
|
433
|
+
}
|
434
|
+
|
435
|
+
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
436
|
+
}
|
437
|
+
|
438
|
+
Tooltip.prototype.destroy = function () {
|
439
|
+
var that = this
|
440
|
+
clearTimeout(this.timeout)
|
441
|
+
this.hide(function () {
|
442
|
+
that.$element.off('.' + that.type).removeData('bs.' + that.type)
|
443
|
+
})
|
444
|
+
}
|
445
|
+
|
446
|
+
|
447
|
+
// TOOLTIP PLUGIN DEFINITION
|
448
|
+
// =========================
|
449
|
+
|
450
|
+
function Plugin(option) {
|
451
|
+
return this.each(function () {
|
452
|
+
var $this = $(this)
|
453
|
+
var data = $this.data('bs.tooltip')
|
454
|
+
var options = typeof option == 'object' && option
|
455
|
+
|
456
|
+
if (!data && /destroy|hide/.test(option)) return
|
457
|
+
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
|
458
|
+
if (typeof option == 'string') data[option]()
|
459
|
+
})
|
460
|
+
}
|
461
|
+
|
462
|
+
var old = $.fn.tooltip
|
463
|
+
|
464
|
+
$.fn.tooltip = Plugin
|
465
|
+
$.fn.tooltip.Constructor = Tooltip
|
466
|
+
|
467
|
+
|
468
|
+
// TOOLTIP NO CONFLICT
|
469
|
+
// ===================
|
470
|
+
|
471
|
+
$.fn.tooltip.noConflict = function () {
|
472
|
+
$.fn.tooltip = old
|
473
|
+
return this
|
474
|
+
}
|
475
|
+
|
476
|
+
}(jQuery);
|