jombo 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/jombo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jombo
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -18,61 +18,57 @@
18
18
  * ========================================================== */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* ALERT CLASS DEFINITION
26
27
  * ====================== */
27
28
 
28
29
  var dismiss = '[data-dismiss="alert"]'
29
- , Alert = function ( el ) {
30
+ , Alert = function (el) {
30
31
  $(el).on('click', dismiss, this.close)
31
32
  }
32
33
 
33
- Alert.prototype = {
34
-
35
- constructor: Alert
34
+ Alert.prototype.close = function (e) {
35
+ var $this = $(this)
36
+ , selector = $this.attr('data-target')
37
+ , $parent
36
38
 
37
- , close: function ( e ) {
38
- var $this = $(this)
39
- , selector = $this.attr('data-target')
40
- , $parent
39
+ if (!selector) {
40
+ selector = $this.attr('href')
41
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
42
+ }
41
43
 
42
- if (!selector) {
43
- selector = $this.attr('href')
44
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45
- }
44
+ $parent = $(selector)
46
45
 
47
- $parent = $(selector)
48
- $parent.trigger('close')
46
+ e && e.preventDefault()
49
47
 
50
- e && e.preventDefault()
48
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
51
49
 
52
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
50
+ $parent.trigger(e = $.Event('close'))
53
51
 
54
- $parent
55
- .trigger('close')
56
- .removeClass('in')
52
+ if (e.isDefaultPrevented()) return
57
53
 
58
- function removeElement() {
59
- $parent
60
- .trigger('closed')
61
- .remove()
62
- }
54
+ $parent.removeClass('in')
63
55
 
64
- $.support.transition && $parent.hasClass('fade') ?
65
- $parent.on($.support.transition.end, removeElement) :
66
- removeElement()
56
+ function removeElement() {
57
+ $parent
58
+ .trigger('closed')
59
+ .remove()
67
60
  }
68
61
 
62
+ $.support.transition && $parent.hasClass('fade') ?
63
+ $parent.on($.support.transition.end, removeElement) :
64
+ removeElement()
69
65
  }
70
66
 
71
67
 
72
68
  /* ALERT PLUGIN DEFINITION
73
69
  * ======================= */
74
70
 
75
- $.fn.alert = function ( option ) {
71
+ $.fn.alert = function (option) {
76
72
  return this.each(function () {
77
73
  var $this = $(this)
78
74
  , data = $this.data('alert')
@@ -91,4 +87,4 @@
91
87
  $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
92
88
  })
93
89
 
94
- }( window.jQuery );
90
+ }(window.jQuery);
@@ -17,58 +17,54 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- !function( $ ){
21
20
 
22
- "use strict"
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
23
25
 
24
26
  /* BUTTON PUBLIC CLASS DEFINITION
25
27
  * ============================== */
26
28
 
27
- var Button = function ( element, options ) {
29
+ var Button = function (element, options) {
28
30
  this.$element = $(element)
29
31
  this.options = $.extend({}, $.fn.button.defaults, options)
30
32
  }
31
33
 
32
- Button.prototype = {
33
-
34
- constructor: Button
34
+ Button.prototype.setState = function (state) {
35
+ var d = 'disabled'
36
+ , $el = this.$element
37
+ , data = $el.data()
38
+ , val = $el.is('input') ? 'val' : 'html'
35
39
 
36
- , setState: function ( state ) {
37
- var d = 'disabled'
38
- , $el = this.$element
39
- , data = $el.data()
40
- , val = $el.is('input') ? 'val' : 'html'
40
+ state = state + 'Text'
41
+ data.resetText || $el.data('resetText', $el[val]())
41
42
 
42
- state = state + 'Text'
43
- data.resetText || $el.data('resetText', $el[val]())
43
+ $el[val](data[state] || this.options[state])
44
44
 
45
- $el[val](data[state] || this.options[state])
46
-
47
- // push to event loop to allow forms to submit
48
- setTimeout(function () {
49
- state == 'loadingText' ?
50
- $el.addClass(d).attr(d, d) :
51
- $el.removeClass(d).removeAttr(d)
52
- }, 0)
53
- }
54
-
55
- , toggle: function () {
56
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
45
+ // push to event loop to allow forms to submit
46
+ setTimeout(function () {
47
+ state == 'loadingText' ?
48
+ $el.addClass(d).attr(d, d) :
49
+ $el.removeClass(d).removeAttr(d)
50
+ }, 0)
51
+ }
57
52
 
58
- $parent && $parent
59
- .find('.active')
60
- .removeClass('active')
53
+ Button.prototype.toggle = function () {
54
+ var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
61
55
 
62
- this.$element.toggleClass('active')
63
- }
56
+ $parent && $parent
57
+ .find('.active')
58
+ .removeClass('active')
64
59
 
60
+ this.$element.toggleClass('active')
65
61
  }
66
62
 
67
63
 
68
64
  /* BUTTON PLUGIN DEFINITION
69
65
  * ======================== */
70
66
 
71
- $.fn.button = function ( option ) {
67
+ $.fn.button = function (option) {
72
68
  return this.each(function () {
73
69
  var $this = $(this)
74
70
  , data = $this.data('button')
@@ -97,4 +93,4 @@
97
93
  })
98
94
  })
99
95
 
100
- }( window.jQuery );
96
+ }(window.jQuery);
@@ -18,9 +18,10 @@
18
18
  * ========================================================== */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* CAROUSEL CLASS DEFINITION
26
27
  * ========================= */
@@ -36,8 +37,10 @@
36
37
 
37
38
  Carousel.prototype = {
38
39
 
39
- cycle: function () {
40
+ cycle: function (e) {
41
+ if (!e) this.paused = false
40
42
  this.options.interval
43
+ && !this.paused
41
44
  && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
42
45
  return this
43
46
  }
@@ -63,7 +66,8 @@
63
66
  return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
64
67
  }
65
68
 
66
- , pause: function () {
69
+ , pause: function (e) {
70
+ if (!e) this.paused = true
67
71
  clearInterval(this.interval)
68
72
  this.interval = null
69
73
  return this
@@ -86,6 +90,7 @@
86
90
  , direction = type == 'next' ? 'left' : 'right'
87
91
  , fallback = type == 'next' ? 'first' : 'last'
88
92
  , that = this
93
+ , e = $.Event('slide')
89
94
 
90
95
  this.sliding = true
91
96
 
@@ -96,11 +101,12 @@
96
101
  if ($next.hasClass('active')) return
97
102
 
98
103
  if ($.support.transition && this.$element.hasClass('slide')) {
104
+ this.$element.trigger(e)
105
+ if (e.isDefaultPrevented()) return
99
106
  $next.addClass(type)
100
107
  $next[0].offsetWidth // force reflow
101
108
  $active.addClass(direction)
102
109
  $next.addClass(direction)
103
- this.$element.trigger('slide')
104
110
  this.$element.one($.support.transition.end, function () {
105
111
  $next.removeClass([type, direction].join(' ')).addClass('active')
106
112
  $active.removeClass(['active', direction].join(' '))
@@ -108,7 +114,8 @@
108
114
  setTimeout(function () { that.$element.trigger('slid') }, 0)
109
115
  })
110
116
  } else {
111
- this.$element.trigger('slide')
117
+ this.$element.trigger(e)
118
+ if (e.isDefaultPrevented()) return
112
119
  $active.removeClass('active')
113
120
  $next.addClass('active')
114
121
  this.sliding = false
@@ -126,7 +133,7 @@
126
133
  /* CAROUSEL PLUGIN DEFINITION
127
134
  * ========================== */
128
135
 
129
- $.fn.carousel = function ( option ) {
136
+ $.fn.carousel = function (option) {
130
137
  return this.each(function () {
131
138
  var $this = $(this)
132
139
  , data = $this.data('carousel')
@@ -159,4 +166,4 @@
159
166
  })
160
167
  })
161
168
 
162
- }( window.jQuery );
169
+ }(window.jQuery);
@@ -17,16 +17,21 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- !function( $ ){
21
20
 
22
- "use strict"
21
+ !function ($) {
23
22
 
24
- var Collapse = function ( element, options ) {
25
- this.$element = $(element)
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* COLLAPSE PUBLIC CLASS DEFINITION
27
+ * ================================ */
28
+
29
+ var Collapse = function (element, options) {
30
+ this.$element = $(element)
26
31
  this.options = $.extend({}, $.fn.collapse.defaults, options)
27
32
 
28
- if (this.options["parent"]) {
29
- this.$parent = $(this.options["parent"])
33
+ if (this.options.parent) {
34
+ this.$parent = $(this.options.parent)
30
35
  }
31
36
 
32
37
  this.options.toggle && this.toggle()
@@ -52,16 +57,16 @@
52
57
  dimension = this.dimension()
53
58
  scroll = $.camelCase(['scroll', dimension].join('-'))
54
59
  actives = this.$parent && this.$parent.find('> .accordion-group > .in')
55
- hasData
56
60
 
57
61
  if (actives && actives.length) {
58
62
  hasData = actives.data('collapse')
63
+ if (hasData && hasData.transitioning) return
59
64
  actives.collapse('hide')
60
65
  hasData || actives.data('collapse', null)
61
66
  }
62
67
 
63
68
  this.$element[dimension](0)
64
- this.transition('addClass', 'show', 'shown')
69
+ this.transition('addClass', $.Event('show'), 'shown')
65
70
  this.$element[dimension](this.$element[0][scroll])
66
71
  }
67
72
 
@@ -70,11 +75,11 @@
70
75
  if (this.transitioning) return
71
76
  dimension = this.dimension()
72
77
  this.reset(this.$element[dimension]())
73
- this.transition('removeClass', 'hide', 'hidden')
78
+ this.transition('removeClass', $.Event('hide'), 'hidden')
74
79
  this.$element[dimension](0)
75
80
  }
76
81
 
77
- , reset: function ( size ) {
82
+ , reset: function (size) {
78
83
  var dimension = this.dimension()
79
84
 
80
85
  this.$element
@@ -82,12 +87,12 @@
82
87
  [dimension](size || 'auto')
83
88
  [0].offsetWidth
84
89
 
85
- this.$element[size != null ? 'addClass' : 'removeClass']('collapse')
90
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
86
91
 
87
92
  return this
88
93
  }
89
94
 
90
- , transition: function ( method, startEvent, completeEvent ) {
95
+ , transition: function (method, startEvent, completeEvent) {
91
96
  var that = this
92
97
  , complete = function () {
93
98
  if (startEvent == 'show') that.reset()
@@ -95,27 +100,30 @@
95
100
  that.$element.trigger(completeEvent)
96
101
  }
97
102
 
103
+ this.$element.trigger(startEvent)
104
+
105
+ if (startEvent.isDefaultPrevented()) return
106
+
98
107
  this.transitioning = 1
99
108
 
100
- this.$element
101
- .trigger(startEvent)
102
- [method]('in')
109
+ this.$element[method]('in')
103
110
 
104
111
  $.support.transition && this.$element.hasClass('collapse') ?
105
112
  this.$element.one($.support.transition.end, complete) :
106
113
  complete()
107
- }
114
+ }
108
115
 
109
116
  , toggle: function () {
110
117
  this[this.$element.hasClass('in') ? 'hide' : 'show']()
111
- }
118
+ }
112
119
 
113
120
  }
114
121
 
115
- /* COLLAPSIBLE PLUGIN DEFINITION
122
+
123
+ /* COLLAPSIBLE PLUGIN DEFINITION
116
124
  * ============================== */
117
125
 
118
- $.fn.collapse = function ( option ) {
126
+ $.fn.collapse = function (option) {
119
127
  return this.each(function () {
120
128
  var $this = $(this)
121
129
  , data = $this.data('collapse')
@@ -146,4 +154,4 @@
146
154
  })
147
155
  })
148
156
 
149
- }( window.jQuery );
157
+ }(window.jQuery);
@@ -18,15 +18,16 @@
18
18
  * ============================================================ */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* DROPDOWN CLASS DEFINITION
26
27
  * ========================= */
27
28
 
28
29
  var toggle = '[data-toggle="dropdown"]'
29
- , Dropdown = function ( element ) {
30
+ , Dropdown = function (element) {
30
31
  var $el = $(element).on('click.dropdown.data-api', this.toggle)
31
32
  $('html').on('click.dropdown.data-api', function () {
32
33
  $el.parent().removeClass('open')
@@ -37,12 +38,16 @@
37
38
 
38
39
  constructor: Dropdown
39
40
 
40
- , toggle: function ( e ) {
41
+ , toggle: function (e) {
41
42
  var $this = $(this)
42
- , selector = $this.attr('data-target')
43
43
  , $parent
44
+ , selector
44
45
  , isActive
45
46
 
47
+ if ($this.is('.disabled, :disabled')) return
48
+
49
+ selector = $this.attr('data-target')
50
+
46
51
  if (!selector) {
47
52
  selector = $this.attr('href')
48
53
  selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
@@ -54,7 +59,8 @@
54
59
  isActive = $parent.hasClass('open')
55
60
 
56
61
  clearMenus()
57
- !isActive && $parent.toggleClass('open')
62
+
63
+ if (!isActive) $parent.toggleClass('open')
58
64
 
59
65
  return false
60
66
  }
@@ -69,7 +75,7 @@
69
75
  /* DROPDOWN PLUGIN DEFINITION
70
76
  * ========================== */
71
77
 
72
- $.fn.dropdown = function ( option ) {
78
+ $.fn.dropdown = function (option) {
73
79
  return this.each(function () {
74
80
  var $this = $(this)
75
81
  , data = $this.data('dropdown')
@@ -91,4 +97,4 @@
91
97
  .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
92
98
  })
93
99
 
94
- }( window.jQuery );
100
+ }(window.jQuery);
@@ -18,14 +18,15 @@
18
18
  * ========================================================= */
19
19
 
20
20
 
21
- !function( $ ){
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
22
24
 
23
- "use strict"
24
25
 
25
26
  /* MODAL CLASS DEFINITION
26
27
  * ====================== */
27
28
 
28
- var Modal = function ( content, options ) {
29
+ var Modal = function (content, options) {
29
30
  this.options = options
30
31
  this.$element = $(content)
31
32
  .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
@@ -41,19 +42,23 @@
41
42
 
42
43
  , show: function () {
43
44
  var that = this
45
+ , e = $.Event('show')
46
+
47
+ this.$element.trigger(e)
44
48
 
45
- if (this.isShown) return
49
+ if (this.isShown || e.isDefaultPrevented()) return
46
50
 
47
51
  $('body').addClass('modal-open')
48
52
 
49
53
  this.isShown = true
50
- this.$element.trigger('show')
51
54
 
52
55
  escape.call(this)
53
56
  backdrop.call(this, function () {
54
57
  var transition = $.support.transition && that.$element.hasClass('fade')
55
58
 
56
- !that.$element.parent().length && that.$element.appendTo(document.body) //don't move modals dom position
59
+ if (!that.$element.parent().length) {
60
+ that.$element.appendTo(document.body) //don't move modals dom position
61
+ }
57
62
 
58
63
  that.$element
59
64
  .show()
@@ -71,21 +76,24 @@
71
76
  })
72
77
  }
73
78
 
74
- , hide: function ( e ) {
79
+ , hide: function (e) {
75
80
  e && e.preventDefault()
76
81
 
77
- if (!this.isShown) return
78
-
79
82
  var that = this
83
+
84
+ e = $.Event('hide')
85
+
86
+ this.$element.trigger(e)
87
+
88
+ if (!this.isShown || e.isDefaultPrevented()) return
89
+
80
90
  this.isShown = false
81
91
 
82
92
  $('body').removeClass('modal-open')
83
93
 
84
94
  escape.call(this)
85
95
 
86
- this.$element
87
- .trigger('hide')
88
- .removeClass('in')
96
+ this.$element.removeClass('in')
89
97
 
90
98
  $.support.transition && this.$element.hasClass('fade') ?
91
99
  hideWithTransition.call(this) :
@@ -111,7 +119,7 @@
111
119
  })
112
120
  }
113
121
 
114
- function hideModal( that ) {
122
+ function hideModal(that) {
115
123
  this.$element
116
124
  .hide()
117
125
  .trigger('hidden')
@@ -119,7 +127,7 @@
119
127
  backdrop.call(this)
120
128
  }
121
129
 
122
- function backdrop( callback ) {
130
+ function backdrop(callback) {
123
131
  var that = this
124
132
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
125
133
 
@@ -173,7 +181,7 @@
173
181
  /* MODAL PLUGIN DEFINITION
174
182
  * ======================= */
175
183
 
176
- $.fn.modal = function ( option ) {
184
+ $.fn.modal = function (option) {
177
185
  return this.each(function () {
178
186
  var $this = $(this)
179
187
  , data = $this.data('modal')
@@ -207,4 +215,4 @@
207
215
  })
208
216
  })
209
217
 
210
- }( window.jQuery );
218
+ }(window.jQuery);
@@ -18,14 +18,19 @@
18
18
  * =========================================================== */
19
19
 
20
20
 
21
- !function( $ ) {
21
+ !function ($) {
22
22
 
23
- "use strict"
23
+ "use strict"; // jshint ;_;
24
+
25
+
26
+ /* POPOVER PUBLIC CLASS DEFINITION
27
+ * =============================== */
24
28
 
25
29
  var Popover = function ( element, options ) {
26
30
  this.init('popover', element, options)
27
31
  }
28
32
 
33
+
29
34
  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
30
35
  ========================================== */
31
36
 
@@ -38,8 +43,8 @@
38
43
  , title = this.getTitle()
39
44
  , content = this.getContent()
40
45
 
41
- $tip.find('.popover-title').html(title)
42
- $tip.find('.popover-content > *').html(content)
46
+ $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
47
+ $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
43
48
 
44
49
  $tip.removeClass('fade top bottom left right in')
45
50
  }
@@ -59,7 +64,7 @@
59
64
  return content
60
65
  }
61
66
 
62
- , tip: function() {
67
+ , tip: function () {
63
68
  if (!this.$tip) {
64
69
  this.$tip = $(this.options.template)
65
70
  }
@@ -72,7 +77,7 @@
72
77
  /* POPOVER PLUGIN DEFINITION
73
78
  * ======================= */
74
79
 
75
- $.fn.popover = function ( option ) {
80
+ $.fn.popover = function (option) {
76
81
  return this.each(function () {
77
82
  var $this = $(this)
78
83
  , data = $this.data('popover')
@@ -90,4 +95,4 @@
90
95
  , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
91
96
  })
92
97
 
93
- }( window.jQuery );
98
+ }(window.jQuery);
@@ -17,9 +17,11 @@
17
17
  * limitations under the License.
18
18
  * ============================================================== */
19
19
 
20
- !function ( $ ) {
21
20
 
22
- "use strict"
21
+ !function ($) {
22
+
23
+ "use strict"; // jshint ;_;
24
+
23
25
 
24
26
  /* SCROLLSPY CLASS DEFINITION
25
27
  * ========================== */
@@ -46,8 +48,8 @@
46
48
  var self = this
47
49
  , $targets
48
50
 
49
- this.offsets = []
50
- this.targets = []
51
+ this.offsets = $([])
52
+ this.targets = $([])
51
53
 
52
54
  $targets = this.$body
53
55
  .find(this.selector)
@@ -92,16 +94,15 @@
92
94
 
93
95
  this.activeTarget = target
94
96
 
95
- this.$body
96
- .find(this.selector).parent('.active')
97
+ $(this.selector)
98
+ .parent('.active')
97
99
  .removeClass('active')
98
100
 
99
- active = this.$body
100
- .find(this.selector + '[href="' + target + '"]')
101
+ active = $(this.selector + '[href="' + target + '"]')
101
102
  .parent('li')
102
103
  .addClass('active')
103
104
 
104
- if ( active.parent('.dropdown-menu') ) {
105
+ if (active.parent('.dropdown-menu')) {
105
106
  active = active.closest('li.dropdown').addClass('active')
106
107
  }
107
108
 
@@ -141,4 +142,4 @@
141
142
  })
142
143
  })
143
144
 
144
- }( window.jQuery );
145
+ }(window.jQuery);