flashgrid 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3c94126a9a837e477c52030feb619440298b17a
4
- data.tar.gz: 300ce9d1b55e50a1e45333e71a3c9dfd7506930c
3
+ metadata.gz: 0abcc0398ac203da8bbb35af2c2fd809f9d7ce1d
4
+ data.tar.gz: 7ba992037691c8183d466fb940cad2adbfef1247
5
5
  SHA512:
6
- metadata.gz: 7e9d6cf7f02601c70ef7820a0689650f5a5b1dc90916ed1f7daf0cb770d6e7142a6bc0fd46291df192b87072eaa7de686d019fc3e1593ef8c204217c8e816763
7
- data.tar.gz: fbc36a8ca43397193d01efa22a7ca0993e8b03449cdec5e89e1d33e284c309c8be8048a87fbf32c80766d6eff5309d4458884da2af5ab3c6c0d78bb925745d86
6
+ metadata.gz: 012fd587b486cab3433863a00894516e2bcd88c628e29632b1cebb45574e5077b1529b36efa60c54fc8ad25902db0b4c3f0bfb44121f0cec5eacf023d3154114
7
+ data.tar.gz: 50b4a4f7ddec1029b1c4e67fcdd2404d1aef0d5cdab3cdc6f92929eed933ae6abaad3a4ad7f20602b0475c2cce57e5697f2d8a63fbd090d58b098feaefefb6e9
@@ -1,3 +1,3 @@
1
1
  module Flashgrid
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
@@ -5,12 +5,10 @@
5
5
  // ======================
6
6
 
7
7
  var Modal = function (element, options) {
8
- this.options = options
9
- this.$body = $(document.body)
10
- this.$element = $(element)
11
- this.$backdrop =
12
- this.isShown = null
13
- this.scrollbarWidth = 0
8
+ this.options = options
9
+ this.$element = $(element)
10
+ this.$backdrop =
11
+ this.isShown = null
14
12
 
15
13
  if (this.options.remote) {
16
14
  this.$element
@@ -21,11 +19,6 @@
21
19
  }
22
20
  }
23
21
 
24
- Modal.VERSION = '3.3.1'
25
-
26
- Modal.TRANSITION_DURATION = 300
27
- Modal.BACKDROP_TRANSITION_DURATION = 150
28
-
29
22
  Modal.DEFAULTS = {
30
23
  backdrop: true,
31
24
  keyboard: true,
@@ -33,7 +26,7 @@
33
26
  }
34
27
 
35
28
  Modal.prototype.toggle = function (_relatedTarget) {
36
- return this.isShown ? this.hide() : this.show(_relatedTarget)
29
+ return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
37
30
  }
38
31
 
39
32
  Modal.prototype.show = function (_relatedTarget) {
@@ -46,12 +39,7 @@
46
39
 
47
40
  this.isShown = true
48
41
 
49
- this.checkScrollbar()
50
- this.setScrollbar()
51
- this.$body.addClass('modal-open')
52
-
53
42
  this.escape()
54
- this.resize()
55
43
 
56
44
  this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
57
45
 
@@ -59,16 +47,13 @@
59
47
  var transition = $.support.transition && that.$element.hasClass('fade')
60
48
 
61
49
  if (!that.$element.parent().length) {
62
- that.$element.appendTo(that.$body) // don't move modals dom position
50
+ that.$element.appendTo(document.body) // don't move modals dom position
63
51
  }
64
52
 
65
53
  that.$element
66
54
  .show()
67
55
  .scrollTop(0)
68
56
 
69
- if (that.options.backdrop) that.adjustBackdrop()
70
- that.adjustDialog()
71
-
72
57
  if (transition) {
73
58
  that.$element[0].offsetWidth // force reflow
74
59
  }
@@ -83,11 +68,11 @@
83
68
 
84
69
  transition ?
85
70
  that.$element.find('.modal-dialog') // wait for modal to slide in
86
- .one('bsTransitionEnd', function () {
87
- that.$element.trigger('focus').trigger(e)
71
+ .one($.support.transition.end, function () {
72
+ that.$element.focus().trigger(e)
88
73
  })
89
- .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
90
- that.$element.trigger('focus').trigger(e)
74
+ .emulateTransitionEnd(300) :
75
+ that.$element.focus().trigger(e)
91
76
  })
92
77
  }
93
78
 
@@ -103,7 +88,6 @@
103
88
  this.isShown = false
104
89
 
105
90
  this.escape()
106
- this.resize()
107
91
 
108
92
  $(document).off('focusin.bs.modal')
109
93
 
@@ -114,8 +98,8 @@
114
98
 
115
99
  $.support.transition && this.$element.hasClass('fade') ?
116
100
  this.$element
117
- .one('bsTransitionEnd', $.proxy(this.hideModal, this))
118
- .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
101
+ .one($.support.transition.end, $.proxy(this.hideModal, this))
102
+ .emulateTransitionEnd(300) :
119
103
  this.hideModal()
120
104
  }
121
105
 
@@ -124,26 +108,18 @@
124
108
  .off('focusin.bs.modal') // guard against infinite focus loop
125
109
  .on('focusin.bs.modal', $.proxy(function (e) {
126
110
  if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
127
- this.$element.trigger('focus')
111
+ this.$element.focus()
128
112
  }
129
113
  }, this))
130
114
  }
131
115
 
132
116
  Modal.prototype.escape = function () {
133
117
  if (this.isShown && this.options.keyboard) {
134
- this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
118
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
135
119
  e.which == 27 && this.hide()
136
120
  }, this))
137
121
  } else if (!this.isShown) {
138
- this.$element.off('keydown.dismiss.bs.modal')
139
- }
140
- }
141
-
142
- Modal.prototype.resize = function () {
143
- if (this.isShown) {
144
- $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
145
- } else {
146
- $(window).off('resize.bs.modal')
122
+ this.$element.off('keyup.dismiss.bs.modal')
147
123
  }
148
124
  }
149
125
 
@@ -151,9 +127,7 @@
151
127
  var that = this
152
128
  this.$element.hide()
153
129
  this.backdrop(function () {
154
- that.$body.removeClass('modal-open')
155
- that.resetAdjustments()
156
- that.resetScrollbar()
130
+ that.removeBackdrop()
157
131
  that.$element.trigger('hidden.bs.modal')
158
132
  })
159
133
  }
@@ -164,20 +138,20 @@
164
138
  }
165
139
 
166
140
  Modal.prototype.backdrop = function (callback) {
167
- var that = this
168
141
  var animate = this.$element.hasClass('fade') ? 'fade' : ''
169
142
 
170
143
  if (this.isShown && this.options.backdrop) {
171
144
  var doAnimate = $.support.transition && animate
172
145
 
173
146
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
174
- .prependTo(this.$element)
175
- .on('click.dismiss.bs.modal', $.proxy(function (e) {
176
- if (e.target !== e.currentTarget) return
177
- this.options.backdrop == 'static'
178
- ? this.$element[0].focus.call(this.$element[0])
179
- : this.hide.call(this)
180
- }, this))
147
+ .appendTo(document.body)
148
+
149
+ this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
150
+ if (e.target !== e.currentTarget) return
151
+ this.options.backdrop == 'static'
152
+ ? this.$element[0].focus.call(this.$element[0])
153
+ : this.hide.call(this)
154
+ }, this))
181
155
 
182
156
  if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
183
157
 
@@ -187,85 +161,31 @@
187
161
 
188
162
  doAnimate ?
189
163
  this.$backdrop
190
- .one('bsTransitionEnd', callback)
191
- .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
164
+ .one($.support.transition.end, callback)
165
+ .emulateTransitionEnd(150) :
192
166
  callback()
193
167
 
194
168
  } else if (!this.isShown && this.$backdrop) {
195
169
  this.$backdrop.removeClass('in')
196
170
 
197
- var callbackRemove = function () {
198
- that.removeBackdrop()
199
- callback && callback()
200
- }
201
171
  $.support.transition && this.$element.hasClass('fade') ?
202
172
  this.$backdrop
203
- .one('bsTransitionEnd', callbackRemove)
204
- .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
205
- callbackRemove()
173
+ .one($.support.transition.end, callback)
174
+ .emulateTransitionEnd(150) :
175
+ callback()
206
176
 
207
177
  } else if (callback) {
208
178
  callback()
209
179
  }
210
180
  }
211
181
 
212
- // these following methods are used to handle overflowing modals
213
-
214
- Modal.prototype.handleUpdate = function () {
215
- if (this.options.backdrop) this.adjustBackdrop()
216
- this.adjustDialog()
217
- }
218
-
219
- Modal.prototype.adjustBackdrop = function () {
220
- this.$backdrop
221
- .css('height', 0)
222
- .css('height', this.$element[0].scrollHeight)
223
- }
224
-
225
- Modal.prototype.adjustDialog = function () {
226
- var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
227
-
228
- this.$element.css({
229
- paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
230
- paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
231
- })
232
- }
233
-
234
- Modal.prototype.resetAdjustments = function () {
235
- this.$element.css({
236
- paddingLeft: '',
237
- paddingRight: ''
238
- })
239
- }
240
-
241
- Modal.prototype.checkScrollbar = function () {
242
- this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight
243
- this.scrollbarWidth = this.measureScrollbar()
244
- }
245
-
246
- Modal.prototype.setScrollbar = function () {
247
- var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
248
- if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
249
- }
250
-
251
- Modal.prototype.resetScrollbar = function () {
252
- this.$body.css('padding-right', '')
253
- }
254
-
255
- Modal.prototype.measureScrollbar = function () { // thx walsh
256
- var scrollDiv = document.createElement('div')
257
- scrollDiv.className = 'modal-scrollbar-measure'
258
- this.$body.append(scrollDiv)
259
- var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
260
- this.$body[0].removeChild(scrollDiv)
261
- return scrollbarWidth
262
- }
263
-
264
182
 
265
183
  // MODAL PLUGIN DEFINITION
266
184
  // =======================
267
185
 
268
- function Plugin(option, _relatedTarget) {
186
+ var old = $.fn.modal
187
+
188
+ $.fn.modal = function (option, _relatedTarget) {
269
189
  return this.each(function () {
270
190
  var $this = $(this)
271
191
  var data = $this.data('bs.modal')
@@ -277,9 +197,6 @@
277
197
  })
278
198
  }
279
199
 
280
- var old = $.fn.modal
281
-
282
- $.fn.modal = Plugin
283
200
  $.fn.modal.Constructor = Modal
284
201
 
285
202
 
@@ -298,18 +215,20 @@
298
215
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
299
216
  var $this = $(this)
300
217
  var href = $this.attr('href')
301
- var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
218
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
302
219
  var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
303
220
 
304
221
  if ($this.is('a')) e.preventDefault()
305
222
 
306
- $target.one('show.bs.modal', function (showEvent) {
307
- if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
308
- $target.one('hidden.bs.modal', function () {
309
- $this.is(':visible') && $this.trigger('focus')
223
+ $target
224
+ .modal(option, this)
225
+ .one('hide', function () {
226
+ $this.is(':visible') && $this.focus()
310
227
  })
311
- })
312
- Plugin.call($target, option, this)
313
228
  })
314
229
 
230
+ $(document)
231
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
232
+ .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
233
+
315
234
  }(jQuery);
@@ -6,27 +6,32 @@
6
6
  /* #Modal
7
7
  ================================================== */
8
8
  .modal-backdrop {
9
- background: rgba(71,74,84,1);
9
+ background: rgba(71,74,84,0.8);
10
10
  bottom: 0;
11
+ height: 100%;
11
12
  left: 0;
13
+ min-height: 100%;
12
14
  position: fixed;
13
15
  right: 0;
14
16
  top: 0;
15
17
  z-index: 1040;
16
18
  }
17
- .modal-backdrop.fade { opacity: 0; }
18
- .modal-backdrop,
19
+ .modal-backdrop.fade {
20
+ filter: alpha(opacity=0);
21
+ opacity: 0;
22
+ }
19
23
  .modal-backdrop.fade.in {
20
- opacity: 0.8;
21
- filter: alpha(opacity=80);
24
+ filter: alpha(opacity=100);
25
+ opacity: 1;
22
26
  }
23
27
  .modal {
24
28
  background-clip: padding-box;
25
29
  background: rgba(255,255,255,1);
26
30
  border-radius: 5px;
27
31
  box-shadow: 0 0 3px rgba(0,0,0,0.25);
32
+ display: none;
28
33
  margin: 0 auto;
29
- outline: none;
34
+ outline: 0;
30
35
  position: fixed;
31
36
  top: 0;
32
37
  width: 560px;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flashgrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez