jombo 0.0.1.beta10 → 0.0.1.beta11

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.
@@ -1,3 +1,3 @@
1
1
  module Jombo
2
- VERSION = "0.0.1.beta10"
2
+ VERSION = "0.0.1.beta11"
3
3
  end
@@ -27,7 +27,7 @@
27
27
 
28
28
  var dismiss = '[data-dismiss="alert"]'
29
29
  , Alert = function ( el ) {
30
- $(el).delegate(dismiss, 'click', this.close)
30
+ $(el).on('click', dismiss, this.close)
31
31
  }
32
32
 
33
33
  Alert.prototype = {
@@ -35,18 +35,26 @@
35
35
  constructor: Alert
36
36
 
37
37
  , close: function ( e ) {
38
- var $element = $(this)
38
+ var $this = $(this)
39
+ , selector = $this.attr('data-target') || $this.attr('href')
40
+ , $parent = $(selector)
41
+
42
+ $parent.trigger('close')
39
43
 
40
- $element = $element.hasClass('alert-message') ? $element : $element.parent()
41
44
  e && e.preventDefault()
42
- $element.removeClass('in')
45
+
46
+ $parent.length || ($parent = $this.hasClass('alert-message') ? $this : $this.parent())
47
+
48
+ $parent.removeClass('in')
43
49
 
44
50
  function removeElement() {
45
- $element.remove()
51
+ $parent.remove()
52
+
53
+ $parent.trigger('closed')
46
54
  }
47
55
 
48
- $.support.transition && $element.hasClass('fade') ?
49
- $element.bind($.support.transition.end, removeElement) :
56
+ $.support.transition && $parent.hasClass('fade') ?
57
+ $parent.on($.support.transition.end, removeElement) :
50
58
  removeElement()
51
59
  }
52
60
 
@@ -65,14 +73,14 @@
65
73
  })
66
74
  }
67
75
 
68
- $.fn.alert.Alert = Alert
76
+ $.fn.alert.Constructor = Alert
69
77
 
70
78
 
71
79
  /* ALERT DATA-API
72
80
  * ============== */
73
81
 
74
82
  $(function () {
75
- $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
83
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
76
84
  })
77
85
 
78
- }( window.jQuery || window.ender )
86
+ }( window.jQuery )
@@ -24,16 +24,16 @@
24
24
  /* BUTTON PUBLIC CLASS DEFINITION
25
25
  * ============================== */
26
26
 
27
- var Button = function (element, options) {
27
+ var Button = function ( element, options ) {
28
28
  this.$element = $(element)
29
- this.settings = $.extend({}, $.fn.button.defaults, options)
29
+ this.options = $.extend({}, $.fn.button.defaults, options)
30
30
  }
31
31
 
32
32
  Button.prototype = {
33
33
 
34
34
  constructor: Button
35
35
 
36
- , setState: function (state) {
36
+ , setState: function ( state ) {
37
37
  var d = 'disabled'
38
38
  , $el = this.$element
39
39
  , data = $el.data()
@@ -42,7 +42,7 @@
42
42
  state = state + 'Text'
43
43
  data.resetText || $el.data('resetText', $el[val]())
44
44
 
45
- $el[val](data[state] || this.settings[state])
45
+ $el[val](data[state] || this.options[state])
46
46
 
47
47
  // push to event loop to allow forms to submit
48
48
  setTimeout(function () {
@@ -83,16 +83,16 @@
83
83
  loadingText: 'loading...'
84
84
  }
85
85
 
86
- $.fn.button.Button = Button
86
+ $.fn.button.Constructor = Button
87
87
 
88
88
 
89
89
  /* BUTTON DATA-API
90
90
  * =============== */
91
91
 
92
92
  $(function () {
93
- $('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
93
+ $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
94
94
  $(e.srcElement).button('toggle')
95
95
  })
96
96
  })
97
97
 
98
- }( window.jQuery || window.ender )
98
+ }( window.jQuery )
@@ -25,8 +25,8 @@
25
25
  /* CAROUSEL CLASS DEFINITION
26
26
  * ========================= */
27
27
 
28
- var Carousel = function ( el ) {
29
- $(el).delegate(dismiss, 'click', this.close)
28
+ var Carousel = function () {
29
+
30
30
  }
31
31
 
32
32
  Carousel.prototype = {
@@ -40,20 +40,12 @@
40
40
  $.fn.carousel = function ( option ) {
41
41
  return this.each(function () {
42
42
  var $this = $(this)
43
- , data = $this.data('alert')
44
- if (!data) $this.data('alert', (data = new Alert(this)))
43
+ , data = $this.data('carousel')
44
+ if (!data) $this.data('carousel', (data = new Carousel(this)))
45
45
  if (typeof option == 'string') data[option].call($this)
46
46
  })
47
47
  }
48
48
 
49
- $.fn.carousel.Carousel = Carousel
50
-
51
-
52
- /* CAROUSEL DATA-API
53
- * ================= */
54
-
55
- // $(function () {
56
- // $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
57
- // })
49
+ $.fn.carousel.Constructor = Carousel
58
50
 
59
- }( window.jQuery || window.ender )
51
+ }( window.jQuery )
@@ -17,19 +17,19 @@
17
17
  * limitations under the License.
18
18
  * ============================================================ */
19
19
 
20
- (function( $ ){
20
+ !function( $ ){
21
21
 
22
22
  "use strict"
23
23
 
24
24
  var Collapse = function ( element, options ) {
25
25
  this.$element = $(element)
26
- this.settings = $.extend({}, $.fn.collapse.defaults, options)
26
+ this.options = $.extend({}, $.fn.collapse.defaults, options)
27
27
 
28
- if (this.settings["parent"]) {
29
- this.$parent = $(this.settings["parent"])
28
+ if (this.options["parent"]) {
29
+ this.$parent = $(this.options["parent"])
30
30
  }
31
31
 
32
- this.settings.toggle && this.toggle()
32
+ this.options.toggle && this.toggle()
33
33
  }
34
34
 
35
35
  Collapse.prototype = {
@@ -116,20 +116,20 @@
116
116
  toggle: true
117
117
  }
118
118
 
119
- $.fn.collapse.Collapse = Collapse
119
+ $.fn.collapse.Constructor = Collapse
120
120
 
121
121
 
122
122
  /* COLLAPSIBLE DATA-API
123
123
  * ==================== */
124
124
 
125
125
  $(function () {
126
- $('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
126
+ $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
127
127
  var $this = $(this)
128
128
  , target = $this.attr('data-target') || $this.attr('href')
129
129
  , option = $(target).data('collapse') ? 'toggle' : $this.data()
130
- e.preventDefault()
130
+ e.preventDefault()
131
131
  $(target).collapse(option)
132
132
  })
133
133
  })
134
134
 
135
- })( window.jQuery || window.ender )
135
+ }( window.jQuery )
@@ -35,11 +35,15 @@
35
35
  constructor: Dropdown
36
36
 
37
37
  , toggle: function ( e ) {
38
- var li = $(this).parent('li')
39
- , isActive = li.hasClass('open')
38
+ var $this = $(this)
39
+ , selector = $this.attr('data-target') || $this.attr('href')
40
+ , $parent = $(selector)
41
+
42
+ $parent.length || ($parent = $this.parent())
40
43
 
41
44
  clearMenus()
42
- !isActive && li.toggleClass('open')
45
+
46
+ !$parent.hasClass('open') && $parent.toggleClass('open')
43
47
 
44
48
  return false
45
49
  }
@@ -47,7 +51,7 @@
47
51
  }
48
52
 
49
53
  function clearMenus() {
50
- $(toggle).parent('li').removeClass('open')
54
+ $(toggle).parent().removeClass('open')
51
55
  }
52
56
 
53
57
 
@@ -63,13 +67,15 @@
63
67
  })
64
68
  }
65
69
 
70
+ $.fn.dropdown.Constructor = Dropdown
71
+
66
72
 
67
73
  /* APPLY TO STANDARD DROPDOWN ELEMENTS
68
74
  * =================================== */
69
75
 
70
76
  $(function () {
71
- $('html').bind('click.dropdown.data-api', clearMenus)
72
- $('body').delegate(toggle, 'click.dropdown.data-api', Dropdown.prototype.toggle)
77
+ $('html').on('click.dropdown.data-api', clearMenus)
78
+ $('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
73
79
  })
74
80
 
75
- }( window.jQuery || window.ender )
81
+ }( window.jQuery )
@@ -26,10 +26,9 @@
26
26
  * ====================== */
27
27
 
28
28
  var Modal = function ( content, options ) {
29
- this.settings = $.extend({}, $.fn.modal.defaults, options)
29
+ this.options = $.extend({}, $.fn.modal.defaults, options)
30
30
  this.$element = $(content)
31
31
  .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
32
- this.settings.show && this.show()
33
32
  }
34
33
 
35
34
  Modal.prototype = {
@@ -97,7 +96,7 @@
97
96
  function hideWithTransition() {
98
97
  var that = this
99
98
  , timeout = setTimeout(function () {
100
- that.$element.unbind($.support.transition.end)
99
+ that.$element.off($.support.transition.end)
101
100
  hideModal.call(that)
102
101
  }, 500)
103
102
 
@@ -107,7 +106,7 @@
107
106
  })
108
107
  }
109
108
 
110
- function hideModal (that) {
109
+ function hideModal( that ) {
111
110
  this.$element
112
111
  .hide()
113
112
  .trigger('hidden')
@@ -115,17 +114,17 @@
115
114
  backdrop.call(this)
116
115
  }
117
116
 
118
- function backdrop ( callback ) {
117
+ function backdrop( callback ) {
119
118
  var that = this
120
119
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
121
120
 
122
- if (this.isShown && this.settings.backdrop) {
121
+ if (this.isShown && this.options.backdrop) {
123
122
  var doAnimate = $.support.transition && animate
124
123
 
125
124
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
126
125
  .appendTo(document.body)
127
126
 
128
- if (this.settings.backdrop != 'static') {
127
+ if (this.options.backdrop != 'static') {
129
128
  this.$backdrop.click($.proxy(this.hide, this))
130
129
  }
131
130
 
@@ -156,12 +155,12 @@
156
155
 
157
156
  function escape() {
158
157
  var that = this
159
- if (this.isShown && this.settings.keyboard) {
160
- $(document).bind('keyup.dismiss.modal', function ( e ) {
158
+ if (this.isShown && this.options.keyboard) {
159
+ $(document).on('keyup.dismiss.modal', function ( e ) {
161
160
  e.which == 27 && that.hide()
162
161
  })
163
162
  } else if (!this.isShown) {
164
- $(document).unbind('keyup.dismiss.modal')
163
+ $(document).off('keyup.dismiss.modal')
165
164
  }
166
165
  }
167
166
 
@@ -176,29 +175,30 @@
176
175
  , options = typeof option == 'object' && option
177
176
  if (!data) $this.data('modal', (data = new Modal(this, options)))
178
177
  if (typeof option == 'string') data[option]()
178
+ else data.show()
179
179
  })
180
180
  }
181
181
 
182
182
  $.fn.modal.defaults = {
183
183
  backdrop: true
184
184
  , keyboard: true
185
- , show: true
186
185
  }
187
186
 
188
- $.fn.modal.Modal = Modal
187
+ $.fn.modal.Constructor = Modal
189
188
 
190
189
 
191
190
  /* MODAL DATA-API
192
191
  * ============== */
193
192
 
194
- $(document).ready(function () {
195
- $('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
193
+ $(function () {
194
+ $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
196
195
  var $this = $(this)
197
- , target = $this.attr('data-target') || $this.attr('href')
198
- , option = $(target).data('modal') ? 'toggle' : $this.data()
196
+ , $target = $($this.attr('data-target') || $this.attr('href'))
197
+ , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
198
+
199
199
  e.preventDefault()
200
- $(target).modal(option)
200
+ $target.modal(option)
201
201
  })
202
202
  })
203
203
 
204
- }( window.jQuery || window.ender )
204
+ }( window.jQuery )
@@ -23,16 +23,13 @@
23
23
  "use strict"
24
24
 
25
25
  var Popover = function ( element, options ) {
26
- this.$element = $(element)
27
- this.options = options
28
- this.enabled = true
29
- this.fixTitle()
26
+ this.init('popover', element, options)
30
27
  }
31
28
 
32
29
  /* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
33
30
  ========================================= */
34
31
 
35
- Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
32
+ Popover.prototype = $.extend({}, $.fn.twipsy.Constructor.prototype, {
36
33
 
37
34
  constructor: Popover
38
35
 
@@ -53,22 +50,20 @@
53
50
 
54
51
  , getContent: function () {
55
52
  var content
56
- , $e = this.$element
57
- , o = this.options
53
+ , $e = this.$element
54
+ , o = this.options
58
55
 
59
- if (typeof this.options.content == 'string') {
60
- content = $e.attr(this.options.content)
61
- } else if (typeof this.options.content == 'function') {
62
- content = this.options.content.call(this.$element[0])
63
- }
56
+ content = $e.attr('data-content')
57
+ || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
58
+
59
+ content = content.toString().replace(/(^\s*|\s*$)/, "")
64
60
 
65
61
  return content
66
62
  }
67
63
 
68
64
  , tip: function() {
69
65
  if (!this.$tip) {
70
- this.$tip = $('<div class="popover" />')
71
- .html(this.options.template)
66
+ this.$tip = $(this.options.template)
72
67
  }
73
68
  return this.$tip
74
69
  }
@@ -79,18 +74,22 @@
79
74
  /* POPOVER PLUGIN DEFINITION
80
75
  * ======================= */
81
76
 
82
- $.fn.popover = function (options) {
83
- if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
84
- $.fn.twipsy.initWith.call(this, options, Popover, 'popover')
85
- return this
77
+ $.fn.popover = function ( option ) {
78
+ return this.each(function () {
79
+ var $this = $(this)
80
+ , data = $this.data('popover')
81
+ , options = typeof option == 'object' && option
82
+ if (!data) $this.data('popover', (data = new Popover(this, options)))
83
+ if (typeof option == 'string') data[option]()
84
+ })
86
85
  }
87
86
 
87
+ $.fn.popover.Constructor = Popover
88
+
88
89
  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
89
90
  placement: 'right'
90
- , content: 'data-content'
91
- , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
91
+ , content: ''
92
+ , template: '<div class="popover"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
92
93
  })
93
94
 
94
- $.fn.twipsy.rejectAttrOptions.push( 'content' )
95
-
96
- }( window.jQuery || window.ender )
95
+ }( window.jQuery )
@@ -27,11 +27,11 @@
27
27
  function ScrollSpy( element ) {
28
28
  var process = $.proxy(this.process, this)
29
29
 
30
- this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
30
+ this.$scrollElement = $(element).on('scroll.scroll.data-api', process)
31
31
  this.selector = (this.$scrollElement.attr('data-target')
32
32
  || this.$scrollElement.attr('href')
33
33
  || '') + ' .nav li > a'
34
- this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
34
+ this.$body = $('body').on('click.scroll.data-api', this.selector, process)
35
35
 
36
36
  this.refresh()
37
37
  this.process()
@@ -103,7 +103,7 @@
103
103
  })
104
104
  }
105
105
 
106
- $.fn.scrollspy.ScrollSpy = ScrollSpy
106
+ $.fn.scrollspy.Constructor = ScrollSpy
107
107
 
108
108
 
109
109
  /* SCROLLSPY DATA-API
@@ -111,4 +111,4 @@
111
111
 
112
112
  $(function () { $('[data-spy="scroll"]').scrollspy() })
113
113
 
114
- }( window.jQuery || window.ender )
114
+ }( window.jQuery )