fomantic-ui-sass 2.9.2 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/javascripts/semantic-ui/accordion.js +1 -5
  4. data/app/assets/javascripts/semantic-ui/api.js +22 -15
  5. data/app/assets/javascripts/semantic-ui/calendar.js +1 -6
  6. data/app/assets/javascripts/semantic-ui/checkbox.js +4 -6
  7. data/app/assets/javascripts/semantic-ui/dimmer.js +1 -5
  8. data/app/assets/javascripts/semantic-ui/dropdown.js +56 -33
  9. data/app/assets/javascripts/semantic-ui/embed.js +1 -6
  10. data/app/assets/javascripts/semantic-ui/flyout.js +40 -58
  11. data/app/assets/javascripts/semantic-ui/form.js +102 -53
  12. data/app/assets/javascripts/semantic-ui/modal.js +45 -33
  13. data/app/assets/javascripts/semantic-ui/nag.js +17 -9
  14. data/app/assets/javascripts/semantic-ui/popup.js +27 -19
  15. data/app/assets/javascripts/semantic-ui/progress.js +1 -6
  16. data/app/assets/javascripts/semantic-ui/rating.js +1 -5
  17. data/app/assets/javascripts/semantic-ui/search.js +4 -7
  18. data/app/assets/javascripts/semantic-ui/shape.js +1 -5
  19. data/app/assets/javascripts/semantic-ui/sidebar.js +15 -38
  20. data/app/assets/javascripts/semantic-ui/site.js +1 -1
  21. data/app/assets/javascripts/semantic-ui/slider.js +130 -34
  22. data/app/assets/javascripts/semantic-ui/state.js +23 -20
  23. data/app/assets/javascripts/semantic-ui/sticky.js +17 -16
  24. data/app/assets/javascripts/semantic-ui/tab.js +18 -8
  25. data/app/assets/javascripts/semantic-ui/toast.js +17 -9
  26. data/app/assets/javascripts/semantic-ui/transition.js +2 -6
  27. data/app/assets/javascripts/semantic-ui/visibility.js +15 -6
  28. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  29. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +53 -20
  30. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +107 -107
  31. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +13 -7
  32. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
  33. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +65 -1
  34. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +2 -2
  35. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +62 -1
  36. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  37. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +697 -249
  38. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +3 -2
  39. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
  40. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +62 -62
  41. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  42. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +3 -27
  43. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +21 -2
  44. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +13 -13
  45. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +282 -282
  46. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
  47. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  48. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  49. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +161 -34
  50. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -1
  54. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
  55. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +145 -8
  56. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +50 -6
  57. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +3 -3
  58. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +119 -26
  59. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +1 -1
  60. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +1 -1
  61. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +10 -3
  62. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  63. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +41 -40
  64. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
  65. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
  66. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +26 -1
  67. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  68. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
  69. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +1 -1
  70. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
  71. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  72. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +6 -1
  73. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  74. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  75. data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
  76. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +6 -1
  77. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +486 -5
  78. data/app/assets/stylesheets/semantic-ui/views/_item.scss +6 -1
  79. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
  80. data/lib/fomantic/ui/sass/version.rb +2 -2
  81. metadata +1 -1
@@ -28,15 +28,25 @@
28
28
  $html = $('html'),
29
29
  $head = $('head'),
30
30
 
31
- moduleSelector = $allModules.selector || '',
32
-
33
31
  time = Date.now(),
34
32
  performance = [],
35
33
 
36
34
  query = arguments[0],
37
35
  methodInvoked = typeof query === 'string',
38
36
  queryArguments = [].slice.call(arguments, 1),
37
+ contextCheck = function (context, win) {
38
+ var $context;
39
+ if ([window, document].indexOf(context) >= 0) {
40
+ $context = $body;
41
+ } else {
42
+ $context = $(win.document).find(context);
43
+ if ($context.length === 0) {
44
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
45
+ }
46
+ }
39
47
 
48
+ return $context;
49
+ },
40
50
  returnedValue;
41
51
 
42
52
  $allModules.each(function () {
@@ -55,7 +65,7 @@
55
65
  moduleNamespace = 'module-' + namespace,
56
66
 
57
67
  $module = $(this),
58
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
68
+ $context = contextCheck(settings.context, window),
59
69
  isBody = $context[0] === $body[0],
60
70
 
61
71
  $sidebars = $module.children(selector.sidebar),
@@ -119,9 +129,6 @@
119
129
  .off(eventNamespace)
120
130
  .removeData(moduleNamespace)
121
131
  ;
122
- if (module.is.ios()) {
123
- module.remove.ios();
124
- }
125
132
  // bound by uuid
126
133
  $context.off(elementNamespace);
127
134
  $window.off(elementNamespace);
@@ -277,7 +284,7 @@
277
284
 
278
285
  refresh: function () {
279
286
  module.verbose('Refreshing selector cache');
280
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
287
+ $context = contextCheck(settings.context, window);
281
288
  module.refreshSidebars();
282
289
  $pusher = $context.children(selector.pusher);
283
290
  $fixed = $context.children(selector.fixed);
@@ -585,11 +592,6 @@
585
592
  $pusher.removeClass(className.blurring);
586
593
  }
587
594
  },
588
- // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
589
- // (This is no longer necessary in latest iOS)
590
- ios: function () {
591
- $html.addClass(className.ios);
592
- },
593
595
 
594
596
  // container
595
597
  pushed: function () {
@@ -638,11 +640,6 @@
638
640
  }
639
641
  },
640
642
 
641
- // ios scroll on html not document
642
- ios: function () {
643
- $html.removeClass(className.ios);
644
- },
645
-
646
643
  // context
647
644
  pushed: function () {
648
645
  $context.removeClass(className.pushed);
@@ -762,20 +759,6 @@
762
759
  return module.cache.isIE;
763
760
  },
764
761
 
765
- ios: function () {
766
- var
767
- userAgent = navigator.userAgent,
768
- isIOS = userAgent.match(regExp.ios),
769
- isMobileChrome = userAgent.match(regExp.mobileChrome)
770
- ;
771
- if (isIOS && !isMobileChrome) {
772
- module.verbose('Browser was found to be iOS', userAgent);
773
-
774
- return true;
775
- }
776
-
777
- return false;
778
- },
779
762
  mobile: function () {
780
763
  var
781
764
  userAgent = navigator.userAgent,
@@ -888,7 +871,7 @@
888
871
  });
889
872
  }
890
873
  clearTimeout(module.performance.timer);
891
- module.performance.timer = setTimeout(module.performance.display, 500);
874
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
892
875
  },
893
876
  display: function () {
894
877
  var
@@ -901,9 +884,6 @@
901
884
  totalTime += data['Execution Time'];
902
885
  });
903
886
  title += ' ' + totalTime + 'ms';
904
- if (moduleSelector) {
905
- title += ' \'' + moduleSelector + '\'';
906
- }
907
887
  if (performance.length > 0) {
908
888
  console.groupCollapsed(title);
909
889
  if (console.table) {
@@ -1038,7 +1018,6 @@
1038
1018
  blurring: 'blurring',
1039
1019
  closing: 'closing',
1040
1020
  dimmed: 'dimmed',
1041
- ios: 'ios',
1042
1021
  locked: 'locked',
1043
1022
  pushable: 'pushable',
1044
1023
  pushed: 'pushed',
@@ -1058,8 +1037,6 @@
1058
1037
  },
1059
1038
 
1060
1039
  regExp: {
1061
- ios: /(iPad|iPhone|iPod)/g,
1062
- mobileChrome: /(CriOS)/g,
1063
1040
  mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g,
1064
1041
  },
1065
1042
 
@@ -292,7 +292,7 @@
292
292
  });
293
293
  }
294
294
  clearTimeout(module.performance.timer);
295
- module.performance.timer = setTimeout(module.performance.display, 500);
295
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
296
296
  },
297
297
  display: function () {
298
298
  var
@@ -25,8 +25,6 @@
25
25
  $document = $(document),
26
26
  $window = $(window),
27
27
 
28
- moduleSelector = $allModules.selector || '',
29
-
30
28
  time = Date.now(),
31
29
  performance = [],
32
30
 
@@ -105,9 +103,7 @@
105
103
  module.setup.layout();
106
104
  module.setup.labels();
107
105
 
108
- if (!module.is.disabled()) {
109
- module.bind.events();
110
- }
106
+ module.bind.events();
111
107
 
112
108
  module.read.metadata();
113
109
  module.read.settings();
@@ -139,20 +135,32 @@
139
135
  $module.attr('tabindex', 0);
140
136
  }
141
137
  if ($module.find('.inner').length === 0) {
142
- $module.append("<div class='inner'>"
143
- + "<div class='track'></div>"
144
- + "<div class='track-fill'></div>"
145
- + "<div class='thumb'></div>"
138
+ $module.append('<div class="inner">'
139
+ + '<div class="track"></div>'
140
+ + '<div class="track-fill"></div>'
141
+ + '<div class="thumb"></div>'
146
142
  + '</div>');
147
143
  }
148
144
  precision = module.get.precision();
149
145
  $thumb = $module.find('.thumb:not(.second)');
146
+ if (settings.showThumbTooltip) {
147
+ $thumb
148
+ .attr('data-position', settings.tooltipConfig.position)
149
+ .attr('data-variation', settings.tooltipConfig.variation)
150
+ ;
151
+ }
150
152
  $currThumb = $thumb;
151
153
  if (module.is.range()) {
152
154
  if ($module.find('.thumb.second').length === 0) {
153
- $module.find('.inner').append("<div class='thumb second'></div>");
155
+ $module.find('.inner').append('<div class="thumb second"></div>');
154
156
  }
155
157
  $secondThumb = $module.find('.thumb.second');
158
+ if (settings.showThumbTooltip) {
159
+ $secondThumb
160
+ .attr('data-position', settings.tooltipConfig.position)
161
+ .attr('data-variation', settings.tooltipConfig.variation)
162
+ ;
163
+ }
156
164
  }
157
165
  $track = $module.find('.track');
158
166
  $trackFill = $module.find('.track-fill');
@@ -206,9 +214,10 @@
206
214
  for (var i = 0, len = module.get.numLabels(); i <= len; i++) {
207
215
  var
208
216
  labelText = module.get.label(i),
209
- $label = labelText !== ''
217
+ showLabel = settings.restrictedLabels.length === 0 || settings.restrictedLabels.indexOf(labelText) >= 0,
218
+ $label = labelText !== '' && (showLabel || settings.showLabelTicks === 'always')
210
219
  ? (!(i % module.get.gapRatio())
211
- ? $('<li class="label">' + labelText + '</li>')
220
+ ? $('<li class="label">' + (showLabel ? labelText : '') + '</li>')
212
221
  : $('<li class="halftick label"></li>'))
213
222
  : null,
214
223
  ratio = i / len
@@ -352,6 +361,18 @@
352
361
  ;
353
362
  $currThumb = initialPosition > newPos ? $thumb : $secondThumb;
354
363
  }
364
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
365
+ var currentRangeDiff = module.get.currentRangeDiff(value),
366
+ isSecondThumb = $currThumb.hasClass('second')
367
+ ;
368
+ if ((settings.minRange && currentRangeDiff < settings.minRange)
369
+ || (settings.maxRange && currentRangeDiff > settings.maxRange)
370
+ || (settings.preventCrossover && !isSecondThumb && value > module.secondThumbVal)
371
+ || (settings.preventCrossover && isSecondThumb && value < module.thumbVal)
372
+ ) {
373
+ return;
374
+ }
375
+ }
355
376
  if (module.get.step() === 0 || module.is.smooth()) {
356
377
  var
357
378
  thumbVal = module.thumbVal,
@@ -387,6 +408,17 @@
387
408
  return;
388
409
  }
389
410
  var value = module.determine.valueFromEvent(event);
411
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
412
+ if ($currThumb === undefined) {
413
+ $currThumb = value <= module.get.currentThumbValue() ? $thumb : $secondThumb;
414
+ }
415
+ var currentRangeDiff = module.get.currentRangeDiff(value);
416
+ if (settings.minRange && currentRangeDiff < settings.minRange) {
417
+ value = module.get.edgeValue(value, settings.minRange);
418
+ } else if (settings.maxRange && currentRangeDiff > settings.maxRange) {
419
+ value = module.get.edgeValue(value, settings.maxRange);
420
+ }
421
+ }
390
422
  module.set.value(value);
391
423
  module.unbind.slidingEvents();
392
424
  touchIdentifier = undefined;
@@ -403,6 +435,9 @@
403
435
  }
404
436
  },
405
437
  keydown: function (event, first) {
438
+ if (module.is.disabled()) {
439
+ return;
440
+ }
406
441
  if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
407
442
  $currThumb = undefined;
408
443
  }
@@ -439,7 +474,7 @@
439
474
  }
440
475
  },
441
476
  activateFocus: function (event) {
442
- if (!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
477
+ if (!module.is.disabled() && !module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
443
478
  event.preventDefault();
444
479
  module.event.keydown(event, true);
445
480
  $module.trigger('focus');
@@ -504,7 +539,13 @@
504
539
 
505
540
  is: {
506
541
  range: function () {
507
- return $module.hasClass(settings.className.range);
542
+ var isRange = $module.hasClass(className.range);
543
+ if (!isRange && (settings.minRange || settings.maxRange)) {
544
+ $module.addClass(className.range);
545
+ isRange = true;
546
+ }
547
+
548
+ return isRange;
508
549
  },
509
550
  hover: function () {
510
551
  return isHover;
@@ -513,23 +554,56 @@
513
554
  return $module.is(':focus');
514
555
  },
515
556
  disabled: function () {
516
- return $module.hasClass(settings.className.disabled);
557
+ return $module.hasClass(className.disabled);
517
558
  },
518
559
  labeled: function () {
519
- return $module.hasClass(settings.className.labeled);
560
+ var isLabeled = $module.hasClass(className.labeled);
561
+ if (!isLabeled && (settings.restrictedLabels.length > 0 || settings.showLabelTicks !== false)) {
562
+ $module.addClass(className.labeled);
563
+ isLabeled = true;
564
+ }
565
+
566
+ return isLabeled;
520
567
  },
521
568
  reversed: function () {
522
- return $module.hasClass(settings.className.reversed);
569
+ return $module.hasClass(className.reversed);
523
570
  },
524
571
  vertical: function () {
525
- return $module.hasClass(settings.className.vertical);
572
+ return $module.hasClass(className.vertical);
526
573
  },
527
574
  smooth: function () {
528
- return settings.smooth || $module.hasClass(settings.className.smooth);
575
+ return settings.smooth || $module.hasClass(className.smooth);
529
576
  },
530
577
  },
531
578
 
532
579
  get: {
580
+ currentRangeDiff: function (value) {
581
+ var currentRangeDiff;
582
+ if ($currThumb.hasClass('second')) {
583
+ currentRangeDiff = module.thumbVal < value
584
+ ? value - module.thumbVal
585
+ : module.thumbVal - value;
586
+ } else {
587
+ currentRangeDiff = module.secondThumbVal > value
588
+ ? module.secondThumbVal - value
589
+ : value - module.secondThumbVal;
590
+ }
591
+
592
+ return currentRangeDiff;
593
+ },
594
+ edgeValue: function (value, edgeValue) {
595
+ if ($currThumb.hasClass('second')) {
596
+ value = module.thumbVal < value
597
+ ? module.thumbVal + edgeValue
598
+ : module.thumbVal - edgeValue;
599
+ } else {
600
+ value = module.secondThumbVal < value
601
+ ? module.secondThumbVal + edgeValue
602
+ : module.secondThumbVal - edgeValue;
603
+ }
604
+
605
+ return value;
606
+ },
533
607
  trackOffset: function () {
534
608
  if (module.is.vertical()) {
535
609
  return $track.offset().top;
@@ -600,7 +674,8 @@
600
674
  var
601
675
  step = module.get.step(),
602
676
  min = module.get.min(),
603
- quotient = step === 0 ? 0 : Math.floor((settings.max - min) / step),
677
+ precision = module.get.precision(),
678
+ quotient = step === 0 ? 0 : Math.floor(Math.round(((settings.max - min) / step) * precision) / precision),
604
679
  remainder = step === 0 ? 0 : (settings.max - min) % step
605
680
  ;
606
681
 
@@ -610,7 +685,9 @@
610
685
  return settings.step;
611
686
  },
612
687
  numLabels: function () {
613
- var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
688
+ var step = module.get.step(),
689
+ precision = module.get.precision(),
690
+ value = Math.round(((module.get.max() - module.get.min()) / (step === 0 ? 1 : step)) * precision) / precision;
614
691
  module.debug('Determined that there should be ' + value + ' labels');
615
692
 
616
693
  return value;
@@ -625,7 +702,9 @@
625
702
 
626
703
  switch (settings.labelType) {
627
704
  case settings.labelTypes.number: {
628
- return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision) / precision;
705
+ var step = module.get.step();
706
+
707
+ return Math.round(((value * (step === 0 ? 1 : step)) + module.get.min()) * precision) / precision;
629
708
  }
630
709
  case settings.labelTypes.letter: {
631
710
  return alphabet[value % 26];
@@ -733,13 +812,10 @@
733
812
  return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
734
813
  },
735
814
  thumbPos: function ($element) {
736
- var
737
- pos = module.is.vertical()
738
- ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
739
- : (module.is.reversed() ? $element.css('right') : $element.css('left'))
815
+ return module.is.vertical()
816
+ ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
817
+ : (module.is.reversed() ? $element.css('right') : $element.css('left'))
740
818
  ;
741
-
742
- return pos;
743
819
  },
744
820
  positionFromValue: function (val) {
745
821
  var
@@ -763,6 +839,7 @@
763
839
  position = Math.round(ratio * trackLength),
764
840
  adjustedPos = step === 0 ? position : Math.round(position / step) * step
765
841
  ;
842
+ module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
766
843
 
767
844
  return adjustedPos;
768
845
  },
@@ -986,12 +1063,12 @@
986
1063
  }
987
1064
  if (!$currThumb.hasClass('second')) {
988
1065
  if (settings.preventCrossover && module.is.range()) {
989
- newValue = Math.min(module.secondThumbVal, newValue);
1066
+ newValue = Math.min(module.secondThumbVal - (settings.minRange || 0), newValue);
990
1067
  }
991
1068
  module.thumbVal = newValue;
992
1069
  } else {
993
1070
  if (settings.preventCrossover && module.is.range()) {
994
- newValue = Math.max(module.thumbVal, newValue);
1071
+ newValue = Math.max(module.thumbVal + (settings.minRange || 0), newValue);
995
1072
  }
996
1073
  module.secondThumbVal = newValue;
997
1074
  }
@@ -1010,6 +1087,10 @@
1010
1087
  thumbVal = module.thumbVal || module.get.min(),
1011
1088
  secondThumbVal = module.secondThumbVal || module.get.min()
1012
1089
  ;
1090
+ if (settings.showThumbTooltip) {
1091
+ var precision = module.get.precision();
1092
+ $targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
1093
+ }
1013
1094
  if (module.is.range()) {
1014
1095
  if (!$targetThumb.hasClass('second')) {
1015
1096
  position = newPos;
@@ -1098,6 +1179,14 @@
1098
1179
  settings: function () {
1099
1180
  if (settings.start !== false) {
1100
1181
  if (module.is.range()) {
1182
+ var rangeDiff = settings.end - settings.start;
1183
+ if (rangeDiff < 0
1184
+ || (settings.minRange && rangeDiff < settings.minRange)
1185
+ || (settings.maxRange && rangeDiff > settings.maxRange)
1186
+ || (settings.minRange && settings.maxRange && settings.minRange > settings.maxRange)
1187
+ ) {
1188
+ module.error(error.invalidRanges, settings.start, settings.end, settings.minRange, settings.maxRange);
1189
+ }
1101
1190
  module.debug('Start position set from settings', settings.start, settings.end);
1102
1191
  module.set.rangeValue(settings.start, settings.end);
1103
1192
  } else {
@@ -1178,7 +1267,7 @@
1178
1267
  });
1179
1268
  }
1180
1269
  clearTimeout(module.performance.timer);
1181
- module.performance.timer = setTimeout(module.performance.display, 500);
1270
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
1182
1271
  },
1183
1272
  display: function () {
1184
1273
  var
@@ -1191,9 +1280,6 @@
1191
1280
  totalTime += data['Execution Time'];
1192
1281
  });
1193
1282
  title += ' ' + totalTime + 'ms';
1194
- if (moduleSelector) {
1195
- title += ' \'' + moduleSelector + '\'';
1196
- }
1197
1283
  if (performance.length > 0) {
1198
1284
  console.groupCollapsed(title);
1199
1285
  if (console.table) {
@@ -1293,6 +1379,7 @@
1293
1379
  error: {
1294
1380
  method: 'The method you called is not defined.',
1295
1381
  notrange: 'This slider is not a range slider',
1382
+ invalidRanges: 'Invalid range settings (start/end/minRange/maxRange)',
1296
1383
  },
1297
1384
 
1298
1385
  metadata: {
@@ -1305,6 +1392,8 @@
1305
1392
  step: 1,
1306
1393
  start: 0,
1307
1394
  end: 20,
1395
+ minRange: false,
1396
+ maxRange: false,
1308
1397
  labelType: 'number',
1309
1398
  showLabelTicks: false,
1310
1399
  smooth: false,
@@ -1341,6 +1430,13 @@
1341
1430
  downArrow: 40,
1342
1431
  },
1343
1432
 
1433
+ restrictedLabels: [],
1434
+ showThumbTooltip: false,
1435
+ tooltipConfig: {
1436
+ position: 'top center',
1437
+ variation: 'tiny black',
1438
+ },
1439
+
1344
1440
  labelTypes: {
1345
1441
  number: 'number',
1346
1442
  letter: 'letter',
@@ -23,15 +23,25 @@
23
23
  var
24
24
  $allModules = $(this),
25
25
 
26
- moduleSelector = $allModules.selector || '',
27
-
28
26
  time = Date.now(),
29
27
  performance = [],
30
28
 
31
29
  query = arguments[0],
32
30
  methodInvoked = typeof query === 'string',
33
31
  queryArguments = [].slice.call(arguments, 1),
32
+ contextCheck = function (context, win) {
33
+ var $context;
34
+ if ([window, document].indexOf(context) >= 0) {
35
+ $context = $(context);
36
+ } else {
37
+ $context = $(win.document).find(context);
38
+ if ($context.length === 0) {
39
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
40
+ }
41
+ }
34
42
 
43
+ return $context;
44
+ },
35
45
  returnedValue
36
46
  ;
37
47
  $allModules.each(function () {
@@ -51,6 +61,7 @@
51
61
  moduleNamespace = namespace + '-module',
52
62
 
53
63
  $module = $(this),
64
+ $context = settings.context ? contextCheck(settings.context, window) : $module,
54
65
 
55
66
  element = this,
56
67
  instance = $module.data(moduleNamespace),
@@ -68,19 +79,11 @@
68
79
  }
69
80
 
70
81
  // bind events with delegated events
71
- if (settings.context && moduleSelector !== '') {
72
- ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
73
- .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
74
- .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
75
- .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
76
- ;
77
- } else {
78
- $module
79
- .on('mouseenter' + eventNamespace, module.change.text)
80
- .on('mouseleave' + eventNamespace, module.reset.text)
81
- .on('click' + eventNamespace, module.toggle.state)
82
- ;
83
- }
82
+ $context
83
+ .on('mouseenter' + eventNamespace, module.change.text)
84
+ .on('mouseleave' + eventNamespace, module.reset.text)
85
+ .on('click' + eventNamespace, module.toggle.state)
86
+ ;
84
87
  module.instantiate();
85
88
  },
86
89
 
@@ -94,8 +97,11 @@
94
97
 
95
98
  destroy: function () {
96
99
  module.verbose('Destroying previous module', instance);
97
- $module
100
+ $context
98
101
  .off(eventNamespace)
102
+ ;
103
+ $module
104
+ .removeData(metadata.storedText)
99
105
  .removeData(moduleNamespace)
100
106
  ;
101
107
  },
@@ -476,7 +482,7 @@
476
482
  });
477
483
  }
478
484
  clearTimeout(module.performance.timer);
479
- module.performance.timer = setTimeout(module.performance.display, 500);
485
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
480
486
  },
481
487
  display: function () {
482
488
  var
@@ -489,9 +495,6 @@
489
495
  totalTime += data['Execution Time'];
490
496
  });
491
497
  title += ' ' + totalTime + 'ms';
492
- if (moduleSelector) {
493
- title += ' \'' + moduleSelector + '\'';
494
- }
495
498
  if (performance.length > 0) {
496
499
  console.groupCollapsed(title);
497
500
  if (console.table) {
@@ -23,7 +23,6 @@
23
23
  var
24
24
  $allModules = $(this),
25
25
  $document = $(document),
26
- moduleSelector = $allModules.selector || '',
27
26
 
28
27
  time = Date.now(),
29
28
  performance = [],
@@ -31,6 +30,19 @@
31
30
  query = arguments[0],
32
31
  methodInvoked = typeof query === 'string',
33
32
  queryArguments = [].slice.call(arguments, 1),
33
+ contextCheck = function (context, win) {
34
+ var $context;
35
+ if ([window, document].indexOf(context) >= 0) {
36
+ $context = $(context);
37
+ } else {
38
+ $context = $(win.document).find(context);
39
+ if ($context.length === 0) {
40
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
41
+ }
42
+ }
43
+
44
+ return $context;
45
+ },
34
46
  returnedValue
35
47
  ;
36
48
 
@@ -49,7 +61,7 @@
49
61
 
50
62
  $module = $(this),
51
63
  $window = $(window),
52
- $scroll = [window, document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
64
+ $scroll = contextCheck(settings.scrollContext, window),
53
65
  $container,
54
66
  $context,
55
67
 
@@ -127,19 +139,11 @@
127
139
  },
128
140
 
129
141
  determineContainer: function () {
130
- if (settings.container) {
131
- $container = [window, document].indexOf(settings.container) < 0 ? $document.find(settings.container) : $(settings.container);
132
- } else {
133
- $container = $module.offsetParent();
134
- }
142
+ $container = settings.container ? contextCheck(settings.container, window) : $module.offsetParent();
135
143
  },
136
144
 
137
145
  determineContext: function () {
138
- if (settings.context) {
139
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
140
- } else {
141
- $context = $container;
142
- }
146
+ $context = settings.context ? contextCheck(settings.context, window) : $container;
143
147
  if ($context.length === 0) {
144
148
  module.error(error.invalidContext, settings.context, $module);
145
149
  }
@@ -742,7 +746,7 @@
742
746
  });
743
747
  }
744
748
  clearTimeout(module.performance.timer);
745
- module.performance.timer = setTimeout(module.performance.display, 0);
749
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 0);
746
750
  },
747
751
  display: function () {
748
752
  var
@@ -755,9 +759,6 @@
755
759
  totalTime += data['Execution Time'];
756
760
  });
757
761
  title += ' ' + totalTime + 'ms';
758
- if (moduleSelector) {
759
- title += ' \'' + moduleSelector + '\'';
760
- }
761
762
  if (performance.length > 0) {
762
763
  console.groupCollapsed(title);
763
764
  if (console.table) {