semantic-ui-sass 0.16.1.0 → 0.19.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +1 -1
  4. data/app/assets/javascripts/semantic-ui/accordion.js +15 -5
  5. data/app/assets/javascripts/semantic-ui/behavior/api.js +1 -1
  6. data/app/assets/javascripts/semantic-ui/behavior/colorize.js +1 -1
  7. data/app/assets/javascripts/semantic-ui/behavior/form.js +2 -2
  8. data/app/assets/javascripts/semantic-ui/behavior/state.js +1 -1
  9. data/app/assets/javascripts/semantic-ui/chatroom.js +1 -1
  10. data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
  11. data/app/assets/javascripts/semantic-ui/dimmer.js +1 -1
  12. data/app/assets/javascripts/semantic-ui/dropdown.js +79 -5
  13. data/app/assets/javascripts/semantic-ui/modal.js +113 -74
  14. data/app/assets/javascripts/semantic-ui/nag.js +1 -1
  15. data/app/assets/javascripts/semantic-ui/popup.js +13 -3
  16. data/app/assets/javascripts/semantic-ui/rating.js +1 -1
  17. data/app/assets/javascripts/semantic-ui/search.js +2 -2
  18. data/app/assets/javascripts/semantic-ui/shape.js +1 -1
  19. data/app/assets/javascripts/semantic-ui/sidebar.js +1 -1
  20. data/app/assets/javascripts/semantic-ui/tab.js +1 -1
  21. data/app/assets/javascripts/semantic-ui/transition.js +1 -1
  22. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  23. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +96 -41
  24. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +37 -109
  25. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +9 -7
  26. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
  27. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +5 -1
  28. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +6 -6
  29. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1 -1
  30. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  31. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
  32. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +6 -6
  33. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  34. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +1 -1
  35. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +2 -2
  36. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
  37. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +1 -1
  38. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  39. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +1 -1
  40. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +23 -2
  41. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +9 -4
  42. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +1 -1
  43. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +1 -1
  44. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
  45. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +76 -2
  46. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +1 -1
  47. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  48. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +1 -1
  49. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
  50. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  54. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +152 -0
  55. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +1 -1
  56. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +2 -2
  57. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +2 -2
  58. data/app/assets/stylesheets/semantic-ui/views/_item.scss +2 -2
  59. data/app/assets/stylesheets/semantic-ui/views/_list.scss +3 -3
  60. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +2 -2
  61. data/lib/semantic/ui/sass/version.rb +2 -2
  62. data/tasks/converter.rb +1 -1
  63. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1bb87ca074482fc718dad509ce9dab5fec3111e7
4
- data.tar.gz: 53866675b76f7cada8d4a43cc8480940c273dd9c
3
+ metadata.gz: f1d29879b23821f5f0012e50dd37fe09bb4534f8
4
+ data.tar.gz: 83e371de6d3e4341f40dcf1fb7bc863e0a67c751
5
5
  SHA512:
6
- metadata.gz: 5dc4bf125cc17186c091761aefaafb490a820ec99684327548fdf0a7b00bb7a746c1fcb918a4ba475f986544bdfa4aa66943cd5925e71e20b26401c182da5b93
7
- data.tar.gz: c82626215ee5749739f71a4f49ff87312a45639c68fc804e44ce34f4231929811ea519d6ebc3a794ffcecde5f2e3ea9a8dac4a6111333925a208f13ba37a91be
6
+ metadata.gz: e9221dceafc1be08c9598b1e75b01c31fe8504409267f4bcc8184df9de31eb461831719a8c1d9eb593eb74bb83ca8d0c6fb250e81aa0180ee0c372c68ae7fc0f
7
+ data.tar.gz: 6b6e8e9e5c6b602ad9f078b4bcc23cc2e8eb8a41df134a9b60b1ed31d03a945511bcead681abe333268458d3e196f0cd47b435e1f9bd3e396d3c7814d2d69d7d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.19.3.0
2
+
3
+ * Fix font-url
4
+
5
+ * Update Semantic UI to 0.19.3
6
+
1
7
  ## 0.16.1.0
2
8
 
3
9
  * Update Semantic UI to 0.16.1
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## Installation and Usage
6
6
 
7
7
  ```ruby
8
- gem 'semantic-ui-sass', '~> 0.15.5.0'
8
+ gem 'semantic-ui-sass', '~> 0.19.3.0'
9
9
  ```
10
10
  or
11
11
 
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -129,7 +129,10 @@ $.fn.accordion = function(parameters) {
129
129
  var
130
130
  $activeTitle = $title.eq(index),
131
131
  $activeContent = $activeTitle.next($content),
132
- $previousTitle = $activeTitle.siblings(selector.title).filter('.' + className.active),
132
+ $otherSections = module.is.menu()
133
+ ? $activeTitle.parent().siblings(selector.item).find(selector.title)
134
+ : $activeTitle.siblings(selector.title),
135
+ $previousTitle = $otherSections.filter('.' + className.active),
133
136
  $previousContent = $previousTitle.next($title),
134
137
  contentIsOpen = ($previousTitle.size() > 0)
135
138
  ;
@@ -205,7 +208,11 @@ $.fn.accordion = function(parameters) {
205
208
  })
206
209
  ;
207
210
  },
208
-
211
+ is: {
212
+ menu: function () {
213
+ return $module.hasClass(className.menu);
214
+ }
215
+ },
209
216
  setting: function(name, value) {
210
217
  if( $.isPlainObject(name) ) {
211
218
  $.extend(true, settings, name);
@@ -405,12 +412,15 @@ $.fn.accordion.settings = {
405
412
  },
406
413
 
407
414
  className : {
408
- active : 'active'
415
+ active : 'active',
416
+ menu : 'menu',
409
417
  },
410
418
 
411
419
  selector : {
412
420
  title : '.title',
413
- content : '.content'
421
+ content : '.content',
422
+ menu : '.menu',
423
+ item : '.item',
414
424
  }
415
425
 
416
426
 
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -635,7 +635,7 @@ $.fn.form.settings = {
635
635
  group : '.field',
636
636
  input : 'input',
637
637
  prompt : '.prompt',
638
- submit : '.submit'
638
+ submit : '.submit:not([type="submit"])'
639
639
  },
640
640
 
641
641
  className : {
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -3,7 +3,7 @@
3
3
  * http://github.com/jlukic/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -68,6 +68,7 @@ $.fn.dropdown = function(parameters) {
68
68
  module.bind.touchEvents();
69
69
  }
70
70
  module.bind.mouseEvents();
71
+ module.bind.keyboardEvents();
71
72
  module.instantiate();
72
73
  },
73
74
 
@@ -91,6 +92,15 @@ $.fn.dropdown = function(parameters) {
91
92
  },
92
93
 
93
94
  bind: {
95
+ keyboardEvents: function() {
96
+ module.debug('Binding keyboard events');
97
+ $module
98
+ .on('keydown' + eventNamespace, module.handleKeyboard)
99
+ ;
100
+ $module
101
+ .on('focus' + eventNamespace, module.show)
102
+ ;
103
+ },
94
104
  touchEvents: function() {
95
105
  module.debug('Touch device detected binding touch events');
96
106
  $module
@@ -154,6 +164,69 @@ $.fn.dropdown = function(parameters) {
154
164
  }
155
165
  },
156
166
 
167
+ handleKeyboard: function(event) {
168
+ var
169
+ $selectedItem = $item.filter('.' + className.selected),
170
+ pressedKey = event.which,
171
+ keys = {
172
+ enter : 13,
173
+ escape : 27,
174
+ upArrow : 38,
175
+ downArrow : 40
176
+ },
177
+ selectedClass = className.selected,
178
+ currentIndex = $item.index( $selectedItem ),
179
+ hasSelectedItem = ($selectedItem.size() > 0),
180
+ resultSize = $item.size(),
181
+ newIndex
182
+ ;
183
+ // close shortcuts
184
+ if(pressedKey == keys.escape) {
185
+ module.verbose('Escape key pressed, closing dropdown');
186
+ module.hide();
187
+ }
188
+ // result shortcuts
189
+ if(module.is.visible()) {
190
+ if(pressedKey == keys.enter && hasSelectedItem) {
191
+ module.verbose('Enter key pressed, choosing selected item');
192
+ $.proxy(module.event.item.click, $item.filter('.' + selectedClass) )(event);
193
+ event.preventDefault();
194
+ return false;
195
+ }
196
+ else if(pressedKey == keys.upArrow) {
197
+ module.verbose('Up key pressed, changing active item');
198
+ newIndex = (currentIndex - 1 < 0)
199
+ ? currentIndex
200
+ : currentIndex - 1
201
+ ;
202
+ $item
203
+ .removeClass(selectedClass)
204
+ .eq(newIndex)
205
+ .addClass(selectedClass)
206
+ ;
207
+ event.preventDefault();
208
+ }
209
+ else if(pressedKey == keys.downArrow) {
210
+ module.verbose('Down key pressed, changing active item');
211
+ newIndex = (currentIndex + 1 >= resultSize)
212
+ ? currentIndex
213
+ : currentIndex + 1
214
+ ;
215
+ $item
216
+ .removeClass(selectedClass)
217
+ .eq(newIndex)
218
+ .addClass(selectedClass)
219
+ ;
220
+ event.preventDefault();
221
+ }
222
+ }
223
+ else {
224
+ if(pressedKey == keys.enter) {
225
+ module.show();
226
+ }
227
+ }
228
+ },
229
+
157
230
  event: {
158
231
  test: {
159
232
  toggle: function(event) {
@@ -494,8 +567,8 @@ $.fn.dropdown = function(parameters) {
494
567
  },
495
568
  animated: function($subMenu) {
496
569
  return ($subMenu)
497
- ? $subMenu.is(':animated') || $subMenu.transition('is animating')
498
- : $menu.is(':animated') || $menu.transition('is animating')
570
+ ? $subMenu.is(':animated') || $subMenu.transition && $subMenu.transition('is animating')
571
+ : $menu.is(':animated') || $menu.transition && $menu.transition('is animating')
499
572
  ;
500
573
  },
501
574
  visible: function($subMenu) {
@@ -916,6 +989,7 @@ $.fn.dropdown.settings = {
916
989
  placeholder : 'default',
917
990
  disabled : 'disabled',
918
991
  visible : 'visible',
992
+ selected : 'selected',
919
993
  selection : 'selection'
920
994
  }
921
995
 
@@ -925,8 +999,8 @@ $.fn.dropdown.settings = {
925
999
  $.extend( $.easing, {
926
1000
  easeOutQuad: function (x, t, b, c, d) {
927
1001
  return -c *(t/=d)*(t-2) + b;
928
- },
1002
+ }
929
1003
  });
930
1004
 
931
1005
 
932
- })( jQuery, window , document );
1006
+ })( jQuery, window , document );
@@ -3,7 +3,7 @@
3
3
  * http://github.com/semantic-org/semantic-ui/
4
4
  *
5
5
  *
6
- * Copyright 2013 Contributors
6
+ * Copyright 2014 Contributors
7
7
  * Released under the MIT license
8
8
  * http://opensource.org/licenses/MIT
9
9
  *
@@ -94,8 +94,7 @@ $.fn.modal = function(parameters) {
94
94
  .dimmer('get dimmer')
95
95
  ;
96
96
 
97
- $otherModals = $module.siblings(selector.modal);
98
- $allModals = $otherModals.add($module);
97
+ module.refreshSelectors();
99
98
 
100
99
  module.verbose('Attaching close events', $close);
101
100
  $close
@@ -137,6 +136,11 @@ $.fn.modal = function(parameters) {
137
136
  module.set.position();
138
137
  },
139
138
 
139
+ refreshSelectors: function() {
140
+ $otherModals = $module.siblings(selector.modal);
141
+ $allModals = $otherModals.add($module);
142
+ },
143
+
140
144
  attachEvents: function(selector, event) {
141
145
  var
142
146
  $toggle = $(selector)
@@ -237,50 +241,63 @@ $.fn.modal = function(parameters) {
237
241
  module.showModal(callback);
238
242
  },
239
243
 
244
+ onlyVisible: function() {
245
+ module.refreshSelectors();
246
+ return module.is.active() && $otherModals.filter(':visible').size() === 0;
247
+ },
248
+
249
+ othersVisible: function() {
250
+ module.refreshSelectors();
251
+ return $otherModals.filter(':visible').size() > 0;
252
+ },
253
+
240
254
  showModal: function(callback) {
255
+ if(module.is.active()) {
256
+ module.debug('Modal is already visible');
257
+ return;
258
+ }
259
+
241
260
  callback = $.isFunction(callback)
242
261
  ? callback
243
262
  : function(){}
244
263
  ;
245
- if( !module.is.active() ) {
246
- if(module.cache === undefined) {
247
- module.cacheSizes();
248
- }
249
- module.set.position();
250
- module.set.screenHeight();
251
- module.set.type();
252
264
 
253
- if( $otherModals.filter(':visible').size() > 0 && !settings.allowMultiple) {
254
- module.debug('Other modals visible, queueing show animation');
255
- module.hideOthers(module.showModal);
265
+ module.save.focus();
266
+ module.add.keyboardShortcuts();
267
+
268
+ if(module.cache === undefined) {
269
+ module.cacheSizes();
270
+ }
271
+ module.set.position();
272
+ module.set.screenHeight();
273
+ module.set.type();
274
+
275
+ if(module.othersVisible() && !settings.allowMultiple) {
276
+ module.debug('Other modals visible, queueing show animation');
277
+ module.hideOthers(module.showModal);
278
+ }
279
+ else {
280
+ $.proxy(settings.onShow, element)();
281
+
282
+ var transitionCallback = function() {
283
+ module.set.active();
284
+ $.proxy(settings.onVisible, element)();
285
+ callback();
286
+ };
287
+
288
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
289
+ module.debug('Showing modal with css animations');
290
+ $module
291
+ .transition(settings.transition + ' in', settings.duration, transitionCallback)
292
+ ;
256
293
  }
257
294
  else {
258
- $.proxy(settings.onShow, element)();
259
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
260
- module.debug('Showing modal with css animations');
261
- $module
262
- .transition(settings.transition + ' in', settings.duration, function() {
263
- $.proxy(settings.onVisible, element)();
264
- module.set.active();
265
- callback();
266
- })
267
- ;
268
- }
269
- else {
270
- module.debug('Showing modal with javascript');
271
- $module
272
- .fadeIn(settings.duration, settings.easing, function() {
273
- $.proxy(settings.onVisible, element)();
274
- module.set.active();
275
- callback();
276
- })
277
- ;
278
- }
295
+ module.debug('Showing modal with javascript');
296
+ $module
297
+ .fadeIn(settings.duration, settings.easing, transitionCallback)
298
+ ;
279
299
  }
280
300
  }
281
- else {
282
- module.debug('Modal is already visible');
283
- }
284
301
  },
285
302
 
286
303
  showDimmer: function() {
@@ -289,7 +306,7 @@ $.fn.modal = function(parameters) {
289
306
  $dimmable.dimmer('show');
290
307
  }
291
308
  else {
292
- module.debug('Dimmer already visible');
309
+ module.debug('Dimmer is already visible');
293
310
  }
294
311
  },
295
312
 
@@ -298,7 +315,8 @@ $.fn.modal = function(parameters) {
298
315
  ? callback
299
316
  : function(){}
300
317
  ;
301
- if($allModals.filter(':visible').size() <= 1) {
318
+ module.refreshSelectors();
319
+ if(module.onlyVisible()) {
302
320
  module.hideDimmer();
303
321
  }
304
322
  module.hideModal(callback);
@@ -306,7 +324,7 @@ $.fn.modal = function(parameters) {
306
324
 
307
325
  hideDimmer: function() {
308
326
  if( !module.is.active() ) {
309
- module.debug('Dimmer is not visible cannot hide');
327
+ module.debug('Dimmer is already hidden');
310
328
  return;
311
329
  }
312
330
  module.debug('Hiding dimmer');
@@ -327,35 +345,37 @@ $.fn.modal = function(parameters) {
327
345
  },
328
346
 
329
347
  hideModal: function(callback) {
348
+ if(!module.is.active()) {
349
+ module.debug('Modal is already hidden');
350
+ return;
351
+ }
352
+
330
353
  callback = $.isFunction(callback)
331
354
  ? callback
332
355
  : function(){}
333
356
  ;
334
- if( !module.is.active() ) {
335
- module.debug('Cannot hide modal it is not active');
336
- return;
337
- }
338
- module.debug('Hiding modal');
357
+
358
+ module.restore.focus();
339
359
  module.remove.keyboardShortcuts();
360
+
340
361
  $.proxy(settings.onHide, element)();
362
+
363
+ var transitionCallback = function() {
364
+ module.remove.active();
365
+ $.proxy(settings.onHidden, element)();
366
+ callback();
367
+ };
368
+
341
369
  if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
370
+ module.debug('Hiding modal with css animations');
342
371
  $module
343
- .transition(settings.transition + ' out', settings.duration, function() {
344
- $.proxy(settings.onHidden, element)();
345
- module.remove.active();
346
- module.restore.focus();
347
- callback();
348
- })
372
+ .transition(settings.transition + ' out', settings.duration, transitionCallback)
349
373
  ;
350
374
  }
351
375
  else {
376
+ module.debug('Hiding modal with javascript');
352
377
  $module
353
- .fadeOut(settings.duration, settings.easing, function() {
354
- $.proxy(settings.onHidden, element)();
355
- module.remove.active();
356
- module.restore.focus();
357
- callback();
358
- })
378
+ .fadeOut(settings.duration, settings.easing, transitionCallback)
359
379
  ;
360
380
  }
361
381
  },
@@ -365,7 +385,7 @@ $.fn.modal = function(parameters) {
365
385
  ? callback
366
386
  : function(){}
367
387
  ;
368
- if( $allModals.is(':visible') ) {
388
+ if( $module.is(':visible') || module.othersVisible() ) {
369
389
  module.debug('Hiding all visible modals');
370
390
  module.hideDimmer();
371
391
  $allModals
@@ -380,7 +400,7 @@ $.fn.modal = function(parameters) {
380
400
  ? callback
381
401
  : function(){}
382
402
  ;
383
- if( $otherModals.is(':visible') ) {
403
+ if( module.othersVisible() ) {
384
404
  module.debug('Hiding other modals');
385
405
  $otherModals
386
406
  .filter(':visible')
@@ -436,17 +456,24 @@ $.fn.modal = function(parameters) {
436
456
  }
437
457
  },
438
458
 
459
+
439
460
  cacheSizes: function() {
440
- module.cache = {
441
- pageHeight : $body.outerHeight(),
442
- height : $module.outerHeight() + settings.offset,
443
- contextHeight : (settings.context == 'body')
444
- ? $(window).height()
445
- : $dimmable.height()
446
- };
447
- module.debug('Caching modal and container sizes', module.cache);
461
+ var
462
+ modalHeight = $module.outerHeight()
463
+ ;
464
+ if(modalHeight !== 0) {
465
+ module.cache = {
466
+ pageHeight : $(document).outerHeight(),
467
+ height : modalHeight + settings.offset,
468
+ contextHeight : (settings.context == 'body')
469
+ ? $(window).height()
470
+ : $dimmable.height()
471
+ };
472
+ module.debug('Caching modal and container sizes', module.cache);
473
+ }
448
474
  },
449
475
 
476
+
450
477
  can: {
451
478
  fit: function() {
452
479
  return (module.cache.height < module.cache.contextHeight);
@@ -473,17 +500,22 @@ $.fn.modal = function(parameters) {
473
500
  }
474
501
  },
475
502
  active: function() {
476
- module.add.keyboardShortcuts();
477
- module.save.focus();
478
- $module
479
- .addClass(className.active)
480
- ;
503
+ $module.addClass(className.active);
504
+
481
505
  if(settings.closable) {
482
506
  $dimmer
483
507
  .off('click' + eventNamespace)
484
508
  .on('click' + eventNamespace, module.event.click)
485
509
  ;
486
510
  }
511
+
512
+ if(settings.autofocus) {
513
+ var $inputs = $module.find(':input:visible');
514
+ var $autofocus = $inputs.filter('[autofocus]');
515
+ var $input = $autofocus.length ? $autofocus : $inputs;
516
+
517
+ $input.first().focus();
518
+ }
487
519
  },
488
520
  scrolling: function() {
489
521
  $dimmable.addClass(className.scrolling);
@@ -708,10 +740,11 @@ $.fn.modal.settings = {
708
740
  allowMultiple : true,
709
741
  detachable : true,
710
742
  closable : true,
743
+ autofocus : true,
711
744
  context : 'body',
712
745
 
713
746
  duration : 500,
714
- easing : 'easeOutExpo',
747
+ easing : 'easeOutQuad',
715
748
  offset : 0,
716
749
  transition : 'scale',
717
750
 
@@ -742,5 +775,11 @@ $.fn.modal.settings = {
742
775
  }
743
776
  };
744
777
 
778
+ // Adds easing
779
+ $.extend( $.easing, {
780
+ easeOutQuad: function (x, t, b, c, d) {
781
+ return -c *(t/=d)*(t-2) + b;
782
+ }
783
+ });
745
784
 
746
- })( jQuery, window , document );
785
+ })( jQuery, window , document );