A simple tempate with every Bootstrap element present for quick and easy theme building
10 |
11 |
Why?
12 |
13 |
I created this as a tool for myself to quickly be able to test color themes and edits to the standard Bootstrap theme wihtout having to deal with version control within my own apps. Every element is present in a condensed manner so you can see how all items look next to each other. This is not intended to be a starter template, just a template for theme building.
14 |
15 |
To use:
16 |
17 |
You’ll need a Sass compiler of some kind (I recommend using CodeKit if you have a Mac), but that’s it. The initial compile has been run already and is linked as css/style.css in the header. A link to a jQuery CDN and the Bootstap javascript file are also already in there. Simply set up your Sass compiler of choice, navigate to the index.html file, and you’re ready to go!
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bootstrap Test
2 | ### A simple tempate with every Bootstrap element present for quick and easy theme building
3 |
4 | ## Why?
5 |
6 | I created this as a tool for myself to quickly be able to test color themes and edits to the standard Bootstrap theme wihtout having to deal with version control within my own apps. Every element is present in a condensed manner so you can see how all items look next to each other. This is not intended to be a starter template, just a template for theme building.
7 |
8 | ## To use:
9 |
10 | You'll need a Sass compiler of some kind (I recommend using [CodeKit](https://incident57.com/codekit/) if you have a Mac), but that's it. The initial compile has been run already and is linked as `css/style.css` in the header. A link to a jQuery CDN and the Bootstap javascript file are also already in there. Simply set up your Sass compiler of choice, navigate to the index.html file, and you're ready to go!
--------------------------------------------------------------------------------
/fonts/bootstrap/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bartboy011/bootstrap-test/7be64cb899a8b07e9ce9654b180d59cd587ab737/fonts/bootstrap/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/fonts/bootstrap/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bartboy011/bootstrap-test/7be64cb899a8b07e9ce9654b180d59cd587ab737/fonts/bootstrap/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/fonts/bootstrap/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bartboy011/bootstrap-test/7be64cb899a8b07e9ce9654b180d59cd587ab737/fonts/bootstrap/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/fonts/bootstrap/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bartboy011/bootstrap-test/7be64cb899a8b07e9ce9654b180d59cd587ab737/fonts/bootstrap/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bartboy011/bootstrap-test/7be64cb899a8b07e9ce9654b180d59cd587ab737/images/.keep
--------------------------------------------------------------------------------
/javascripts/bootstrap-sprockets.js:
--------------------------------------------------------------------------------
1 | //= require ./bootstrap/transition
2 | //= require ./bootstrap/alert
3 | //= require ./bootstrap/button
4 | //= require ./bootstrap/carousel
5 | //= require ./bootstrap/collapse
6 | //= require ./bootstrap/dropdown
7 | //= require ./bootstrap/modal
8 | //= require ./bootstrap/tab
9 | //= require ./bootstrap/affix
10 | //= require ./bootstrap/scrollspy
11 | //= require ./bootstrap/tooltip
12 | //= require ./bootstrap/popover
13 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/affix.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: affix.js v3.3.7
3 | * http://getbootstrap.com/javascript/#affix
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // AFFIX CLASS DEFINITION
14 | // ======================
15 |
16 | var Affix = function (element, options) {
17 | this.options = $.extend({}, Affix.DEFAULTS, options)
18 |
19 | this.$target = $(this.options.target)
20 | .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
21 | .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
22 |
23 | this.$element = $(element)
24 | this.affixed = null
25 | this.unpin = null
26 | this.pinnedOffset = null
27 |
28 | this.checkPosition()
29 | }
30 |
31 | Affix.VERSION = '3.3.7'
32 |
33 | Affix.RESET = 'affix affix-top affix-bottom'
34 |
35 | Affix.DEFAULTS = {
36 | offset: 0,
37 | target: window
38 | }
39 |
40 | Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
41 | var scrollTop = this.$target.scrollTop()
42 | var position = this.$element.offset()
43 | var targetHeight = this.$target.height()
44 |
45 | if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false
46 |
47 | if (this.affixed == 'bottom') {
48 | if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
49 | return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
50 | }
51 |
52 | var initializing = this.affixed == null
53 | var colliderTop = initializing ? scrollTop : position.top
54 | var colliderHeight = initializing ? targetHeight : height
55 |
56 | if (offsetTop != null && scrollTop <= offsetTop) return 'top'
57 | if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
58 |
59 | return false
60 | }
61 |
62 | Affix.prototype.getPinnedOffset = function () {
63 | if (this.pinnedOffset) return this.pinnedOffset
64 | this.$element.removeClass(Affix.RESET).addClass('affix')
65 | var scrollTop = this.$target.scrollTop()
66 | var position = this.$element.offset()
67 | return (this.pinnedOffset = position.top - scrollTop)
68 | }
69 |
70 | Affix.prototype.checkPositionWithEventLoop = function () {
71 | setTimeout($.proxy(this.checkPosition, this), 1)
72 | }
73 |
74 | Affix.prototype.checkPosition = function () {
75 | if (!this.$element.is(':visible')) return
76 |
77 | var height = this.$element.height()
78 | var offset = this.options.offset
79 | var offsetTop = offset.top
80 | var offsetBottom = offset.bottom
81 | var scrollHeight = Math.max($(document).height(), $(document.body).height())
82 |
83 | if (typeof offset != 'object') offsetBottom = offsetTop = offset
84 | if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
85 | if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
86 |
87 | var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)
88 |
89 | if (this.affixed != affix) {
90 | if (this.unpin != null) this.$element.css('top', '')
91 |
92 | var affixType = 'affix' + (affix ? '-' + affix : '')
93 | var e = $.Event(affixType + '.bs.affix')
94 |
95 | this.$element.trigger(e)
96 |
97 | if (e.isDefaultPrevented()) return
98 |
99 | this.affixed = affix
100 | this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
101 |
102 | this.$element
103 | .removeClass(Affix.RESET)
104 | .addClass(affixType)
105 | .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
106 | }
107 |
108 | if (affix == 'bottom') {
109 | this.$element.offset({
110 | top: scrollHeight - height - offsetBottom
111 | })
112 | }
113 | }
114 |
115 |
116 | // AFFIX PLUGIN DEFINITION
117 | // =======================
118 |
119 | function Plugin(option) {
120 | return this.each(function () {
121 | var $this = $(this)
122 | var data = $this.data('bs.affix')
123 | var options = typeof option == 'object' && option
124 |
125 | if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
126 | if (typeof option == 'string') data[option]()
127 | })
128 | }
129 |
130 | var old = $.fn.affix
131 |
132 | $.fn.affix = Plugin
133 | $.fn.affix.Constructor = Affix
134 |
135 |
136 | // AFFIX NO CONFLICT
137 | // =================
138 |
139 | $.fn.affix.noConflict = function () {
140 | $.fn.affix = old
141 | return this
142 | }
143 |
144 |
145 | // AFFIX DATA-API
146 | // ==============
147 |
148 | $(window).on('load', function () {
149 | $('[data-spy="affix"]').each(function () {
150 | var $spy = $(this)
151 | var data = $spy.data()
152 |
153 | data.offset = data.offset || {}
154 |
155 | if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
156 | if (data.offsetTop != null) data.offset.top = data.offsetTop
157 |
158 | Plugin.call($spy, data)
159 | })
160 | })
161 |
162 | }(jQuery);
163 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/alert.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: alert.js v3.3.7
3 | * http://getbootstrap.com/javascript/#alerts
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // ALERT CLASS DEFINITION
14 | // ======================
15 |
16 | var dismiss = '[data-dismiss="alert"]'
17 | var Alert = function (el) {
18 | $(el).on('click', dismiss, this.close)
19 | }
20 |
21 | Alert.VERSION = '3.3.7'
22 |
23 | Alert.TRANSITION_DURATION = 150
24 |
25 | Alert.prototype.close = function (e) {
26 | var $this = $(this)
27 | var selector = $this.attr('data-target')
28 |
29 | if (!selector) {
30 | selector = $this.attr('href')
31 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
32 | }
33 |
34 | var $parent = $(selector === '#' ? [] : selector)
35 |
36 | if (e) e.preventDefault()
37 |
38 | if (!$parent.length) {
39 | $parent = $this.closest('.alert')
40 | }
41 |
42 | $parent.trigger(e = $.Event('close.bs.alert'))
43 |
44 | if (e.isDefaultPrevented()) return
45 |
46 | $parent.removeClass('in')
47 |
48 | function removeElement() {
49 | // detach from parent, fire event then clean up data
50 | $parent.detach().trigger('closed.bs.alert').remove()
51 | }
52 |
53 | $.support.transition && $parent.hasClass('fade') ?
54 | $parent
55 | .one('bsTransitionEnd', removeElement)
56 | .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
57 | removeElement()
58 | }
59 |
60 |
61 | // ALERT PLUGIN DEFINITION
62 | // =======================
63 |
64 | function Plugin(option) {
65 | return this.each(function () {
66 | var $this = $(this)
67 | var data = $this.data('bs.alert')
68 |
69 | if (!data) $this.data('bs.alert', (data = new Alert(this)))
70 | if (typeof option == 'string') data[option].call($this)
71 | })
72 | }
73 |
74 | var old = $.fn.alert
75 |
76 | $.fn.alert = Plugin
77 | $.fn.alert.Constructor = Alert
78 |
79 |
80 | // ALERT NO CONFLICT
81 | // =================
82 |
83 | $.fn.alert.noConflict = function () {
84 | $.fn.alert = old
85 | return this
86 | }
87 |
88 |
89 | // ALERT DATA-API
90 | // ==============
91 |
92 | $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
93 |
94 | }(jQuery);
95 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/button.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: button.js v3.3.7
3 | * http://getbootstrap.com/javascript/#buttons
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // BUTTON PUBLIC CLASS DEFINITION
14 | // ==============================
15 |
16 | var Button = function (element, options) {
17 | this.$element = $(element)
18 | this.options = $.extend({}, Button.DEFAULTS, options)
19 | this.isLoading = false
20 | }
21 |
22 | Button.VERSION = '3.3.7'
23 |
24 | Button.DEFAULTS = {
25 | loadingText: 'loading...'
26 | }
27 |
28 | Button.prototype.setState = function (state) {
29 | var d = 'disabled'
30 | var $el = this.$element
31 | var val = $el.is('input') ? 'val' : 'html'
32 | var data = $el.data()
33 |
34 | state += 'Text'
35 |
36 | if (data.resetText == null) $el.data('resetText', $el[val]())
37 |
38 | // push to event loop to allow forms to submit
39 | setTimeout($.proxy(function () {
40 | $el[val](data[state] == null ? this.options[state] : data[state])
41 |
42 | if (state == 'loadingText') {
43 | this.isLoading = true
44 | $el.addClass(d).attr(d, d).prop(d, true)
45 | } else if (this.isLoading) {
46 | this.isLoading = false
47 | $el.removeClass(d).removeAttr(d).prop(d, false)
48 | }
49 | }, this), 0)
50 | }
51 |
52 | Button.prototype.toggle = function () {
53 | var changed = true
54 | var $parent = this.$element.closest('[data-toggle="buttons"]')
55 |
56 | if ($parent.length) {
57 | var $input = this.$element.find('input')
58 | if ($input.prop('type') == 'radio') {
59 | if ($input.prop('checked')) changed = false
60 | $parent.find('.active').removeClass('active')
61 | this.$element.addClass('active')
62 | } else if ($input.prop('type') == 'checkbox') {
63 | if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
64 | this.$element.toggleClass('active')
65 | }
66 | $input.prop('checked', this.$element.hasClass('active'))
67 | if (changed) $input.trigger('change')
68 | } else {
69 | this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
70 | this.$element.toggleClass('active')
71 | }
72 | }
73 |
74 |
75 | // BUTTON PLUGIN DEFINITION
76 | // ========================
77 |
78 | function Plugin(option) {
79 | return this.each(function () {
80 | var $this = $(this)
81 | var data = $this.data('bs.button')
82 | var options = typeof option == 'object' && option
83 |
84 | if (!data) $this.data('bs.button', (data = new Button(this, options)))
85 |
86 | if (option == 'toggle') data.toggle()
87 | else if (option) data.setState(option)
88 | })
89 | }
90 |
91 | var old = $.fn.button
92 |
93 | $.fn.button = Plugin
94 | $.fn.button.Constructor = Button
95 |
96 |
97 | // BUTTON NO CONFLICT
98 | // ==================
99 |
100 | $.fn.button.noConflict = function () {
101 | $.fn.button = old
102 | return this
103 | }
104 |
105 |
106 | // BUTTON DATA-API
107 | // ===============
108 |
109 | $(document)
110 | .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
111 | var $btn = $(e.target).closest('.btn')
112 | Plugin.call($btn, 'toggle')
113 | if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
114 | // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
115 | e.preventDefault()
116 | // The target component still receive the focus
117 | if ($btn.is('input,button')) $btn.trigger('focus')
118 | else $btn.find('input:visible,button:visible').first().trigger('focus')
119 | }
120 | })
121 | .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
122 | $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
123 | })
124 |
125 | }(jQuery);
126 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/collapse.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: collapse.js v3.3.7
3 | * http://getbootstrap.com/javascript/#collapse
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 | /* jshint latedef: false */
10 |
11 | +function ($) {
12 | 'use strict';
13 |
14 | // COLLAPSE PUBLIC CLASS DEFINITION
15 | // ================================
16 |
17 | var Collapse = function (element, options) {
18 | this.$element = $(element)
19 | this.options = $.extend({}, Collapse.DEFAULTS, options)
20 | this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
21 | '[data-toggle="collapse"][data-target="#' + element.id + '"]')
22 | this.transitioning = null
23 |
24 | if (this.options.parent) {
25 | this.$parent = this.getParent()
26 | } else {
27 | this.addAriaAndCollapsedClass(this.$element, this.$trigger)
28 | }
29 |
30 | if (this.options.toggle) this.toggle()
31 | }
32 |
33 | Collapse.VERSION = '3.3.7'
34 |
35 | Collapse.TRANSITION_DURATION = 350
36 |
37 | Collapse.DEFAULTS = {
38 | toggle: true
39 | }
40 |
41 | Collapse.prototype.dimension = function () {
42 | var hasWidth = this.$element.hasClass('width')
43 | return hasWidth ? 'width' : 'height'
44 | }
45 |
46 | Collapse.prototype.show = function () {
47 | if (this.transitioning || this.$element.hasClass('in')) return
48 |
49 | var activesData
50 | var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
51 |
52 | if (actives && actives.length) {
53 | activesData = actives.data('bs.collapse')
54 | if (activesData && activesData.transitioning) return
55 | }
56 |
57 | var startEvent = $.Event('show.bs.collapse')
58 | this.$element.trigger(startEvent)
59 | if (startEvent.isDefaultPrevented()) return
60 |
61 | if (actives && actives.length) {
62 | Plugin.call(actives, 'hide')
63 | activesData || actives.data('bs.collapse', null)
64 | }
65 |
66 | var dimension = this.dimension()
67 |
68 | this.$element
69 | .removeClass('collapse')
70 | .addClass('collapsing')[dimension](0)
71 | .attr('aria-expanded', true)
72 |
73 | this.$trigger
74 | .removeClass('collapsed')
75 | .attr('aria-expanded', true)
76 |
77 | this.transitioning = 1
78 |
79 | var complete = function () {
80 | this.$element
81 | .removeClass('collapsing')
82 | .addClass('collapse in')[dimension]('')
83 | this.transitioning = 0
84 | this.$element
85 | .trigger('shown.bs.collapse')
86 | }
87 |
88 | if (!$.support.transition) return complete.call(this)
89 |
90 | var scrollSize = $.camelCase(['scroll', dimension].join('-'))
91 |
92 | this.$element
93 | .one('bsTransitionEnd', $.proxy(complete, this))
94 | .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
95 | }
96 |
97 | Collapse.prototype.hide = function () {
98 | if (this.transitioning || !this.$element.hasClass('in')) return
99 |
100 | var startEvent = $.Event('hide.bs.collapse')
101 | this.$element.trigger(startEvent)
102 | if (startEvent.isDefaultPrevented()) return
103 |
104 | var dimension = this.dimension()
105 |
106 | this.$element[dimension](this.$element[dimension]())[0].offsetHeight
107 |
108 | this.$element
109 | .addClass('collapsing')
110 | .removeClass('collapse in')
111 | .attr('aria-expanded', false)
112 |
113 | this.$trigger
114 | .addClass('collapsed')
115 | .attr('aria-expanded', false)
116 |
117 | this.transitioning = 1
118 |
119 | var complete = function () {
120 | this.transitioning = 0
121 | this.$element
122 | .removeClass('collapsing')
123 | .addClass('collapse')
124 | .trigger('hidden.bs.collapse')
125 | }
126 |
127 | if (!$.support.transition) return complete.call(this)
128 |
129 | this.$element
130 | [dimension](0)
131 | .one('bsTransitionEnd', $.proxy(complete, this))
132 | .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
133 | }
134 |
135 | Collapse.prototype.toggle = function () {
136 | this[this.$element.hasClass('in') ? 'hide' : 'show']()
137 | }
138 |
139 | Collapse.prototype.getParent = function () {
140 | return $(this.options.parent)
141 | .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
142 | .each($.proxy(function (i, element) {
143 | var $element = $(element)
144 | this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
145 | }, this))
146 | .end()
147 | }
148 |
149 | Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
150 | var isOpen = $element.hasClass('in')
151 |
152 | $element.attr('aria-expanded', isOpen)
153 | $trigger
154 | .toggleClass('collapsed', !isOpen)
155 | .attr('aria-expanded', isOpen)
156 | }
157 |
158 | function getTargetFromTrigger($trigger) {
159 | var href
160 | var target = $trigger.attr('data-target')
161 | || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
162 |
163 | return $(target)
164 | }
165 |
166 |
167 | // COLLAPSE PLUGIN DEFINITION
168 | // ==========================
169 |
170 | function Plugin(option) {
171 | return this.each(function () {
172 | var $this = $(this)
173 | var data = $this.data('bs.collapse')
174 | var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
175 |
176 | if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
177 | if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
178 | if (typeof option == 'string') data[option]()
179 | })
180 | }
181 |
182 | var old = $.fn.collapse
183 |
184 | $.fn.collapse = Plugin
185 | $.fn.collapse.Constructor = Collapse
186 |
187 |
188 | // COLLAPSE NO CONFLICT
189 | // ====================
190 |
191 | $.fn.collapse.noConflict = function () {
192 | $.fn.collapse = old
193 | return this
194 | }
195 |
196 |
197 | // COLLAPSE DATA-API
198 | // =================
199 |
200 | $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
201 | var $this = $(this)
202 |
203 | if (!$this.attr('data-target')) e.preventDefault()
204 |
205 | var $target = getTargetFromTrigger($this)
206 | var data = $target.data('bs.collapse')
207 | var option = data ? 'toggle' : $this.data()
208 |
209 | Plugin.call($target, option)
210 | })
211 |
212 | }(jQuery);
213 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/dropdown.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: dropdown.js v3.3.7
3 | * http://getbootstrap.com/javascript/#dropdowns
4 | * ========================================================================
5 | * Copyright 2011-2016 Twitter, Inc.
6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7 | * ======================================================================== */
8 |
9 |
10 | +function ($) {
11 | 'use strict';
12 |
13 | // DROPDOWN CLASS DEFINITION
14 | // =========================
15 |
16 | var backdrop = '.dropdown-backdrop'
17 | var toggle = '[data-toggle="dropdown"]'
18 | var Dropdown = function (element) {
19 | $(element).on('click.bs.dropdown', this.toggle)
20 | }
21 |
22 | Dropdown.VERSION = '3.3.7'
23 |
24 | function getParent($this) {
25 | var selector = $this.attr('data-target')
26 |
27 | if (!selector) {
28 | selector = $this.attr('href')
29 | selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
30 | }
31 |
32 | var $parent = selector && $(selector)
33 |
34 | return $parent && $parent.length ? $parent : $this.parent()
35 | }
36 |
37 | function clearMenus(e) {
38 | if (e && e.which === 3) return
39 | $(backdrop).remove()
40 | $(toggle).each(function () {
41 | var $this = $(this)
42 | var $parent = getParent($this)
43 | var relatedTarget = { relatedTarget: this }
44 |
45 | if (!$parent.hasClass('open')) return
46 |
47 | if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
48 |
49 | $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
50 |
51 | if (e.isDefaultPrevented()) return
52 |
53 | $this.attr('aria-expanded', 'false')
54 | $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
55 | })
56 | }
57 |
58 | Dropdown.prototype.toggle = function (e) {
59 | var $this = $(this)
60 |
61 | if ($this.is('.disabled, :disabled')) return
62 |
63 | var $parent = getParent($this)
64 | var isActive = $parent.hasClass('open')
65 |
66 | clearMenus()
67 |
68 | if (!isActive) {
69 | if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
70 | // if mobile we use a backdrop because click events don't delegate
71 | $(document.createElement('div'))
72 | .addClass('dropdown-backdrop')
73 | .insertAfter($(this))
74 | .on('click', clearMenus)
75 | }
76 |
77 | var relatedTarget = { relatedTarget: this }
78 | $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
79 |
80 | if (e.isDefaultPrevented()) return
81 |
82 | $this
83 | .trigger('focus')
84 | .attr('aria-expanded', 'true')
85 |
86 | $parent
87 | .toggleClass('open')
88 | .trigger($.Event('shown.bs.dropdown', relatedTarget))
89 | }
90 |
91 | return false
92 | }
93 |
94 | Dropdown.prototype.keydown = function (e) {
95 | if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
96 |
97 | var $this = $(this)
98 |
99 | e.preventDefault()
100 | e.stopPropagation()
101 |
102 | if ($this.is('.disabled, :disabled')) return
103 |
104 | var $parent = getParent($this)
105 | var isActive = $parent.hasClass('open')
106 |
107 | if (!isActive && e.which != 27 || isActive && e.which == 27) {
108 | if (e.which == 27) $parent.find(toggle).trigger('focus')
109 | return $this.trigger('click')
110 | }
111 |
112 | var desc = ' li:not(.disabled):visible a'
113 | var $items = $parent.find('.dropdown-menu' + desc)
114 |
115 | if (!$items.length) return
116 |
117 | var index = $items.index(e.target)
118 |
119 | if (e.which == 38 && index > 0) index-- // up
120 | if (e.which == 40 && index < $items.length - 1) index++ // down
121 | if (!~index) index = 0
122 |
123 | $items.eq(index).trigger('focus')
124 | }
125 |
126 |
127 | // DROPDOWN PLUGIN DEFINITION
128 | // ==========================
129 |
130 | function Plugin(option) {
131 | return this.each(function () {
132 | var $this = $(this)
133 | var data = $this.data('bs.dropdown')
134 |
135 | if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
136 | if (typeof option == 'string') data[option].call($this)
137 | })
138 | }
139 |
140 | var old = $.fn.dropdown
141 |
142 | $.fn.dropdown = Plugin
143 | $.fn.dropdown.Constructor = Dropdown
144 |
145 |
146 | // DROPDOWN NO CONFLICT
147 | // ====================
148 |
149 | $.fn.dropdown.noConflict = function () {
150 | $.fn.dropdown = old
151 | return this
152 | }
153 |
154 |
155 | // APPLY TO STANDARD DROPDOWN ELEMENTS
156 | // ===================================
157 |
158 | $(document)
159 | .on('click.bs.dropdown.data-api', clearMenus)
160 | .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
161 | .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
162 | .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
163 | .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
164 |
165 | }(jQuery);
166 |
--------------------------------------------------------------------------------
/javascripts/bootstrap/popover.js:
--------------------------------------------------------------------------------
1 | /* ========================================================================
2 | * Bootstrap: popover.js v3.3.7
3 | * http://getbootstrap.com/javascript/#popovers
4 | * ========================================================================
5 | * Copyright 2011-2016 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.7'
23 |
24 | Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
25 | placement: 'right',
26 | trigger: 'click',
27 | content: '',
28 | template: '