entreprise7pro-bootstrap-sass 3.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +19 -0
- data/CHANGELOG.md +233 -0
- data/CONTRIBUTING.md +86 -0
- data/Gemfile +7 -0
- data/LICENSE +22 -0
- data/README.md +376 -0
- data/Rakefile +98 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/assets/images/.keep +0 -0
- data/assets/javascripts/bootstrap/affix.js +166 -0
- data/assets/javascripts/bootstrap/alert.js +97 -0
- data/assets/javascripts/bootstrap/button.js +136 -0
- data/assets/javascripts/bootstrap/carousel.js +248 -0
- data/assets/javascripts/bootstrap/collapse.js +214 -0
- data/assets/javascripts/bootstrap/dropdown.js +167 -0
- data/assets/javascripts/bootstrap/modal.js +356 -0
- data/assets/javascripts/bootstrap/popover.js +123 -0
- data/assets/javascripts/bootstrap/scrollspy.js +174 -0
- data/assets/javascripts/bootstrap/tab.js +157 -0
- data/assets/javascripts/bootstrap/tooltip.js +679 -0
- data/assets/javascripts/bootstrap/transition.js +61 -0
- data/assets/javascripts/bootstrap-sprockets.js +12 -0
- data/assets/javascripts/bootstrap.js +2611 -0
- data/assets/javascripts/bootstrap.min.js +7 -0
- data/assets/javascripts/jquery.min.js +2 -0
- data/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/assets/stylesheets/_bootstrap.scss +56 -0
- data/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/assets/stylesheets/bootstrap/_badges.scss +68 -0
- data/assets/stylesheets/bootstrap/_breadcrumbs.scss +28 -0
- data/assets/stylesheets/bootstrap/_button-groups.scss +244 -0
- data/assets/stylesheets/bootstrap/_buttons.scss +168 -0
- data/assets/stylesheets/bootstrap/_carousel.scss +263 -0
- data/assets/stylesheets/bootstrap/_close.scss +37 -0
- data/assets/stylesheets/bootstrap/_code.scss +70 -0
- data/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/assets/stylesheets/bootstrap/_dropdowns.scss +212 -0
- data/assets/stylesheets/bootstrap/_forms.scss +602 -0
- data/assets/stylesheets/bootstrap/_glyphicons.scss +307 -0
- data/assets/stylesheets/bootstrap/_grid.scss +94 -0
- data/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/assets/stylesheets/bootstrap/_jumbotron.scss +55 -0
- data/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +128 -0
- data/assets/stylesheets/bootstrap/_media.scss +66 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +657 -0
- data/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/assets/stylesheets/bootstrap/_normalize.scss +422 -0
- data/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +86 -0
- data/assets/stylesheets/bootstrap/_panels.scss +271 -0
- data/assets/stylesheets/bootstrap/_popovers.scss +126 -0
- data/assets/stylesheets/bootstrap/_print.scss +99 -0
- data/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/assets/stylesheets/bootstrap/_responsive-utilities.scss +157 -0
- data/assets/stylesheets/bootstrap/_scaffolding.scss +161 -0
- data/assets/stylesheets/bootstrap/_tables.scss +233 -0
- data/assets/stylesheets/bootstrap/_theme.scss +293 -0
- data/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +112 -0
- data/assets/stylesheets/bootstrap/_type.scss +299 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/assets/stylesheets/bootstrap/_variables.scss +875 -0
- data/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/assets/stylesheets/bootstrap/mixins/_alerts.scss +15 -0
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +61 -0
- data/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +50 -0
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +82 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +123 -0
- data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_image.scss +28 -0
- data/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +32 -0
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_opacity.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +17 -0
- data/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +210 -0
- data/bower.json +38 -0
- data/composer.json +21 -0
- data/entreprise7pro-bootstrap-sass.gemspec +37 -0
- data/eyeglass-exports.js +7 -0
- data/lib/entreprise7pro-bootstrap-sass/engine.rb +17 -0
- data/lib/entreprise7pro-bootstrap-sass/version.rb +4 -0
- data/lib/entreprise7pro-bootstrap-sass.rb +91 -0
- data/package-lock.json +1011 -0
- data/package.json +48 -0
- data/sache.json +5 -0
- data/tasks/bower.rake +31 -0
- data/tasks/converter/char_string_scanner.rb +38 -0
- data/tasks/converter/fonts_conversion.rb +16 -0
- data/tasks/converter/js_conversion.rb +47 -0
- data/tasks/converter/less_conversion.rb +752 -0
- data/tasks/converter/logger.rb +57 -0
- data/tasks/converter/network.rb +97 -0
- data/tasks/converter.rb +80 -0
- data/templates/project/_bootstrap-variables.sass +876 -0
- data/templates/project/manifest.rb +20 -0
- data/templates/project/styles.sass +6 -0
- data/test/compilation_test.rb +30 -0
- data/test/dummy_node_mincer/apple-touch-icon-144-precomposed.png +0 -0
- data/test/dummy_node_mincer/application.css.ejs.scss +6 -0
- data/test/dummy_node_mincer/manifest.js +87 -0
- data/test/dummy_rails/README.rdoc +3 -0
- data/test/dummy_rails/Rakefile +6 -0
- data/test/dummy_rails/app/assets/images/.keep +0 -0
- data/test/dummy_rails/app/assets/javascripts/application.js +2 -0
- data/test/dummy_rails/app/assets/stylesheets/application.sass +2 -0
- data/test/dummy_rails/app/controllers/application_controller.rb +5 -0
- data/test/dummy_rails/app/controllers/pages_controller.rb +4 -0
- data/test/dummy_rails/app/helpers/application_helper.rb +2 -0
- data/test/dummy_rails/app/views/layouts/application.html.erb +14 -0
- data/test/dummy_rails/app/views/pages/root.html.slim +84 -0
- data/test/dummy_rails/config/application.rb +31 -0
- data/test/dummy_rails/config/boot.rb +5 -0
- data/test/dummy_rails/config/environment.rb +5 -0
- data/test/dummy_rails/config/environments/development.rb +23 -0
- data/test/dummy_rails/config/environments/production.rb +82 -0
- data/test/dummy_rails/config/environments/test.rb +38 -0
- data/test/dummy_rails/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy_rails/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy_rails/config/initializers/inflections.rb +16 -0
- data/test/dummy_rails/config/initializers/mime_types.rb +5 -0
- data/test/dummy_rails/config/initializers/secret_token.rb +18 -0
- data/test/dummy_rails/config/initializers/session_store.rb +3 -0
- data/test/dummy_rails/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy_rails/config/locales/en.yml +3 -0
- data/test/dummy_rails/config/locales/es.yml +3 -0
- data/test/dummy_rails/config/routes.rb +3 -0
- data/test/dummy_rails/config.ru +4 -0
- data/test/dummy_rails/log/.keep +0 -0
- data/test/dummy_sass_only/Gemfile +4 -0
- data/test/dummy_sass_only/compile.rb +20 -0
- data/test/dummy_sass_only/import_all.scss +2 -0
- data/test/gemfiles/default.gemfile +3 -0
- data/test/node_mincer_test.rb +35 -0
- data/test/node_sass_compile_test.sh +9 -0
- data/test/pages_test.rb +14 -0
- data/test/sass_test.rb +29 -0
- data/test/sprockets_rails_test.rb +31 -0
- data/test/support/dummy_rails_integration.rb +22 -0
- data/test/support/reporting.rb +27 -0
- data/test/test_helper.rb +36 -0
- data/test/test_helper_rails.rb +6 -0
- metadata +467 -0
@@ -0,0 +1,214 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: collapse.js v3.4.3
|
3
|
+
* https://bootstrap.7pro.ca/docs/3.4/javascript/#collapse
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2024 Entreprise 7pro.ca Inc.
|
6
|
+
* Licensed under MIT (https://github.com/entreprise7pro/bootstrap/blob/v3-dev/LICENSE)
|
7
|
+
* Copyright 2011-2019 Twitter, Inc.
|
8
|
+
* Licensed under MIT (https://github.com/entreprise7pro/bootstrap/blob/v3-dev/LICENSE)
|
9
|
+
* ======================================================================== */
|
10
|
+
|
11
|
+
/* jshint latedef: false */
|
12
|
+
|
13
|
+
+function ($) {
|
14
|
+
'use strict';
|
15
|
+
|
16
|
+
// COLLAPSE PUBLIC CLASS DEFINITION
|
17
|
+
// ================================
|
18
|
+
|
19
|
+
var Collapse = function (element, options) {
|
20
|
+
this.$element = $(element)
|
21
|
+
this.options = $.extend({}, Collapse.DEFAULTS, options)
|
22
|
+
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
|
23
|
+
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
|
24
|
+
this.transitioning = null
|
25
|
+
|
26
|
+
if (this.options.parent) {
|
27
|
+
this.$parent = this.getParent()
|
28
|
+
} else {
|
29
|
+
this.addAriaAndCollapsedClass(this.$element, this.$trigger)
|
30
|
+
}
|
31
|
+
|
32
|
+
if (this.options.toggle) this.toggle()
|
33
|
+
}
|
34
|
+
|
35
|
+
Collapse.VERSION = '3.4.3'
|
36
|
+
|
37
|
+
Collapse.TRANSITION_DURATION = 350
|
38
|
+
|
39
|
+
Collapse.DEFAULTS = {
|
40
|
+
toggle: true
|
41
|
+
}
|
42
|
+
|
43
|
+
Collapse.prototype.dimension = function () {
|
44
|
+
var hasWidth = this.$element.hasClass('width')
|
45
|
+
return hasWidth ? 'width' : 'height'
|
46
|
+
}
|
47
|
+
|
48
|
+
Collapse.prototype.show = function () {
|
49
|
+
if (this.transitioning || this.$element.hasClass('in')) return
|
50
|
+
|
51
|
+
var activesData
|
52
|
+
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
|
53
|
+
|
54
|
+
if (actives && actives.length) {
|
55
|
+
activesData = actives.data('bs.collapse')
|
56
|
+
if (activesData && activesData.transitioning) return
|
57
|
+
}
|
58
|
+
|
59
|
+
var startEvent = $.Event('show.bs.collapse')
|
60
|
+
this.$element.trigger(startEvent)
|
61
|
+
if (startEvent.isDefaultPrevented()) return
|
62
|
+
|
63
|
+
if (actives && actives.length) {
|
64
|
+
Plugin.call(actives, 'hide')
|
65
|
+
activesData || actives.data('bs.collapse', null)
|
66
|
+
}
|
67
|
+
|
68
|
+
var dimension = this.dimension()
|
69
|
+
|
70
|
+
this.$element
|
71
|
+
.removeClass('collapse')
|
72
|
+
.addClass('collapsing')[dimension](0)
|
73
|
+
.attr('aria-expanded', true)
|
74
|
+
|
75
|
+
this.$trigger
|
76
|
+
.removeClass('collapsed')
|
77
|
+
.attr('aria-expanded', true)
|
78
|
+
|
79
|
+
this.transitioning = 1
|
80
|
+
|
81
|
+
var complete = function () {
|
82
|
+
this.$element
|
83
|
+
.removeClass('collapsing')
|
84
|
+
.addClass('collapse in')[dimension]('')
|
85
|
+
this.transitioning = 0
|
86
|
+
this.$element
|
87
|
+
.trigger('shown.bs.collapse')
|
88
|
+
}
|
89
|
+
|
90
|
+
if (!$.support.transition) return complete.call(this)
|
91
|
+
|
92
|
+
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
|
93
|
+
|
94
|
+
this.$element
|
95
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
96
|
+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
|
97
|
+
}
|
98
|
+
|
99
|
+
Collapse.prototype.hide = function () {
|
100
|
+
if (this.transitioning || !this.$element.hasClass('in')) return
|
101
|
+
|
102
|
+
var startEvent = $.Event('hide.bs.collapse')
|
103
|
+
this.$element.trigger(startEvent)
|
104
|
+
if (startEvent.isDefaultPrevented()) return
|
105
|
+
|
106
|
+
var dimension = this.dimension()
|
107
|
+
|
108
|
+
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
|
109
|
+
|
110
|
+
this.$element
|
111
|
+
.addClass('collapsing')
|
112
|
+
.removeClass('collapse in')
|
113
|
+
.attr('aria-expanded', false)
|
114
|
+
|
115
|
+
this.$trigger
|
116
|
+
.addClass('collapsed')
|
117
|
+
.attr('aria-expanded', false)
|
118
|
+
|
119
|
+
this.transitioning = 1
|
120
|
+
|
121
|
+
var complete = function () {
|
122
|
+
this.transitioning = 0
|
123
|
+
this.$element
|
124
|
+
.removeClass('collapsing')
|
125
|
+
.addClass('collapse')
|
126
|
+
.trigger('hidden.bs.collapse')
|
127
|
+
}
|
128
|
+
|
129
|
+
if (!$.support.transition) return complete.call(this)
|
130
|
+
|
131
|
+
this.$element
|
132
|
+
[dimension](0)
|
133
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
134
|
+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)
|
135
|
+
}
|
136
|
+
|
137
|
+
Collapse.prototype.toggle = function () {
|
138
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
139
|
+
}
|
140
|
+
|
141
|
+
Collapse.prototype.getParent = function () {
|
142
|
+
return $(document).find(this.options.parent)
|
143
|
+
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
|
144
|
+
.each($.proxy(function (i, element) {
|
145
|
+
var $element = $(element)
|
146
|
+
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
|
147
|
+
}, this))
|
148
|
+
.end()
|
149
|
+
}
|
150
|
+
|
151
|
+
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
|
152
|
+
var isOpen = $element.hasClass('in')
|
153
|
+
|
154
|
+
$element.attr('aria-expanded', isOpen)
|
155
|
+
$trigger
|
156
|
+
.toggleClass('collapsed', !isOpen)
|
157
|
+
.attr('aria-expanded', isOpen)
|
158
|
+
}
|
159
|
+
|
160
|
+
function getTargetFromTrigger($trigger) {
|
161
|
+
var href
|
162
|
+
var target = $trigger.attr('data-target')
|
163
|
+
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
|
164
|
+
|
165
|
+
return $(document).find(target)
|
166
|
+
}
|
167
|
+
|
168
|
+
|
169
|
+
// COLLAPSE PLUGIN DEFINITION
|
170
|
+
// ==========================
|
171
|
+
|
172
|
+
function Plugin(option) {
|
173
|
+
return this.each(function () {
|
174
|
+
var $this = $(this)
|
175
|
+
var data = $this.data('bs.collapse')
|
176
|
+
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
|
177
|
+
|
178
|
+
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
|
179
|
+
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
|
180
|
+
if (typeof option == 'string') data[option]()
|
181
|
+
})
|
182
|
+
}
|
183
|
+
|
184
|
+
var old = $.fn.collapse
|
185
|
+
|
186
|
+
$.fn.collapse = Plugin
|
187
|
+
$.fn.collapse.Constructor = Collapse
|
188
|
+
|
189
|
+
|
190
|
+
// COLLAPSE NO CONFLICT
|
191
|
+
// ====================
|
192
|
+
|
193
|
+
$.fn.collapse.noConflict = function () {
|
194
|
+
$.fn.collapse = old
|
195
|
+
return this
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
// COLLAPSE DATA-API
|
200
|
+
// =================
|
201
|
+
|
202
|
+
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
|
203
|
+
var $this = $(this)
|
204
|
+
|
205
|
+
if (!$this.attr('data-target')) e.preventDefault()
|
206
|
+
|
207
|
+
var $target = getTargetFromTrigger($this)
|
208
|
+
var data = $target.data('bs.collapse')
|
209
|
+
var option = data ? 'toggle' : $this.data()
|
210
|
+
|
211
|
+
Plugin.call($target, option)
|
212
|
+
})
|
213
|
+
|
214
|
+
}(jQuery);
|
@@ -0,0 +1,167 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: dropdown.js v3.4.3
|
3
|
+
* https://bootstrap.7pro.ca/docs/3.4/javascript/#dropdowns
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2024 Entreprise 7pro.ca Inc.
|
6
|
+
* Licensed under MIT (https://github.com/entreprise7pro/bootstrap/blob/v3-dev/LICENSE)
|
7
|
+
* Copyright 2011-2019 Twitter, Inc (now X).
|
8
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/v3-dev/LICENSE)
|
9
|
+
* ======================================================================== */
|
10
|
+
|
11
|
+
|
12
|
+
+function ($) {
|
13
|
+
'use strict';
|
14
|
+
|
15
|
+
// DROPDOWN CLASS DEFINITION
|
16
|
+
// =========================
|
17
|
+
|
18
|
+
var backdrop = '.dropdown-backdrop'
|
19
|
+
var toggle = '[data-toggle="dropdown"]'
|
20
|
+
var Dropdown = function (element) {
|
21
|
+
$(element).on('click.bs.dropdown', this.toggle)
|
22
|
+
}
|
23
|
+
|
24
|
+
Dropdown.VERSION = '3.4.3'
|
25
|
+
|
26
|
+
function getParent($this) {
|
27
|
+
var selector = $this.attr('data-target')
|
28
|
+
|
29
|
+
if (!selector) {
|
30
|
+
selector = $this.attr('href')
|
31
|
+
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
32
|
+
}
|
33
|
+
|
34
|
+
var $parent = selector !== '#' ? $(document).find(selector) : null
|
35
|
+
|
36
|
+
return $parent && $parent.length ? $parent : $this.parent()
|
37
|
+
}
|
38
|
+
|
39
|
+
function clearMenus(e) {
|
40
|
+
if (e && e.which === 3) return
|
41
|
+
$(backdrop).remove()
|
42
|
+
$(toggle).each(function () {
|
43
|
+
var $this = $(this)
|
44
|
+
var $parent = getParent($this)
|
45
|
+
var relatedTarget = { relatedTarget: this }
|
46
|
+
|
47
|
+
if (!$parent.hasClass('open')) return
|
48
|
+
|
49
|
+
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
|
50
|
+
|
51
|
+
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
|
52
|
+
|
53
|
+
if (e.isDefaultPrevented()) return
|
54
|
+
|
55
|
+
$this.attr('aria-expanded', 'false')
|
56
|
+
$parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
|
57
|
+
})
|
58
|
+
}
|
59
|
+
|
60
|
+
Dropdown.prototype.toggle = function (e) {
|
61
|
+
var $this = $(this)
|
62
|
+
|
63
|
+
if ($this.is('.disabled, :disabled')) return
|
64
|
+
|
65
|
+
var $parent = getParent($this)
|
66
|
+
var isActive = $parent.hasClass('open')
|
67
|
+
|
68
|
+
clearMenus()
|
69
|
+
|
70
|
+
if (!isActive) {
|
71
|
+
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
|
72
|
+
// if mobile we use a backdrop because click events don't delegate
|
73
|
+
$(document.createElement('div'))
|
74
|
+
.addClass('dropdown-backdrop')
|
75
|
+
.insertAfter($(this))
|
76
|
+
.on('click', clearMenus)
|
77
|
+
}
|
78
|
+
|
79
|
+
var relatedTarget = { relatedTarget: this }
|
80
|
+
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
|
81
|
+
|
82
|
+
if (e.isDefaultPrevented()) return
|
83
|
+
|
84
|
+
$this
|
85
|
+
.trigger('focus')
|
86
|
+
.attr('aria-expanded', 'true')
|
87
|
+
|
88
|
+
$parent
|
89
|
+
.toggleClass('open')
|
90
|
+
.trigger($.Event('shown.bs.dropdown', relatedTarget))
|
91
|
+
}
|
92
|
+
|
93
|
+
return false
|
94
|
+
}
|
95
|
+
|
96
|
+
Dropdown.prototype.keydown = function (e) {
|
97
|
+
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
|
98
|
+
|
99
|
+
var $this = $(this)
|
100
|
+
|
101
|
+
e.preventDefault()
|
102
|
+
e.stopPropagation()
|
103
|
+
|
104
|
+
if ($this.is('.disabled, :disabled')) return
|
105
|
+
|
106
|
+
var $parent = getParent($this)
|
107
|
+
var isActive = $parent.hasClass('open')
|
108
|
+
|
109
|
+
if (!isActive && e.which != 27 || isActive && e.which == 27) {
|
110
|
+
if (e.which == 27) $parent.find(toggle).trigger('focus')
|
111
|
+
return $this.trigger('click')
|
112
|
+
}
|
113
|
+
|
114
|
+
var desc = ' li:not(.disabled):visible a'
|
115
|
+
var $items = $parent.find('.dropdown-menu' + desc)
|
116
|
+
|
117
|
+
if (!$items.length) return
|
118
|
+
|
119
|
+
var index = $items.index(e.target)
|
120
|
+
|
121
|
+
if (e.which == 38 && index > 0) index-- // up
|
122
|
+
if (e.which == 40 && index < $items.length - 1) index++ // down
|
123
|
+
if (!~index) index = 0
|
124
|
+
|
125
|
+
$items.eq(index).trigger('focus')
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
// DROPDOWN PLUGIN DEFINITION
|
130
|
+
// ==========================
|
131
|
+
|
132
|
+
function Plugin(option) {
|
133
|
+
return this.each(function () {
|
134
|
+
var $this = $(this)
|
135
|
+
var data = $this.data('bs.dropdown')
|
136
|
+
|
137
|
+
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
|
138
|
+
if (typeof option == 'string') data[option].call($this)
|
139
|
+
})
|
140
|
+
}
|
141
|
+
|
142
|
+
var old = $.fn.dropdown
|
143
|
+
|
144
|
+
$.fn.dropdown = Plugin
|
145
|
+
$.fn.dropdown.Constructor = Dropdown
|
146
|
+
|
147
|
+
|
148
|
+
// DROPDOWN NO CONFLICT
|
149
|
+
// ====================
|
150
|
+
|
151
|
+
$.fn.dropdown.noConflict = function () {
|
152
|
+
$.fn.dropdown = old
|
153
|
+
return this
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
// APPLY TO STANDARD DROPDOWN ELEMENTS
|
158
|
+
// ===================================
|
159
|
+
|
160
|
+
$(document)
|
161
|
+
.on('click.bs.dropdown.data-api', clearMenus)
|
162
|
+
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
163
|
+
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
164
|
+
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
|
165
|
+
.on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
|
166
|
+
|
167
|
+
}(jQuery);
|