kanpachi 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/bower.json +1 -0
  4. data/kanpachi.gemspec +1 -1
  5. data/lib/kanpachi/doc/template/components/bootstrap/.bower.json +34 -0
  6. data/lib/kanpachi/doc/template/components/bootstrap/Gruntfile.js +421 -0
  7. data/lib/kanpachi/doc/template/components/bootstrap/LICENSE +21 -0
  8. data/lib/kanpachi/doc/template/components/bootstrap/README.md +173 -0
  9. data/lib/kanpachi/doc/template/components/bootstrap/bower.json +24 -0
  10. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap-theme.css +0 -0
  11. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap-theme.css.map +0 -0
  12. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap-theme.min.css +0 -0
  13. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap.css +0 -0
  14. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap.css.map +0 -0
  15. data/lib/kanpachi/doc/template/{source/stylesheets → components/bootstrap/dist/css}/bootstrap.min.css +0 -0
  16. data/lib/kanpachi/doc/template/components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  17. data/lib/kanpachi/doc/template/components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  18. data/lib/kanpachi/doc/template/components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  19. data/lib/kanpachi/doc/template/components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  20. data/lib/kanpachi/doc/template/{source/javascripts → components/bootstrap/dist/js}/bootstrap.js +0 -0
  21. data/lib/kanpachi/doc/template/{source/javascripts → components/bootstrap/dist/js}/bootstrap.min.js +0 -0
  22. data/lib/kanpachi/doc/template/components/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  23. data/lib/kanpachi/doc/template/components/bootstrap/fonts/glyphicons-halflings-regular.svg +229 -0
  24. data/lib/kanpachi/doc/template/components/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  25. data/lib/kanpachi/doc/template/components/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  26. data/lib/kanpachi/doc/template/components/bootstrap/grunt/bs-glyphicons-data-generator.js +34 -0
  27. data/lib/kanpachi/doc/template/components/bootstrap/grunt/bs-lessdoc-parser.js +236 -0
  28. data/lib/kanpachi/doc/template/components/bootstrap/grunt/bs-raw-files-generator.js +31 -0
  29. data/lib/kanpachi/doc/template/components/bootstrap/grunt/shrinkwrap.js +28 -0
  30. data/lib/kanpachi/doc/template/components/bootstrap/js/affix.js +137 -0
  31. data/lib/kanpachi/doc/template/components/bootstrap/js/alert.js +88 -0
  32. data/lib/kanpachi/doc/template/components/bootstrap/js/button.js +107 -0
  33. data/lib/kanpachi/doc/template/components/bootstrap/js/carousel.js +205 -0
  34. data/lib/kanpachi/doc/template/components/bootstrap/js/collapse.js +170 -0
  35. data/lib/kanpachi/doc/template/components/bootstrap/js/dropdown.js +147 -0
  36. data/lib/kanpachi/doc/template/components/bootstrap/js/modal.js +243 -0
  37. data/lib/kanpachi/doc/template/components/bootstrap/js/popover.js +110 -0
  38. data/lib/kanpachi/doc/template/components/bootstrap/js/scrollspy.js +153 -0
  39. data/lib/kanpachi/doc/template/components/bootstrap/js/tab.js +125 -0
  40. data/lib/kanpachi/doc/template/components/bootstrap/js/tooltip.js +399 -0
  41. data/lib/kanpachi/doc/template/components/bootstrap/js/transition.js +48 -0
  42. data/lib/kanpachi/doc/template/components/bootstrap/less/alerts.less +67 -0
  43. data/lib/kanpachi/doc/template/components/bootstrap/less/badges.less +55 -0
  44. data/lib/kanpachi/doc/template/components/bootstrap/less/bootstrap.less +49 -0
  45. data/lib/kanpachi/doc/template/components/bootstrap/less/breadcrumbs.less +26 -0
  46. data/lib/kanpachi/doc/template/components/bootstrap/less/button-groups.less +226 -0
  47. data/lib/kanpachi/doc/template/components/bootstrap/less/buttons.less +159 -0
  48. data/lib/kanpachi/doc/template/components/bootstrap/less/carousel.less +232 -0
  49. data/lib/kanpachi/doc/template/components/bootstrap/less/close.less +33 -0
  50. data/lib/kanpachi/doc/template/components/bootstrap/less/code.less +63 -0
  51. data/lib/kanpachi/doc/template/components/bootstrap/less/component-animations.less +29 -0
  52. data/lib/kanpachi/doc/template/components/bootstrap/less/dropdowns.less +213 -0
  53. data/lib/kanpachi/doc/template/components/bootstrap/less/forms.less +438 -0
  54. data/lib/kanpachi/doc/template/components/bootstrap/less/glyphicons.less +233 -0
  55. data/lib/kanpachi/doc/template/components/bootstrap/less/grid.less +84 -0
  56. data/lib/kanpachi/doc/template/components/bootstrap/less/input-groups.less +162 -0
  57. data/lib/kanpachi/doc/template/components/bootstrap/less/jumbotron.less +44 -0
  58. data/lib/kanpachi/doc/template/components/bootstrap/less/labels.less +64 -0
  59. data/lib/kanpachi/doc/template/components/bootstrap/less/list-group.less +110 -0
  60. data/lib/kanpachi/doc/template/components/bootstrap/less/media.less +56 -0
  61. data/lib/kanpachi/doc/template/components/bootstrap/less/mixins.less +929 -0
  62. data/lib/kanpachi/doc/template/components/bootstrap/less/modals.less +139 -0
  63. data/lib/kanpachi/doc/template/components/bootstrap/less/navbar.less +616 -0
  64. data/lib/kanpachi/doc/template/components/bootstrap/less/navs.less +242 -0
  65. data/lib/kanpachi/doc/template/components/bootstrap/less/normalize.less +423 -0
  66. data/lib/kanpachi/doc/template/components/bootstrap/less/pager.less +55 -0
  67. data/lib/kanpachi/doc/template/components/bootstrap/less/pagination.less +88 -0
  68. data/lib/kanpachi/doc/template/components/bootstrap/less/panels.less +241 -0
  69. data/lib/kanpachi/doc/template/components/bootstrap/less/popovers.less +133 -0
  70. data/lib/kanpachi/doc/template/components/bootstrap/less/print.less +101 -0
  71. data/lib/kanpachi/doc/template/components/bootstrap/less/progress-bars.less +80 -0
  72. data/lib/kanpachi/doc/template/components/bootstrap/less/responsive-utilities.less +92 -0
  73. data/lib/kanpachi/doc/template/components/bootstrap/less/scaffolding.less +134 -0
  74. data/lib/kanpachi/doc/template/components/bootstrap/less/tables.less +233 -0
  75. data/lib/kanpachi/doc/template/components/bootstrap/less/theme.less +247 -0
  76. data/lib/kanpachi/doc/template/components/bootstrap/less/thumbnails.less +36 -0
  77. data/lib/kanpachi/doc/template/components/bootstrap/less/tooltip.less +95 -0
  78. data/lib/kanpachi/doc/template/components/bootstrap/less/type.less +293 -0
  79. data/lib/kanpachi/doc/template/components/bootstrap/less/utilities.less +56 -0
  80. data/lib/kanpachi/doc/template/components/bootstrap/less/variables.less +829 -0
  81. data/lib/kanpachi/doc/template/components/bootstrap/less/wells.less +29 -0
  82. data/lib/kanpachi/doc/template/components/bootstrap/package.json +70 -0
  83. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/README.md +100 -0
  84. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/npm-shrinkwrap.canonical.json +1 -0
  85. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/requirements.txt +1 -0
  86. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/s3_cache.py +107 -0
  87. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/sauce_browsers.yml +83 -0
  88. data/lib/kanpachi/doc/template/components/bootstrap/test-infra/uncached-npm-install.sh +4 -0
  89. data/lib/kanpachi/doc/template/components/html5shiv/.bower.json +6 -7
  90. data/lib/kanpachi/doc/template/components/html5shiv/Gruntfile.js +61 -0
  91. data/lib/kanpachi/doc/template/components/html5shiv/bower.json +15 -0
  92. data/lib/kanpachi/doc/template/components/html5shiv/dist/html5shiv-printshiv.js +498 -10
  93. data/lib/kanpachi/doc/template/components/html5shiv/dist/html5shiv-printshiv.min.js +4 -0
  94. data/lib/kanpachi/doc/template/components/html5shiv/dist/html5shiv.js +300 -7
  95. data/lib/kanpachi/doc/template/components/html5shiv/dist/html5shiv.min.js +4 -0
  96. data/lib/kanpachi/doc/template/components/html5shiv/package.json +16 -0
  97. data/lib/kanpachi/doc/template/components/html5shiv/readme.md +3 -3
  98. data/lib/kanpachi/doc/template/source/javascripts/all.coffee +1 -1
  99. data/lib/kanpachi/doc/template/source/layouts/layout.slim +1 -1
  100. data/lib/kanpachi/response.rb +13 -5
  101. data/lib/kanpachi/version.rb +1 -1
  102. metadata +93 -12
@@ -0,0 +1,170 @@
1
+ /* ========================================================================
2
+ * Bootstrap: collapse.js v3.1.1
3
+ * http://getbootstrap.com/javascript/#collapse
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
+ // COLLAPSE PUBLIC CLASS DEFINITION
14
+ // ================================
15
+
16
+ var Collapse = function (element, options) {
17
+ this.$element = $(element)
18
+ this.options = $.extend({}, Collapse.DEFAULTS, options)
19
+ this.transitioning = null
20
+
21
+ if (this.options.parent) this.$parent = $(this.options.parent)
22
+ if (this.options.toggle) this.toggle()
23
+ }
24
+
25
+ Collapse.DEFAULTS = {
26
+ toggle: true
27
+ }
28
+
29
+ Collapse.prototype.dimension = function () {
30
+ var hasWidth = this.$element.hasClass('width')
31
+ return hasWidth ? 'width' : 'height'
32
+ }
33
+
34
+ Collapse.prototype.show = function () {
35
+ if (this.transitioning || this.$element.hasClass('in')) return
36
+
37
+ var startEvent = $.Event('show.bs.collapse')
38
+ this.$element.trigger(startEvent)
39
+ if (startEvent.isDefaultPrevented()) return
40
+
41
+ var actives = this.$parent && this.$parent.find('> .panel > .in')
42
+
43
+ if (actives && actives.length) {
44
+ var hasData = actives.data('bs.collapse')
45
+ if (hasData && hasData.transitioning) return
46
+ actives.collapse('hide')
47
+ hasData || actives.data('bs.collapse', null)
48
+ }
49
+
50
+ var dimension = this.dimension()
51
+
52
+ this.$element
53
+ .removeClass('collapse')
54
+ .addClass('collapsing')
55
+ [dimension](0)
56
+
57
+ this.transitioning = 1
58
+
59
+ var complete = function () {
60
+ this.$element
61
+ .removeClass('collapsing')
62
+ .addClass('collapse in')
63
+ [dimension]('auto')
64
+ this.transitioning = 0
65
+ this.$element.trigger('shown.bs.collapse')
66
+ }
67
+
68
+ if (!$.support.transition) return complete.call(this)
69
+
70
+ var scrollSize = $.camelCase(['scroll', dimension].join('-'))
71
+
72
+ this.$element
73
+ .one($.support.transition.end, $.proxy(complete, this))
74
+ .emulateTransitionEnd(350)
75
+ [dimension](this.$element[0][scrollSize])
76
+ }
77
+
78
+ Collapse.prototype.hide = function () {
79
+ if (this.transitioning || !this.$element.hasClass('in')) return
80
+
81
+ var startEvent = $.Event('hide.bs.collapse')
82
+ this.$element.trigger(startEvent)
83
+ if (startEvent.isDefaultPrevented()) return
84
+
85
+ var dimension = this.dimension()
86
+
87
+ this.$element
88
+ [dimension](this.$element[dimension]())
89
+ [0].offsetHeight
90
+
91
+ this.$element
92
+ .addClass('collapsing')
93
+ .removeClass('collapse')
94
+ .removeClass('in')
95
+
96
+ this.transitioning = 1
97
+
98
+ var complete = function () {
99
+ this.transitioning = 0
100
+ this.$element
101
+ .trigger('hidden.bs.collapse')
102
+ .removeClass('collapsing')
103
+ .addClass('collapse')
104
+ }
105
+
106
+ if (!$.support.transition) return complete.call(this)
107
+
108
+ this.$element
109
+ [dimension](0)
110
+ .one($.support.transition.end, $.proxy(complete, this))
111
+ .emulateTransitionEnd(350)
112
+ }
113
+
114
+ Collapse.prototype.toggle = function () {
115
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
116
+ }
117
+
118
+
119
+ // COLLAPSE PLUGIN DEFINITION
120
+ // ==========================
121
+
122
+ var old = $.fn.collapse
123
+
124
+ $.fn.collapse = function (option) {
125
+ return this.each(function () {
126
+ var $this = $(this)
127
+ var data = $this.data('bs.collapse')
128
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
129
+
130
+ if (!data && options.toggle && option == 'show') option = !option
131
+ if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
132
+ if (typeof option == 'string') data[option]()
133
+ })
134
+ }
135
+
136
+ $.fn.collapse.Constructor = Collapse
137
+
138
+
139
+ // COLLAPSE NO CONFLICT
140
+ // ====================
141
+
142
+ $.fn.collapse.noConflict = function () {
143
+ $.fn.collapse = old
144
+ return this
145
+ }
146
+
147
+
148
+ // COLLAPSE DATA-API
149
+ // =================
150
+
151
+ $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
152
+ var $this = $(this), href
153
+ var target = $this.attr('data-target')
154
+ || e.preventDefault()
155
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
156
+ var $target = $(target)
157
+ var data = $target.data('bs.collapse')
158
+ var option = data ? 'toggle' : $this.data()
159
+ var parent = $this.attr('data-parent')
160
+ var $parent = parent && $(parent)
161
+
162
+ if (!data || !data.transitioning) {
163
+ if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
164
+ $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
165
+ }
166
+
167
+ $target.collapse(option)
168
+ })
169
+
170
+ }(jQuery);
@@ -0,0 +1,147 @@
1
+ /* ========================================================================
2
+ * Bootstrap: dropdown.js v3.1.1
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.prototype.toggle = function (e) {
23
+ var $this = $(this)
24
+
25
+ if ($this.is('.disabled, :disabled')) return
26
+
27
+ var $parent = getParent($this)
28
+ var isActive = $parent.hasClass('open')
29
+
30
+ clearMenus()
31
+
32
+ if (!isActive) {
33
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
34
+ // if mobile we use a backdrop because click events don't delegate
35
+ $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
36
+ }
37
+
38
+ var relatedTarget = { relatedTarget: this }
39
+ $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
40
+
41
+ if (e.isDefaultPrevented()) return
42
+
43
+ $parent
44
+ .toggleClass('open')
45
+ .trigger('shown.bs.dropdown', relatedTarget)
46
+
47
+ $this.focus()
48
+ }
49
+
50
+ return false
51
+ }
52
+
53
+ Dropdown.prototype.keydown = function (e) {
54
+ if (!/(38|40|27)/.test(e.keyCode)) return
55
+
56
+ var $this = $(this)
57
+
58
+ e.preventDefault()
59
+ e.stopPropagation()
60
+
61
+ if ($this.is('.disabled, :disabled')) return
62
+
63
+ var $parent = getParent($this)
64
+ var isActive = $parent.hasClass('open')
65
+
66
+ if (!isActive || (isActive && e.keyCode == 27)) {
67
+ if (e.which == 27) $parent.find(toggle).focus()
68
+ return $this.click()
69
+ }
70
+
71
+ var desc = ' li:not(.divider):visible a'
72
+ var $items = $parent.find('[role=menu]' + desc + ', [role=listbox]' + desc)
73
+
74
+ if (!$items.length) return
75
+
76
+ var index = $items.index($items.filter(':focus'))
77
+
78
+ if (e.keyCode == 38 && index > 0) index-- // up
79
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
80
+ if (!~index) index = 0
81
+
82
+ $items.eq(index).focus()
83
+ }
84
+
85
+ function clearMenus(e) {
86
+ $(backdrop).remove()
87
+ $(toggle).each(function () {
88
+ var $parent = getParent($(this))
89
+ var relatedTarget = { relatedTarget: this }
90
+ if (!$parent.hasClass('open')) return
91
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
92
+ if (e.isDefaultPrevented()) return
93
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
94
+ })
95
+ }
96
+
97
+ function getParent($this) {
98
+ var selector = $this.attr('data-target')
99
+
100
+ if (!selector) {
101
+ selector = $this.attr('href')
102
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
103
+ }
104
+
105
+ var $parent = selector && $(selector)
106
+
107
+ return $parent && $parent.length ? $parent : $this.parent()
108
+ }
109
+
110
+
111
+ // DROPDOWN PLUGIN DEFINITION
112
+ // ==========================
113
+
114
+ var old = $.fn.dropdown
115
+
116
+ $.fn.dropdown = function (option) {
117
+ return this.each(function () {
118
+ var $this = $(this)
119
+ var data = $this.data('bs.dropdown')
120
+
121
+ if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
122
+ if (typeof option == 'string') data[option].call($this)
123
+ })
124
+ }
125
+
126
+ $.fn.dropdown.Constructor = Dropdown
127
+
128
+
129
+ // DROPDOWN NO CONFLICT
130
+ // ====================
131
+
132
+ $.fn.dropdown.noConflict = function () {
133
+ $.fn.dropdown = old
134
+ return this
135
+ }
136
+
137
+
138
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
139
+ // ===================================
140
+
141
+ $(document)
142
+ .on('click.bs.dropdown.data-api', clearMenus)
143
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
144
+ .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
145
+ .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu], [role=listbox]', Dropdown.prototype.keydown)
146
+
147
+ }(jQuery);
@@ -0,0 +1,243 @@
1
+ /* ========================================================================
2
+ * Bootstrap: modal.js v3.1.1
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.$element = $(element)
19
+ this.$backdrop =
20
+ this.isShown = null
21
+
22
+ if (this.options.remote) {
23
+ this.$element
24
+ .find('.modal-content')
25
+ .load(this.options.remote, $.proxy(function () {
26
+ this.$element.trigger('loaded.bs.modal')
27
+ }, this))
28
+ }
29
+ }
30
+
31
+ Modal.DEFAULTS = {
32
+ backdrop: true,
33
+ keyboard: true,
34
+ show: true
35
+ }
36
+
37
+ Modal.prototype.toggle = function (_relatedTarget) {
38
+ return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
39
+ }
40
+
41
+ Modal.prototype.show = function (_relatedTarget) {
42
+ var that = this
43
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
44
+
45
+ this.$element.trigger(e)
46
+
47
+ if (this.isShown || e.isDefaultPrevented()) return
48
+
49
+ this.isShown = true
50
+
51
+ this.escape()
52
+
53
+ this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
54
+
55
+ this.backdrop(function () {
56
+ var transition = $.support.transition && that.$element.hasClass('fade')
57
+
58
+ if (!that.$element.parent().length) {
59
+ that.$element.appendTo(document.body) // don't move modals dom position
60
+ }
61
+
62
+ that.$element
63
+ .show()
64
+ .scrollTop(0)
65
+
66
+ if (transition) {
67
+ that.$element[0].offsetWidth // force reflow
68
+ }
69
+
70
+ that.$element
71
+ .addClass('in')
72
+ .attr('aria-hidden', false)
73
+
74
+ that.enforceFocus()
75
+
76
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
77
+
78
+ transition ?
79
+ that.$element.find('.modal-dialog') // wait for modal to slide in
80
+ .one($.support.transition.end, function () {
81
+ that.$element.focus().trigger(e)
82
+ })
83
+ .emulateTransitionEnd(300) :
84
+ that.$element.focus().trigger(e)
85
+ })
86
+ }
87
+
88
+ Modal.prototype.hide = function (e) {
89
+ if (e) e.preventDefault()
90
+
91
+ e = $.Event('hide.bs.modal')
92
+
93
+ this.$element.trigger(e)
94
+
95
+ if (!this.isShown || e.isDefaultPrevented()) return
96
+
97
+ this.isShown = false
98
+
99
+ this.escape()
100
+
101
+ $(document).off('focusin.bs.modal')
102
+
103
+ this.$element
104
+ .removeClass('in')
105
+ .attr('aria-hidden', true)
106
+ .off('click.dismiss.bs.modal')
107
+
108
+ $.support.transition && this.$element.hasClass('fade') ?
109
+ this.$element
110
+ .one($.support.transition.end, $.proxy(this.hideModal, this))
111
+ .emulateTransitionEnd(300) :
112
+ this.hideModal()
113
+ }
114
+
115
+ Modal.prototype.enforceFocus = function () {
116
+ $(document)
117
+ .off('focusin.bs.modal') // guard against infinite focus loop
118
+ .on('focusin.bs.modal', $.proxy(function (e) {
119
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
120
+ this.$element.focus()
121
+ }
122
+ }, this))
123
+ }
124
+
125
+ Modal.prototype.escape = function () {
126
+ if (this.isShown && this.options.keyboard) {
127
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
128
+ e.which == 27 && this.hide()
129
+ }, this))
130
+ } else if (!this.isShown) {
131
+ this.$element.off('keyup.dismiss.bs.modal')
132
+ }
133
+ }
134
+
135
+ Modal.prototype.hideModal = function () {
136
+ var that = this
137
+ this.$element.hide()
138
+ this.backdrop(function () {
139
+ that.removeBackdrop()
140
+ that.$element.trigger('hidden.bs.modal')
141
+ })
142
+ }
143
+
144
+ Modal.prototype.removeBackdrop = function () {
145
+ this.$backdrop && this.$backdrop.remove()
146
+ this.$backdrop = null
147
+ }
148
+
149
+ Modal.prototype.backdrop = function (callback) {
150
+ var animate = this.$element.hasClass('fade') ? 'fade' : ''
151
+
152
+ if (this.isShown && this.options.backdrop) {
153
+ var doAnimate = $.support.transition && animate
154
+
155
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
156
+ .appendTo(document.body)
157
+
158
+ this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
159
+ if (e.target !== e.currentTarget) return
160
+ this.options.backdrop == 'static'
161
+ ? this.$element[0].focus.call(this.$element[0])
162
+ : this.hide.call(this)
163
+ }, this))
164
+
165
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
166
+
167
+ this.$backdrop.addClass('in')
168
+
169
+ if (!callback) return
170
+
171
+ doAnimate ?
172
+ this.$backdrop
173
+ .one($.support.transition.end, callback)
174
+ .emulateTransitionEnd(150) :
175
+ callback()
176
+
177
+ } else if (!this.isShown && this.$backdrop) {
178
+ this.$backdrop.removeClass('in')
179
+
180
+ $.support.transition && this.$element.hasClass('fade') ?
181
+ this.$backdrop
182
+ .one($.support.transition.end, callback)
183
+ .emulateTransitionEnd(150) :
184
+ callback()
185
+
186
+ } else if (callback) {
187
+ callback()
188
+ }
189
+ }
190
+
191
+
192
+ // MODAL PLUGIN DEFINITION
193
+ // =======================
194
+
195
+ var old = $.fn.modal
196
+
197
+ $.fn.modal = function (option, _relatedTarget) {
198
+ return this.each(function () {
199
+ var $this = $(this)
200
+ var data = $this.data('bs.modal')
201
+ var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
202
+
203
+ if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
204
+ if (typeof option == 'string') data[option](_relatedTarget)
205
+ else if (options.show) data.show(_relatedTarget)
206
+ })
207
+ }
208
+
209
+ $.fn.modal.Constructor = Modal
210
+
211
+
212
+ // MODAL NO CONFLICT
213
+ // =================
214
+
215
+ $.fn.modal.noConflict = function () {
216
+ $.fn.modal = old
217
+ return this
218
+ }
219
+
220
+
221
+ // MODAL DATA-API
222
+ // ==============
223
+
224
+ $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
225
+ var $this = $(this)
226
+ var href = $this.attr('href')
227
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
228
+ var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
229
+
230
+ if ($this.is('a')) e.preventDefault()
231
+
232
+ $target
233
+ .modal(option, this)
234
+ .one('hide', function () {
235
+ $this.is(':visible') && $this.focus()
236
+ })
237
+ })
238
+
239
+ $(document)
240
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
241
+ .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
242
+
243
+ }(jQuery);