flashgrid 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1,3 +1,3 @@
1
1
  module Flashgrid
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -19,7 +19,7 @@
19
19
  this.checkPosition()
20
20
  }
21
21
 
22
- Affix.VERSION = '3.1.1'
22
+ Affix.VERSION = '3.2.0'
23
23
 
24
24
  Affix.RESET = 'affix affix-top affix-bottom'
25
25
 
@@ -77,7 +77,9 @@
77
77
  .trigger($.Event(affixType.replace('affix', 'affixed')))
78
78
 
79
79
  if (affix == 'bottom') {
80
- this.$element.offset({ top: scrollHeight - this.$element.height() - offsetBottom })
80
+ this.$element.offset({
81
+ top: scrollHeight - this.$element.height() - offsetBottom
82
+ })
81
83
  }
82
84
  }
83
85
 
@@ -9,7 +9,7 @@
9
9
  $(el).on('click', dismiss, this.close)
10
10
  }
11
11
 
12
- Alert.VERSION = '3.1.1'
12
+ Alert.VERSION = '3.2.0'
13
13
 
14
14
  Alert.prototype.close = function (e) {
15
15
  var $this = $(this)
@@ -41,7 +41,7 @@
41
41
 
42
42
  $.support.transition && $parent.hasClass('fade') ?
43
43
  $parent
44
- .one($.support.transition.end, removeElement)
44
+ .one('bsTransitionEnd', removeElement)
45
45
  .emulateTransitionEnd(150) :
46
46
  removeElement()
47
47
  }
@@ -10,7 +10,7 @@
10
10
  this.isLoading = false
11
11
  }
12
12
 
13
- Button.VERSION = '3.1.1'
13
+ Button.VERSION = '3.2.0'
14
14
 
15
15
  Button.DEFAULTS = {
16
16
  loadingText: 'loading...'
@@ -5,7 +5,7 @@
5
5
  // =========================
6
6
 
7
7
  var Carousel = function (element, options) {
8
- this.$element = $(element)
8
+ this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
9
9
  this.$indicators = this.$element.find('.carousel-indicators')
10
10
  this.options = options
11
11
  this.paused =
@@ -15,11 +15,11 @@
15
15
  this.$items = null
16
16
 
17
17
  this.options.pause == 'hover' && this.$element
18
- .on('mouseenter', $.proxy(this.pause, this))
19
- .on('mouseleave', $.proxy(this.cycle, this))
18
+ .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
19
+ .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
20
20
  }
21
21
 
22
- Carousel.VERSION = '3.1.1'
22
+ Carousel.VERSION = '3.2.0'
23
23
 
24
24
  Carousel.DEFAULTS = {
25
25
  interval: 5000,
@@ -27,7 +27,17 @@
27
27
  wrap: true
28
28
  }
29
29
 
30
- Carousel.prototype.cycle = function (e) {
30
+ Carousel.prototype.keydown = function (e) {
31
+ switch (e.which) {
32
+ case 37: this.prev(); break
33
+ case 39: this.next(); break
34
+ default: return
35
+ }
36
+
37
+ e.preventDefault()
38
+ }
39
+
40
+ Carousel.prototype.cycle = function (e) {
31
41
  e || (this.paused = false)
32
42
 
33
43
  this.interval && clearInterval(this.interval)
@@ -39,16 +49,14 @@
39
49
  return this
40
50
  }
41
51
 
42
- Carousel.prototype.getActiveIndex = function () {
43
- this.$active = this.$element.find('.item.active')
44
- this.$items = this.$active.parent().children('.item')
45
-
46
- return this.$items.index(this.$active)
52
+ Carousel.prototype.getItemIndex = function (item) {
53
+ this.$items = item.parent().children('.item')
54
+ return this.$items.index(item || this.$active)
47
55
  }
48
56
 
49
57
  Carousel.prototype.to = function (pos) {
50
58
  var that = this
51
- var activeIndex = this.getActiveIndex()
59
+ var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
52
60
 
53
61
  if (pos > (this.$items.length - 1) || pos < 0) return
54
62
 
@@ -94,10 +102,13 @@
94
102
  $next = this.$element.find('.item')[fallback]()
95
103
  }
96
104
 
97
- if ($next.hasClass('active')) return this.sliding = false
105
+ if ($next.hasClass('active')) return (this.sliding = false)
98
106
 
99
107
  var relatedTarget = $next[0]
100
- var slideEvent = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction })
108
+ var slideEvent = $.Event('slide.bs.carousel', {
109
+ relatedTarget: relatedTarget,
110
+ direction: direction
111
+ })
101
112
  this.$element.trigger(slideEvent)
102
113
  if (slideEvent.isDefaultPrevented()) return
103
114
 
@@ -107,10 +118,8 @@
107
118
 
108
119
  if (this.$indicators.length) {
109
120
  this.$indicators.find('.active').removeClass('active')
110
- this.$element.one('slid.bs.carousel', function () { // yes, "slid"
111
- var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
112
- $nextIndicator && $nextIndicator.addClass('active')
113
- })
121
+ var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
122
+ $nextIndicator && $nextIndicator.addClass('active')
114
123
  }
115
124
 
116
125
  var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
@@ -120,11 +129,13 @@
120
129
  $active.addClass(direction)
121
130
  $next.addClass(direction)
122
131
  $active
123
- .one($.support.transition.end, function () {
132
+ .one('bsTransitionEnd', function () {
124
133
  $next.removeClass([type, direction].join(' ')).addClass('active')
125
134
  $active.removeClass(['active', direction].join(' '))
126
135
  that.sliding = false
127
- setTimeout(function () { that.$element.trigger(slidEvent) }, 0)
136
+ setTimeout(function () {
137
+ that.$element.trigger(slidEvent)
138
+ }, 0)
128
139
  })
129
140
  .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
130
141
  } else {
@@ -176,15 +187,17 @@
176
187
  // =================
177
188
 
178
189
  $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
179
- var $this = $(this), href
180
- var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
190
+ var href
191
+ var $this = $(this)
192
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
193
+ if (!$target.hasClass('carousel')) return
181
194
  var options = $.extend({}, $target.data(), $this.data())
182
195
  var slideIndex = $this.attr('data-slide-to')
183
196
  if (slideIndex) options.interval = false
184
197
 
185
198
  Plugin.call($target, options)
186
199
 
187
- if (slideIndex = $this.attr('data-slide-to')) {
200
+ if (slideIndex) {
188
201
  $target.data('bs.carousel').to(slideIndex)
189
202
  }
190
203
 
@@ -13,7 +13,7 @@
13
13
  if (this.options.toggle) this.toggle()
14
14
  }
15
15
 
16
- Collapse.VERSION = '3.1.1'
16
+ Collapse.VERSION = '3.2.0'
17
17
 
18
18
  Collapse.DEFAULTS = {
19
19
  toggle: true
@@ -48,18 +48,12 @@
48
48
 
49
49
  this.transitioning = 1
50
50
 
51
- var complete = function (e) {
52
- if (e && e.target != this.$element[0]) {
53
- this.$element
54
- .one($.support.transition.end, $.proxy(complete, this))
55
- return
56
- }
51
+ var complete = function () {
57
52
  this.$element
58
53
  .removeClass('collapsing')
59
54
  .addClass('collapse in')[dimension]('')
60
55
  this.transitioning = 0
61
56
  this.$element
62
- .off($.support.transition.end + '.bs.collapse')
63
57
  .trigger('shown.bs.collapse')
64
58
  }
65
59
 
@@ -68,7 +62,7 @@
68
62
  var scrollSize = $.camelCase(['scroll', dimension].join('-'))
69
63
 
70
64
  this.$element
71
- .on($.support.transition.end + '.bs.collapse', $.proxy(complete, this))
65
+ .one('bsTransitionEnd', $.proxy(complete, this))
72
66
  .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
73
67
  }
74
68
 
@@ -90,12 +84,7 @@
90
84
 
91
85
  this.transitioning = 1
92
86
 
93
- var complete = function (e) {
94
- if (e && e.target != this.$element[0]) {
95
- this.$element
96
- .one($.support.transition.end, $.proxy(complete, this))
97
- return
98
- }
87
+ var complete = function () {
99
88
  this.transitioning = 0
100
89
  this.$element
101
90
  .trigger('hidden.bs.collapse')
@@ -107,7 +96,7 @@
107
96
 
108
97
  this.$element
109
98
  [dimension](0)
110
- .one($.support.transition.end, $.proxy(complete, this))
99
+ .one('bsTransitionEnd', $.proxy(complete, this))
111
100
  .emulateTransitionEnd(350)
112
101
  }
113
102
 
@@ -150,10 +139,11 @@
150
139
  // =================
151
140
 
152
141
  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
153
- var $this = $(this), href
142
+ var href
143
+ var $this = $(this)
154
144
  var target = $this.attr('data-target')
155
145
  || e.preventDefault()
156
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
146
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
157
147
  var $target = $(target)
158
148
  var data = $target.data('bs.collapse')
159
149
  var option = data ? 'toggle' : $this.data()
@@ -10,7 +10,7 @@
10
10
  $(element).on('click.bs.dropdown', this.toggle)
11
11
  }
12
12
 
13
- Dropdown.VERSION = '3.1.1'
13
+ Dropdown.VERSION = '3.2.0'
14
14
 
15
15
  Dropdown.prototype.toggle = function (e) {
16
16
  var $this = $(this)
@@ -93,7 +93,7 @@
93
93
 
94
94
  if (!selector) {
95
95
  selector = $this.attr('href')
96
- selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
96
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
97
97
  }
98
98
 
99
99
  var $parent = selector && $(selector)
@@ -495,6 +495,10 @@ GMaps.prototype.createControl = function(options) {
495
495
  control.innerHTML = options.content;
496
496
  }
497
497
 
498
+ if (options.position) {
499
+ control.position = google.maps.ControlPosition[options.position.toUpperCase()];
500
+ }
501
+
498
502
  for (var ev in options.events) {
499
503
  (function(object, name) {
500
504
  google.maps.event.addDomListener(object, name, function(){
@@ -509,14 +513,32 @@ GMaps.prototype.createControl = function(options) {
509
513
  };
510
514
 
511
515
  GMaps.prototype.addControl = function(options) {
512
- var position = google.maps.ControlPosition[options.position.toUpperCase()];
513
-
514
- delete options.position;
515
-
516
516
  var control = this.createControl(options);
517
517
  this.controls.push(control);
518
+ this.map.controls[control.position].push(control);
519
+
520
+ return control;
521
+ };
522
+
523
+ GMaps.prototype.removeControl = function(control) {
524
+ var position = null;
518
525
 
519
- this.map.controls[position].push(control);
526
+ for (var i = 0; i < this.controls.length; i++) {
527
+ if (this.controls[i] == control) {
528
+ position = this.controls[i].position;
529
+ this.controls.splice(i, 1);
530
+ }
531
+ }
532
+
533
+ if (position) {
534
+ for (i = 0; i < this.map.controls.length; i++) {
535
+ var controlsForPosition = this.map.controls[control.position]
536
+ if (controlsForPosition.getAt(i) == control) {
537
+ controlsForPosition.removeAt(i);
538
+ break;
539
+ }
540
+ }
541
+ }
520
542
 
521
543
  return control;
522
544
  };
@@ -1361,6 +1383,7 @@ GMaps.prototype.travelRoute = function(options) {
1361
1383
  destination: options.destination,
1362
1384
  travelMode: options.travelMode,
1363
1385
  waypoints : options.waypoints,
1386
+ unitSystem: options.unitSystem,
1364
1387
  error: options.error,
1365
1388
  callback: function(e) {
1366
1389
  //start callback
@@ -1694,12 +1717,12 @@ GMaps.staticMapURL = function(options){
1694
1717
  if (styles) {
1695
1718
  for (var i = 0; i < styles.length; i++) {
1696
1719
  var styleRule = [];
1697
- if (styles[i].featureType && styles[i].featureType != 'all' ) {
1698
- styleRule.push('feature:' + styles[i].featureType);
1720
+ if (styles[i].featureType){
1721
+ styleRule.push('feature:' + styles[i].featureType.toLowerCase());
1699
1722
  }
1700
1723
 
1701
- if (styles[i].elementType && styles[i].elementType != 'all') {
1702
- styleRule.push('element:' + styles[i].elementType);
1724
+ if (styles[i].elementType) {
1725
+ styleRule.push('element:' + styles[i].elementType.toLowerCase());
1703
1726
  }
1704
1727
 
1705
1728
  for (var j = 0; j < styles[i].stylers.length; j++) {
@@ -1878,6 +1901,7 @@ GMaps.custom_events = ['marker_added', 'marker_removed', 'polyline_added', 'poly
1878
1901
 
1879
1902
  GMaps.on = function(event_name, object, handler) {
1880
1903
  if (GMaps.custom_events.indexOf(event_name) == -1) {
1904
+ if(object instanceof GMaps) object = object.map;
1881
1905
  return google.maps.event.addListener(object, event_name, handler);
1882
1906
  }
1883
1907
  else {
@@ -1895,6 +1919,7 @@ GMaps.on = function(event_name, object, handler) {
1895
1919
 
1896
1920
  GMaps.off = function(event_name, object) {
1897
1921
  if (GMaps.custom_events.indexOf(event_name) == -1) {
1922
+ if(object instanceof GMaps) object = object.map;
1898
1923
  google.maps.event.clearListeners(object, event_name);
1899
1924
  }
1900
1925
  else {
@@ -21,7 +21,7 @@
21
21
  }
22
22
  }
23
23
 
24
- Modal.VERSION = '3.1.1'
24
+ Modal.VERSION = '3.2.0'
25
25
 
26
26
  Modal.DEFAULTS = {
27
27
  backdrop: true,
@@ -76,7 +76,7 @@
76
76
 
77
77
  transition ?
78
78
  that.$element.find('.modal-dialog') // wait for modal to slide in
79
- .one($.support.transition.end, function () {
79
+ .one('bsTransitionEnd', function () {
80
80
  that.$element.trigger('focus').trigger(e)
81
81
  })
82
82
  .emulateTransitionEnd(300) :
@@ -109,7 +109,7 @@
109
109
 
110
110
  $.support.transition && this.$element.hasClass('fade') ?
111
111
  this.$element
112
- .one($.support.transition.end, $.proxy(this.hideModal, this))
112
+ .one('bsTransitionEnd', $.proxy(this.hideModal, this))
113
113
  .emulateTransitionEnd(300) :
114
114
  this.hideModal()
115
115
  }
@@ -172,20 +172,20 @@
172
172
 
173
173
  doAnimate ?
174
174
  this.$backdrop
175
- .one($.support.transition.end, callback)
175
+ .one('bsTransitionEnd', callback)
176
176
  .emulateTransitionEnd(150) :
177
177
  callback()
178
178
 
179
179
  } else if (!this.isShown && this.$backdrop) {
180
180
  this.$backdrop.removeClass('in')
181
181
 
182
- var callbackRemove = function() {
182
+ var callbackRemove = function () {
183
183
  that.removeBackdrop()
184
184
  callback && callback()
185
185
  }
186
186
  $.support.transition && this.$element.hasClass('fade') ?
187
187
  this.$backdrop
188
- .one($.support.transition.end, callbackRemove)
188
+ .one('bsTransitionEnd', callbackRemove)
189
189
  .emulateTransitionEnd(150) :
190
190
  callbackRemove()
191
191
 
@@ -199,8 +199,8 @@
199
199
  this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
200
200
  }
201
201
 
202
- Modal.prototype.setScrollbar = function () {
203
- var bodyPad = parseInt(this.$body.css('padding-right') || 0)
202
+ Modal.prototype.setScrollbar = function () {
203
+ var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
204
204
  if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
205
205
  }
206
206
 
@@ -254,15 +254,18 @@
254
254
  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
255
255
  var $this = $(this)
256
256
  var href = $this.attr('href')
257
- var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
257
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
258
258
  var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
259
259
 
260
260
  if ($this.is('a')) e.preventDefault()
261
261
 
262
- Plugin.call($target, option, this)
263
- $target.one('hide.bs.modal', function () {
264
- $this.is(':visible') && $this.trigger('focus')
262
+ $target.one('show.bs.modal', function (showEvent) {
263
+ if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
264
+ $target.one('hidden.bs.modal', function () {
265
+ $this.is(':visible') && $this.trigger('focus')
266
+ })
265
267
  })
268
+ Plugin.call($target, option, this)
266
269
  })
267
270
 
268
271
  }(jQuery);