dvl-core 0.0.1

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.hound.yml +5 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE.md +20 -0
  7. data/README.md +35 -0
  8. data/circle.yml +7 -0
  9. data/dvl-core.gemspec +30 -0
  10. data/lib/dvl/core.rb +11 -0
  11. data/lib/dvl/core/version.rb +5 -0
  12. data/preview/app.rb +252 -0
  13. data/script/bootstrap +45 -0
  14. data/script/cibuild +3 -0
  15. data/script/preview +3 -0
  16. data/script/release +38 -0
  17. data/spec/dvl_core_spec.rb +30 -0
  18. data/vendor/assets/javascripts/dvl/core.js +4 -0
  19. data/vendor/assets/javascripts/dvl/core/buttons.js +116 -0
  20. data/vendor/assets/javascripts/dvl/core/dropdowns.js +161 -0
  21. data/vendor/assets/javascripts/dvl/core/modals.js +281 -0
  22. data/vendor/assets/javascripts/dvl/core/tooltips.js +478 -0
  23. data/vendor/assets/stylesheets/dvl/core.scss +21 -0
  24. data/vendor/assets/stylesheets/dvl/core/buttons.scss +152 -0
  25. data/vendor/assets/stylesheets/dvl/core/code.scss +31 -0
  26. data/vendor/assets/stylesheets/dvl/core/dropdowns.scss +309 -0
  27. data/vendor/assets/stylesheets/dvl/core/forms.scss +434 -0
  28. data/vendor/assets/stylesheets/dvl/core/grid.scss +87 -0
  29. data/vendor/assets/stylesheets/dvl/core/includes.scss +163 -0
  30. data/vendor/assets/stylesheets/dvl/core/labels.scss +31 -0
  31. data/vendor/assets/stylesheets/dvl/core/legacy.scss +287 -0
  32. data/vendor/assets/stylesheets/dvl/core/links.scss +53 -0
  33. data/vendor/assets/stylesheets/dvl/core/lists.scss +30 -0
  34. data/vendor/assets/stylesheets/dvl/core/media.scss +24 -0
  35. data/vendor/assets/stylesheets/dvl/core/modals.scss +173 -0
  36. data/vendor/assets/stylesheets/dvl/core/pagination.scss +70 -0
  37. data/vendor/assets/stylesheets/dvl/core/print.scss +69 -0
  38. data/vendor/assets/stylesheets/dvl/core/progress.scss +16 -0
  39. data/vendor/assets/stylesheets/dvl/core/resets.scss +92 -0
  40. data/vendor/assets/stylesheets/dvl/core/shame.scss +35 -0
  41. data/vendor/assets/stylesheets/dvl/core/sidebar.scss +101 -0
  42. data/vendor/assets/stylesheets/dvl/core/tables.scss +122 -0
  43. data/vendor/assets/stylesheets/dvl/core/tooltips.scss +87 -0
  44. data/vendor/assets/stylesheets/dvl/core/typography.scss +158 -0
  45. metadata +228 -0
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ bundle exec rerun 'ruby preview/app.rb'
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ # Make sure we're in the project root.
7
+
8
+ cd $(dirname "$0")/..
9
+
10
+ # Build a new gem archive.
11
+
12
+ rm -rf dvl-core-*.gem
13
+ gem build -q dvl-core.gemspec
14
+
15
+ # Make sure we're on the master branch.
16
+
17
+ (git branch | grep -q '* master') || {
18
+ echo "Only release from the master branch."
19
+ exit 1
20
+ }
21
+
22
+ # Figure out what version we're releasing.
23
+
24
+ tag=v`ls dvl-core-*.gem | sed 's/^dvl-core-\(.*\)\.gem$/\1/'`
25
+
26
+ # Make sure we haven't released this version before.
27
+
28
+ git fetch -t origin
29
+
30
+ (git tag -l | grep -q "$tag") && {
31
+ echo "Whoops, there's already a '${tag}' tag."
32
+ exit 1
33
+ }
34
+
35
+ # Tag it and bag it.
36
+
37
+ gem push dvl-core-*.gem && git tag "$tag" &&
38
+ git push origin master && git push origin "$tag"
@@ -0,0 +1,30 @@
1
+ require 'capybara/rspec'
2
+ require 'capybara/poltergeist'
3
+ require 'active_support/all'
4
+ require 'erector'
5
+ require 'dvl/core'
6
+ require_relative '../preview/app'
7
+
8
+ Capybara.app = App
9
+ Capybara.javascript_driver = :poltergeist
10
+
11
+ def take_screenshot(path, name, res_x = 900, res_y = 150, opts = {})
12
+ describe "taking screenshot: #{name}.png" do
13
+ before do
14
+ page.driver.resize(res_x, res_y)
15
+ end
16
+
17
+ it 'works' do
18
+ visit path
19
+ page.save_screenshot "screenshots/#{name}.png", opts
20
+ end
21
+ end
22
+ end
23
+
24
+ describe Dvl::Core do
25
+ describe 'Screenshots', type: :feature, js: true do
26
+ take_screenshot '/', 'all_1200', 1200, 1000, full: true
27
+ take_screenshot '/', 'all_760', 760, 1000, full: true
28
+ take_screenshot '/', 'all_400', 400, 1000, full: true
29
+ end
30
+ end
@@ -0,0 +1,4 @@
1
+ //= require dvl/core/dropdowns
2
+ //= require dvl/core/tooltips
3
+ //= require dvl/core/modals
4
+ //= require dvl/core/buttons
@@ -0,0 +1,116 @@
1
+ /* ========================================================================
2
+ * Bootstrap: button.js v3.3.0
3
+ * http://getbootstrap.com/javascript/#buttons
4
+ * ========================================================================
5
+ * Copyright 2011-2014 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.0'
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 = 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)
45
+ } else if (this.isLoading) {
46
+ this.isLoading = false
47
+ $el.removeClass(d).removeAttr(d)
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') && this.$element.hasClass('active')) changed = false
60
+ else $parent.find('.active').removeClass('active')
61
+ }
62
+ if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
63
+ } else {
64
+ this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
65
+ }
66
+
67
+ if (changed) this.$element.toggleClass('active')
68
+ }
69
+
70
+
71
+ // BUTTON PLUGIN DEFINITION
72
+ // ========================
73
+
74
+ function Plugin(option) {
75
+ return this.each(function () {
76
+ var $this = $(this)
77
+ var data = $this.data('bs.button')
78
+ var options = typeof option == 'object' && option
79
+
80
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
81
+
82
+ if (option == 'toggle') data.toggle()
83
+ else if (option) data.setState(option)
84
+ })
85
+ }
86
+
87
+ var old = $.fn.button
88
+
89
+ $.fn.button = Plugin
90
+ $.fn.button.Constructor = Button
91
+
92
+
93
+ // BUTTON NO CONFLICT
94
+ // ==================
95
+
96
+ $.fn.button.noConflict = function () {
97
+ $.fn.button = old
98
+ return this
99
+ }
100
+
101
+
102
+ // BUTTON DATA-API
103
+ // ===============
104
+
105
+ $(document)
106
+ .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
107
+ var $btn = $(e.target)
108
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
109
+ Plugin.call($btn, 'toggle')
110
+ e.preventDefault()
111
+ })
112
+ .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
113
+ $(e.target).closest('.btn').toggleClass('focus', e.type == 'focus')
114
+ })
115
+
116
+ }(jQuery);
@@ -0,0 +1,161 @@
1
+ /* ========================================================================
2
+ * Bootstrap: dropdown.js v3.3.0
3
+ * http://getbootstrap.com/javascript/#dropdowns
4
+ * ========================================================================
5
+ * Copyright 2011-2014 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.0'
23
+
24
+ Dropdown.prototype.toggle = function (e) {
25
+ var $this = $(this)
26
+
27
+ if ($this.is('.disabled, :disabled')) return
28
+
29
+ var $parent = getParent($this)
30
+ var isActive = $parent.hasClass('open')
31
+
32
+ clearMenus()
33
+
34
+ if (!isActive) {
35
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
36
+ // if mobile we use a backdrop because click events don't delegate
37
+ $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
38
+ }
39
+
40
+ var relatedTarget = { relatedTarget: this }
41
+ $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
42
+
43
+ if (e.isDefaultPrevented()) return
44
+
45
+ $this
46
+ .trigger('focus')
47
+ .attr('aria-expanded', 'true')
48
+
49
+ $parent
50
+ .toggleClass('open')
51
+ .trigger('shown.bs.dropdown', relatedTarget)
52
+ }
53
+
54
+ return false
55
+ }
56
+
57
+ Dropdown.prototype.keydown = function (e) {
58
+ if (!/(38|40|27|32)/.test(e.which)) return
59
+
60
+ var $this = $(this)
61
+
62
+ e.preventDefault()
63
+ e.stopPropagation()
64
+
65
+ if ($this.is('.disabled, :disabled')) return
66
+
67
+ var $parent = getParent($this)
68
+ var isActive = $parent.hasClass('open')
69
+
70
+ if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
71
+ if (e.which == 27) $parent.find(toggle).trigger('focus')
72
+ return $this.trigger('click')
73
+ }
74
+
75
+ var desc = ' li:not(.divider):visible a'
76
+ var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
77
+
78
+ if (!$items.length) return
79
+
80
+ var index = $items.index(e.target)
81
+
82
+ if (e.which == 38 && index > 0) index-- // up
83
+ if (e.which == 40 && index < $items.length - 1) index++ // down
84
+ if (!~index) index = 0
85
+
86
+ $items.eq(index).trigger('focus')
87
+ }
88
+
89
+ function clearMenus(e) {
90
+ if (e && e.which === 3) return
91
+ $(backdrop).remove()
92
+ $(toggle).each(function () {
93
+ var $this = $(this)
94
+ var $parent = getParent($this)
95
+ var relatedTarget = { relatedTarget: this }
96
+
97
+ if (!$parent.hasClass('open')) return
98
+
99
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
100
+
101
+ if (e.isDefaultPrevented()) return
102
+
103
+ $this.attr('aria-expanded', 'false')
104
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
105
+ })
106
+ }
107
+
108
+ function getParent($this) {
109
+ var selector = $this.attr('data-target')
110
+
111
+ if (!selector) {
112
+ selector = $this.attr('href')
113
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
114
+ }
115
+
116
+ var $parent = selector && $(selector)
117
+
118
+ return $parent && $parent.length ? $parent : $this.parent()
119
+ }
120
+
121
+
122
+ // DROPDOWN PLUGIN DEFINITION
123
+ // ==========================
124
+
125
+ function Plugin(option) {
126
+ return this.each(function () {
127
+ var $this = $(this)
128
+ var data = $this.data('bs.dropdown')
129
+
130
+ if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
131
+ if (typeof option == 'string') data[option].call($this)
132
+ })
133
+ }
134
+
135
+ var old = $.fn.dropdown
136
+
137
+ $.fn.dropdown = Plugin
138
+ $.fn.dropdown.Constructor = Dropdown
139
+
140
+
141
+ // DROPDOWN NO CONFLICT
142
+ // ====================
143
+
144
+ $.fn.dropdown.noConflict = function () {
145
+ $.fn.dropdown = old
146
+ return this
147
+ }
148
+
149
+
150
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
151
+ // ===================================
152
+
153
+ $(document)
154
+ .on('click.bs.dropdown.data-api', clearMenus)
155
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
156
+ .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
157
+ .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
158
+ .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
159
+ .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
160
+
161
+ }(jQuery);
@@ -0,0 +1,281 @@
1
+ /* ========================================================================
2
+ * Bootstrap: modal.js v3.3.0
3
+ * http://getbootstrap.com/javascript/#modals
4
+ * ========================================================================
5
+ * Copyright 2011-2014 Twitter, Inc.
6
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
+ * ======================================================================== */
8
+
9
+
10
+ +function ($) {
11
+ 'use strict';
12
+
13
+ // MODAL CLASS DEFINITION
14
+ // ======================
15
+
16
+ var Modal = function (element, options) {
17
+ this.options = options
18
+ this.$body = $(document.body)
19
+ this.$element = $(element)
20
+ this.$backdrop =
21
+ this.isShown = null
22
+ this.scrollbarWidth = 0
23
+
24
+ if (this.options.remote) {
25
+ this.$element
26
+ .find('.modal-content')
27
+ .load(this.options.remote, $.proxy(function () {
28
+ this.$element.trigger('loaded.bs.modal')
29
+ }, this))
30
+ }
31
+ }
32
+
33
+ Modal.VERSION = '3.3.0'
34
+
35
+ Modal.TRANSITION_DURATION = 300
36
+ Modal.BACKDROP_TRANSITION_DURATION = 150
37
+
38
+ Modal.DEFAULTS = {
39
+ backdrop: true,
40
+ keyboard: true,
41
+ show: true
42
+ }
43
+
44
+ Modal.prototype.toggle = function (_relatedTarget) {
45
+ return this.isShown ? this.hide() : this.show(_relatedTarget)
46
+ }
47
+
48
+ Modal.prototype.show = function (_relatedTarget) {
49
+ var that = this
50
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
51
+
52
+ this.$element.trigger(e)
53
+
54
+ if (this.isShown || e.isDefaultPrevented()) return
55
+
56
+ this.isShown = true
57
+
58
+ this.checkScrollbar()
59
+ this.$body.addClass('modal-open')
60
+
61
+ this.setScrollbar()
62
+ this.escape()
63
+
64
+ this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
65
+
66
+ this.backdrop(function () {
67
+ var transition = $.support.transition && that.$element.hasClass('fade')
68
+
69
+ if (!that.$element.parent().length) {
70
+ that.$element.appendTo(that.$body) // don't move modals dom position
71
+ }
72
+
73
+ that.$element
74
+ .show()
75
+ .scrollTop(0)
76
+
77
+ if (transition) {
78
+ that.$element[0].offsetWidth // force reflow
79
+ }
80
+
81
+ that.$element
82
+ .addClass('in')
83
+ .attr('aria-hidden', false)
84
+
85
+ that.enforceFocus()
86
+
87
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
88
+
89
+ transition ?
90
+ that.$element.find('.modal-dialog') // wait for modal to slide in
91
+ .one('bsTransitionEnd', function () {
92
+ that.$element.trigger('focus').trigger(e)
93
+ })
94
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
95
+ that.$element.trigger('focus').trigger(e)
96
+ })
97
+ }
98
+
99
+ Modal.prototype.hide = function (e) {
100
+ if (e) e.preventDefault()
101
+
102
+ e = $.Event('hide.bs.modal')
103
+
104
+ this.$element.trigger(e)
105
+
106
+ if (!this.isShown || e.isDefaultPrevented()) return
107
+
108
+ this.isShown = false
109
+
110
+ this.escape()
111
+
112
+ $(document).off('focusin.bs.modal')
113
+
114
+ this.$element
115
+ .removeClass('in')
116
+ .attr('aria-hidden', true)
117
+ .off('click.dismiss.bs.modal')
118
+
119
+ $.support.transition && this.$element.hasClass('fade') ?
120
+ this.$element
121
+ .one('bsTransitionEnd', $.proxy(this.hideModal, this))
122
+ .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
123
+ this.hideModal()
124
+ }
125
+
126
+ Modal.prototype.enforceFocus = function () {
127
+ $(document)
128
+ .off('focusin.bs.modal') // guard against infinite focus loop
129
+ .on('focusin.bs.modal', $.proxy(function (e) {
130
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
131
+ this.$element.trigger('focus')
132
+ }
133
+ }, this))
134
+ }
135
+
136
+ Modal.prototype.escape = function () {
137
+ if (this.isShown && this.options.keyboard) {
138
+ this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
139
+ e.which == 27 && this.hide()
140
+ }, this))
141
+ } else if (!this.isShown) {
142
+ this.$element.off('keydown.dismiss.bs.modal')
143
+ }
144
+ }
145
+
146
+ Modal.prototype.hideModal = function () {
147
+ var that = this
148
+ this.$element.hide()
149
+ this.backdrop(function () {
150
+ that.$body.removeClass('modal-open')
151
+ that.resetScrollbar()
152
+ that.$element.trigger('hidden.bs.modal')
153
+ })
154
+ }
155
+
156
+ Modal.prototype.removeBackdrop = function () {
157
+ this.$backdrop && this.$backdrop.remove()
158
+ this.$backdrop = null
159
+ }
160
+
161
+ Modal.prototype.backdrop = function (callback) {
162
+ var that = this
163
+ var animate = this.$element.hasClass('fade') ? 'fade' : ''
164
+
165
+ if (this.isShown && this.options.backdrop) {
166
+ var doAnimate = $.support.transition && animate
167
+
168
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
169
+ .prependTo(this.$element)
170
+ .on('click.dismiss.bs.modal', $.proxy(function (e) {
171
+ if (e.target !== e.currentTarget) return
172
+ this.options.backdrop == 'static'
173
+ ? this.$element[0].focus.call(this.$element[0])
174
+ : this.hide.call(this)
175
+ }, this))
176
+
177
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
178
+
179
+ this.$backdrop.addClass('in')
180
+
181
+ if (!callback) return
182
+
183
+ doAnimate ?
184
+ this.$backdrop
185
+ .one('bsTransitionEnd', callback)
186
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
187
+ callback()
188
+
189
+ } else if (!this.isShown && this.$backdrop) {
190
+ this.$backdrop.removeClass('in')
191
+
192
+ var callbackRemove = function () {
193
+ that.removeBackdrop()
194
+ callback && callback()
195
+ }
196
+ $.support.transition && this.$element.hasClass('fade') ?
197
+ this.$backdrop
198
+ .one('bsTransitionEnd', callbackRemove)
199
+ .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
200
+ callbackRemove()
201
+
202
+ } else if (callback) {
203
+ callback()
204
+ }
205
+ }
206
+
207
+ Modal.prototype.checkScrollbar = function () {
208
+ this.scrollbarWidth = this.measureScrollbar()
209
+ }
210
+
211
+ Modal.prototype.setScrollbar = function () {
212
+ var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
213
+ if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
214
+ }
215
+
216
+ Modal.prototype.resetScrollbar = function () {
217
+ this.$body.css('padding-right', '')
218
+ }
219
+
220
+ Modal.prototype.measureScrollbar = function () { // thx walsh
221
+ if (document.body.clientWidth >= window.innerWidth) return 0
222
+ var scrollDiv = document.createElement('div')
223
+ scrollDiv.className = 'modal-scrollbar-measure'
224
+ this.$body.append(scrollDiv)
225
+ var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
226
+ this.$body[0].removeChild(scrollDiv)
227
+ return scrollbarWidth
228
+ }
229
+
230
+
231
+ // MODAL PLUGIN DEFINITION
232
+ // =======================
233
+
234
+ function Plugin(option, _relatedTarget) {
235
+ return this.each(function () {
236
+ var $this = $(this)
237
+ var data = $this.data('bs.modal')
238
+ var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
239
+
240
+ if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
241
+ if (typeof option == 'string') data[option](_relatedTarget)
242
+ else if (options.show) data.show(_relatedTarget)
243
+ })
244
+ }
245
+
246
+ var old = $.fn.modal
247
+
248
+ $.fn.modal = Plugin
249
+ $.fn.modal.Constructor = Modal
250
+
251
+
252
+ // MODAL NO CONFLICT
253
+ // =================
254
+
255
+ $.fn.modal.noConflict = function () {
256
+ $.fn.modal = old
257
+ return this
258
+ }
259
+
260
+
261
+ // MODAL DATA-API
262
+ // ==============
263
+
264
+ $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
265
+ var $this = $(this)
266
+ var href = $this.attr('href')
267
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
268
+ var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
269
+
270
+ if ($this.is('a')) e.preventDefault()
271
+
272
+ $target.one('show.bs.modal', function (showEvent) {
273
+ if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
274
+ $target.one('hidden.bs.modal', function () {
275
+ $this.is(':visible') && $this.trigger('focus')
276
+ })
277
+ })
278
+ Plugin.call($target, option, this)
279
+ })
280
+
281
+ }(jQuery);