flashgrid 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@
10
10
 
11
11
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
12
12
 
13
- Popover.VERSION = '3.2.0'
13
+ Popover.VERSION = '3.3.0'
14
14
 
15
15
  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
16
16
  placement: 'right',
@@ -77,12 +77,18 @@
77
77
 
78
78
  function Plugin(option) {
79
79
  return this.each(function () {
80
- var $this = $(this)
81
- var data = $this.data('bs.popover')
82
- var options = typeof option == 'object' && option
80
+ var $this = $(this)
81
+ var data = $this.data('bs.popover')
82
+ var options = typeof option == 'object' && option
83
+ var selector = options && options.selector
83
84
 
84
85
  if (!data && option == 'destroy') return
85
- if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
86
+ if (selector) {
87
+ if (!data) $this.data('bs.popover', (data = {}))
88
+ if (!data[selector]) data[selector] = new Popover(this, options)
89
+ } else {
90
+ if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
91
+ }
86
92
  if (typeof option == 'string') data[option]()
87
93
  })
88
94
  }
@@ -21,7 +21,7 @@
21
21
  this.process()
22
22
  }
23
23
 
24
- ScrollSpy.VERSION = '3.2.0'
24
+ ScrollSpy.VERSION = '3.3.0'
25
25
 
26
26
  ScrollSpy.DEFAULTS = {
27
27
  offset: 10
@@ -82,8 +82,9 @@
82
82
  return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
83
83
  }
84
84
 
85
- if (activeTarget && scrollTop <= offsets[0]) {
86
- return activeTarget != (i = targets[0]) && this.activate(i)
85
+ if (activeTarget && scrollTop < offsets[0]) {
86
+ this.activeTarget = null
87
+ return this.clear()
87
88
  }
88
89
 
89
90
  for (i = offsets.length; i--;) {
@@ -97,9 +98,7 @@
97
98
  ScrollSpy.prototype.activate = function (target) {
98
99
  this.activeTarget = target
99
100
 
100
- $(this.selector)
101
- .parentsUntil(this.options.target, '.active')
102
- .removeClass('active')
101
+ this.clear()
103
102
 
104
103
  var selector = this.selector +
105
104
  '[data-target="' + target + '"],' +
@@ -118,6 +117,12 @@
118
117
  active.trigger('activate.bs.scrollspy')
119
118
  }
120
119
 
120
+ ScrollSpy.prototype.clear = function () {
121
+ $(this.selector)
122
+ .parentsUntil(this.options.target, '.active')
123
+ .removeClass('active')
124
+ }
125
+
121
126
 
122
127
  // SCROLLSPY PLUGIN DEFINITION
123
128
  // ===========================
@@ -3,9 +3,9 @@
3
3
 
4
4
  (function($, window) {
5
5
  "use strict";
6
- var Switch;
7
- Switch = (function() {
8
- Switch.prototype.defaults = {
6
+ var swoggle;
7
+ swoggle = (function() {
8
+ swoggle.prototype.defaults = {
9
9
  state: true,
10
10
  size: null,
11
11
  animate: true,
@@ -18,9 +18,9 @@
18
18
  labelText: "&nbsp;"
19
19
  };
20
20
 
21
- Switch.prototype.name = "switch";
21
+ swoggle.prototype.name = "swoggle";
22
22
 
23
- function Switch(element, options) {
23
+ function swoggle(element, options) {
24
24
  if (options == null) {
25
25
  options = {};
26
26
  }
@@ -86,9 +86,9 @@
86
86
  this._formHandler();
87
87
  }
88
88
 
89
- Switch.prototype._constructor = Switch;
89
+ swoggle.prototype._constructor = swoggle;
90
90
 
91
- Switch.prototype.state = function(value, skip) {
91
+ swoggle.prototype.state = function(value, skip) {
92
92
  if (typeof value === "undefined") {
93
93
  return this.options.state;
94
94
  }
@@ -96,18 +96,18 @@
96
96
  return this.$element;
97
97
  }
98
98
  value = !!value;
99
- this.$element.prop("checked", value).trigger("change.Switch", skip);
99
+ this.$element.prop("checked", value).trigger("change.swoggle", skip);
100
100
  return this.$element;
101
101
  };
102
102
 
103
- Switch.prototype.toggleState = function(skip) {
103
+ swoggle.prototype.toggleState = function(skip) {
104
104
  if (this.options.disabled || this.options.readonly) {
105
105
  return this.$element;
106
106
  }
107
- return this.$element.prop("checked", !this.options.state).trigger("change.Switch", skip);
107
+ return this.$element.prop("checked", !this.options.state).trigger("change.swoggle", skip);
108
108
  };
109
109
 
110
- Switch.prototype.size = function(value) {
110
+ swoggle.prototype.size = function(value) {
111
111
  if (typeof value === "undefined") {
112
112
  return this.options.size;
113
113
  }
@@ -119,7 +119,7 @@
119
119
  return this.$element;
120
120
  };
121
121
 
122
- Switch.prototype.animate = function(value) {
122
+ swoggle.prototype.animate = function(value) {
123
123
  if (typeof value === "undefined") {
124
124
  return this.options.animate;
125
125
  }
@@ -129,7 +129,7 @@
129
129
  return this.$element;
130
130
  };
131
131
 
132
- Switch.prototype.disabled = function(value) {
132
+ swoggle.prototype.disabled = function(value) {
133
133
  if (typeof value === "undefined") {
134
134
  return this.options.disabled;
135
135
  }
@@ -140,14 +140,14 @@
140
140
  return this.$element;
141
141
  };
142
142
 
143
- Switch.prototype.toggleDisabled = function() {
143
+ swoggle.prototype.toggleDisabled = function() {
144
144
  this.$element.prop("disabled", !this.options.disabled);
145
145
  this.$wrapper.toggleClass("" + this.name + "-disabled");
146
146
  this.options.disabled = !this.options.disabled;
147
147
  return this.$element;
148
148
  };
149
149
 
150
- Switch.prototype.readonly = function(value) {
150
+ swoggle.prototype.readonly = function(value) {
151
151
  if (typeof value === "undefined") {
152
152
  return this.options.readonly;
153
153
  }
@@ -158,14 +158,14 @@
158
158
  return this.$element;
159
159
  };
160
160
 
161
- Switch.prototype.toggleReadonly = function() {
161
+ swoggle.prototype.toggleReadonly = function() {
162
162
  this.$element.prop("readonly", !this.options.readonly);
163
163
  this.$wrapper.toggleClass("" + this.name + "-readonly");
164
164
  this.options.readonly = !this.options.readonly;
165
165
  return this.$element;
166
166
  };
167
167
 
168
- Switch.prototype.onColor = function(value) {
168
+ swoggle.prototype.onColor = function(value) {
169
169
  var color;
170
170
  color = this.options.onColor;
171
171
  if (typeof value === "undefined") {
@@ -179,7 +179,7 @@
179
179
  return this.$element;
180
180
  };
181
181
 
182
- Switch.prototype.offColor = function(value) {
182
+ swoggle.prototype.offColor = function(value) {
183
183
  var color;
184
184
  color = this.options.offColor;
185
185
  if (typeof value === "undefined") {
@@ -193,7 +193,7 @@
193
193
  return this.$element;
194
194
  };
195
195
 
196
- Switch.prototype.onText = function(value) {
196
+ swoggle.prototype.onText = function(value) {
197
197
  if (typeof value === "undefined") {
198
198
  return this.options.onText;
199
199
  }
@@ -202,7 +202,7 @@
202
202
  return this.$element;
203
203
  };
204
204
 
205
- Switch.prototype.offText = function(value) {
205
+ swoggle.prototype.offText = function(value) {
206
206
  if (typeof value === "undefined") {
207
207
  return this.options.offText;
208
208
  }
@@ -211,7 +211,7 @@
211
211
  return this.$element;
212
212
  };
213
213
 
214
- Switch.prototype.labelText = function(value) {
214
+ swoggle.prototype.labelText = function(value) {
215
215
  if (typeof value === "undefined") {
216
216
  return this.options.labelText;
217
217
  }
@@ -220,20 +220,20 @@
220
220
  return this.$element;
221
221
  };
222
222
 
223
- Switch.prototype.destroy = function() {
223
+ swoggle.prototype.destroy = function() {
224
224
  var $form;
225
225
  $form = this.$element.closest("form");
226
226
  if ($form.length) {
227
- $form.off("reset.Switch").removeData("switch");
227
+ $form.off("reset.swoggle").removeData("swoggle");
228
228
  }
229
229
  this.$div.children().not(this.$element).remove();
230
- this.$element.unwrap().unwrap().off(".Switch").removeData("switch");
230
+ this.$element.unwrap().unwrap().off(".swoggle").removeData("swoggle");
231
231
  return this.$element;
232
232
  };
233
233
 
234
- Switch.prototype._elementHandlers = function() {
234
+ swoggle.prototype._elementHandlers = function() {
235
235
  return this.$element.on({
236
- "change.Switch": (function(_this) {
236
+ "change.swoggle": (function(_this) {
237
237
  return function(e, skip) {
238
238
  var checked;
239
239
  e.preventDefault();
@@ -247,7 +247,7 @@
247
247
  _this.$wrapper.removeClass(checked ? "" + _this.name + "-off" : "" + _this.name + "-on").addClass(checked ? "" + _this.name + "-on" : "" + _this.name + "-off");
248
248
  if (!skip) {
249
249
  if (_this.$element.is(":radio")) {
250
- $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.Switch", true);
250
+ $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.swoggle", true);
251
251
  }
252
252
  return _this.$element.trigger("switchChange", {
253
253
  el: _this.$element,
@@ -256,7 +256,7 @@
256
256
  }
257
257
  };
258
258
  })(this),
259
- "focus.Switch": (function(_this) {
259
+ "focus.swoggle": (function(_this) {
260
260
  return function(e) {
261
261
  e.preventDefault();
262
262
  e.stopPropagation();
@@ -264,7 +264,7 @@
264
264
  return _this.$wrapper.addClass("" + _this.name + "-focused");
265
265
  };
266
266
  })(this),
267
- "blur.Switch": (function(_this) {
267
+ "blur.swoggle": (function(_this) {
268
268
  return function(e) {
269
269
  e.preventDefault();
270
270
  e.stopPropagation();
@@ -272,7 +272,7 @@
272
272
  return _this.$wrapper.removeClass("" + _this.name + "-focused");
273
273
  };
274
274
  })(this),
275
- "keydown.Switch": (function(_this) {
275
+ "keydown.swoggle": (function(_this) {
276
276
  return function(e) {
277
277
  if (!e.which || _this.options.disabled || _this.options.readonly) {
278
278
  return;
@@ -299,24 +299,24 @@
299
299
  });
300
300
  };
301
301
 
302
- Switch.prototype._handleHandlers = function() {
303
- this.$on.on("click.Switch", (function(_this) {
302
+ swoggle.prototype._handleHandlers = function() {
303
+ this.$on.on("click.swoggle", (function(_this) {
304
304
  return function(e) {
305
305
  _this.state(false);
306
- return _this.$element.trigger("focus.Switch");
306
+ return _this.$element.trigger("focus.swoggle");
307
307
  };
308
308
  })(this));
309
- return this.$off.on("click.Switch", (function(_this) {
309
+ return this.$off.on("click.swoggle", (function(_this) {
310
310
  return function(e) {
311
311
  _this.state(true);
312
- return _this.$element.trigger("focus.Switch");
312
+ return _this.$element.trigger("focus.swoggle");
313
313
  };
314
314
  })(this));
315
315
  };
316
316
 
317
- Switch.prototype._labelHandlers = function() {
317
+ swoggle.prototype._labelHandlers = function() {
318
318
  return this.$label.on({
319
- "mousemove.Switch": (function(_this) {
319
+ "mousemove.swoggle": (function(_this) {
320
320
  return function(e) {
321
321
  var left, percent, right;
322
322
  if (!_this.drag) {
@@ -331,10 +331,10 @@
331
331
  percent = right;
332
332
  }
333
333
  _this.$div.css("margin-left", "" + (percent - right) + "%");
334
- return _this.$element.trigger("focus.Switch");
334
+ return _this.$element.trigger("focus.swoggle");
335
335
  };
336
336
  })(this),
337
- "mousedown.Switch": (function(_this) {
337
+ "mousedown.swoggle": (function(_this) {
338
338
  return function(e) {
339
339
  if (_this.drag || _this.options.disabled || _this.options.readonly) {
340
340
  return;
@@ -343,64 +343,64 @@
343
343
  if (_this.options.animate) {
344
344
  _this.$wrapper.removeClass("" + _this.name + "-animate");
345
345
  }
346
- return _this.$element.trigger("focus.Switch");
346
+ return _this.$element.trigger("focus.swoggle");
347
347
  };
348
348
  })(this),
349
- "mouseup.Switch": (function(_this) {
349
+ "mouseup.swoggle": (function(_this) {
350
350
  return function(e) {
351
351
  if (!_this.drag) {
352
352
  return;
353
353
  }
354
354
  _this.drag = false;
355
- _this.$element.prop("checked", parseInt(_this.$div.css("margin-left"), 10) > -25).trigger("change.Switch");
355
+ _this.$element.prop("checked", parseInt(_this.$div.css("margin-left"), 10) > -25).trigger("change.swoggle");
356
356
  _this.$div.css("margin-left", "");
357
357
  if (_this.options.animate) {
358
358
  return _this.$wrapper.addClass("" + _this.name + "-animate");
359
359
  }
360
360
  };
361
361
  })(this),
362
- "click.Switch": (function(_this) {
362
+ "click.swoggle": (function(_this) {
363
363
  return function(e) {
364
364
  e.preventDefault();
365
365
  e.stopImmediatePropagation();
366
366
  _this.toggleState();
367
- return _this.$element.trigger("focus.Switch");
367
+ return _this.$element.trigger("focus.swoggle");
368
368
  };
369
369
  })(this)
370
370
  });
371
371
  };
372
372
 
373
- Switch.prototype._formHandler = function() {
373
+ swoggle.prototype._formHandler = function() {
374
374
  var $form;
375
375
  $form = this.$element.closest("form");
376
- if ($form.data("switch")) {
376
+ if ($form.data("swoggle")) {
377
377
  return;
378
378
  }
379
- return $form.on("reset.Switch", function() {
379
+ return $form.on("reset.swoggle", function() {
380
380
  return window.setTimeout(function() {
381
381
  return $form.find("input").filter(function() {
382
- return $(this).data("switch");
382
+ return $(this).data("swoggle");
383
383
  }).each(function() {
384
- return $(this).Switch("state", false);
384
+ return $(this).swoggle("state", false);
385
385
  });
386
386
  }, 1);
387
- }).data("switch", true);
387
+ }).data("swoggle", true);
388
388
  };
389
389
 
390
- return Switch;
390
+ return swoggle;
391
391
 
392
392
  })();
393
393
  $.fn.extend({
394
- Switch: function() {
394
+ swoggle: function() {
395
395
  var args, option, ret;
396
396
  option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
397
397
  ret = this;
398
398
  this.each(function() {
399
399
  var $this, data;
400
400
  $this = $(this);
401
- data = $this.data("switch");
401
+ data = $this.data("swoggle");
402
402
  if (!data) {
403
- $this.data("switch", data = new Switch(this, option));
403
+ $this.data("swoggle", data = new swoggle(this, option));
404
404
  }
405
405
  if (typeof option === "string") {
406
406
  return ret = data[option].apply(data, args);
@@ -409,7 +409,7 @@
409
409
  return ret;
410
410
  }
411
411
  });
412
- return $.fn.Switch.Constructor = Switch;
412
+ return $.fn.swoggle.Constructor = swoggle;
413
413
  })(window.jQuery, window);
414
414
 
415
415
  }).call(this);
@@ -8,7 +8,7 @@
8
8
  this.element = $(element)
9
9
  }
10
10
 
11
- Tab.VERSION = '3.2.0'
11
+ Tab.VERSION = '3.3.0'
12
12
 
13
13
  Tab.TRANSITION_DURATION = 150
14
14
 
@@ -24,22 +24,30 @@
24
24
 
25
25
  if ($this.parent('li').hasClass('active')) return
26
26
 
27
- var previous = $ul.find('.active:last a')[0]
28
- var e = $.Event('show.bs.tab', {
29
- relatedTarget: previous
27
+ var $previous = $ul.find('.active:last a')
28
+ var hideEvent = $.Event('hide.bs.tab', {
29
+ relatedTarget: $this[0]
30
+ })
31
+ var showEvent = $.Event('show.bs.tab', {
32
+ relatedTarget: $previous[0]
30
33
  })
31
34
 
32
- $this.trigger(e)
35
+ $previous.trigger(hideEvent)
36
+ $this.trigger(showEvent)
33
37
 
34
- if (e.isDefaultPrevented()) return
38
+ if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
35
39
 
36
40
  var $target = $(selector)
37
41
 
38
42
  this.activate($this.closest('li'), $ul)
39
43
  this.activate($target, $target.parent(), function () {
44
+ $previous.trigger({
45
+ type: 'hidden.bs.tab',
46
+ relatedTarget: $this[0]
47
+ })
40
48
  $this.trigger({
41
49
  type: 'shown.bs.tab',
42
- relatedTarget: previous
50
+ relatedTarget: $previous[0]
43
51
  })
44
52
  })
45
53
  }
@@ -54,9 +62,15 @@
54
62
  $active
55
63
  .removeClass('active')
56
64
  .find('> .dropdown-menu > .active')
57
- .removeClass('active')
65
+ .removeClass('active')
66
+ .end()
67
+ .find('[data-toggle="tab"]')
68
+ .attr('aria-expanded', false)
58
69
 
59
- element.addClass('active')
70
+ element
71
+ .addClass('active')
72
+ .find('[data-toggle="tab"]')
73
+ .attr('aria-expanded', true)
60
74
 
61
75
  if (transition) {
62
76
  element[0].offsetWidth // reflow for transition
@@ -66,7 +80,12 @@
66
80
  }
67
81
 
68
82
  if (element.parent('.dropdown-menu')) {
69
- element.closest('li.dropdown').addClass('active')
83
+ element
84
+ .closest('li.dropdown')
85
+ .addClass('active')
86
+ .end()
87
+ .find('[data-toggle="tab"]')
88
+ .attr('aria-expanded', true)
70
89
  }
71
90
 
72
91
  callback && callback()
@@ -113,9 +132,13 @@
113
132
  // TAB DATA-API
114
133
  // ============
115
134
 
116
- $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
135
+ var clickHandler = function (e) {
117
136
  e.preventDefault()
118
137
  Plugin.call($(this), 'show')
119
- })
138
+ }
139
+
140
+ $(document)
141
+ .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
142
+ .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
120
143
 
121
144
  }(jQuery);