css-bootstrap-rails 0.0.6 → 0.0.7

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,5 +1,5 @@
1
1
  /* =========================================================
2
- * bootstrap-modal.js v1.4.0
2
+ * bootstrap-modal.js v2.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#modal
4
4
  * =========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -22,58 +22,29 @@
22
22
 
23
23
  "use strict"
24
24
 
25
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
26
- * ======================================================= */
27
-
28
- var transitionEnd
29
-
30
- $(document).ready(function () {
31
-
32
- $.support.transition = (function () {
33
- var thisBody = document.body || document.documentElement
34
- , thisStyle = thisBody.style
35
- , support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
36
- return support
37
- })()
38
-
39
- // set CSS transition event type
40
- if ( $.support.transition ) {
41
- transitionEnd = "TransitionEnd"
42
- if ( $.browser.webkit ) {
43
- transitionEnd = "webkitTransitionEnd"
44
- } else if ( $.browser.mozilla ) {
45
- transitionEnd = "transitionend"
46
- } else if ( $.browser.opera ) {
47
- transitionEnd = "oTransitionEnd"
48
- }
49
- }
50
-
51
- })
52
-
53
-
54
- /* MODAL PUBLIC CLASS DEFINITION
55
- * ============================= */
25
+ /* MODAL CLASS DEFINITION
26
+ * ====================== */
56
27
 
57
28
  var Modal = function ( content, options ) {
58
29
  this.settings = $.extend({}, $.fn.modal.defaults, options)
59
30
  this.$element = $(content)
60
- .delegate('.close', 'click.modal', $.proxy(this.hide, this))
61
-
62
- if ( this.settings.show ) {
63
- this.show()
64
- }
65
-
66
- return this
31
+ .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
32
+ this.settings.show && this.show()
67
33
  }
68
34
 
69
35
  Modal.prototype = {
70
36
 
71
- toggle: function () {
37
+ constructor: Modal
38
+
39
+ , toggle: function () {
72
40
  return this[!this.isShown ? 'show' : 'hide']()
73
41
  }
74
42
 
75
43
  , show: function () {
76
44
  var that = this
45
+
46
+ if (this.isShown) return
47
+
77
48
  this.isShown = true
78
49
  this.$element.trigger('show')
79
50
 
@@ -92,20 +63,16 @@
92
63
  that.$element.addClass('in')
93
64
 
94
65
  transition ?
95
- that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
66
+ that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
96
67
  that.$element.trigger('shown')
97
68
 
98
69
  })
99
-
100
- return this
101
70
  }
102
71
 
103
- , hide: function (e) {
72
+ , hide: function ( e ) {
104
73
  e && e.preventDefault()
105
74
 
106
- if ( !this.isShown ) {
107
- return this
108
- }
75
+ if (!this.isShown) return
109
76
 
110
77
  var that = this
111
78
  this.isShown = false
@@ -119,8 +86,6 @@
119
86
  $.support.transition && this.$element.hasClass('fade') ?
120
87
  hideWithTransition.call(this) :
121
88
  hideModal.call(this)
122
-
123
- return this
124
89
  }
125
90
 
126
91
  }
@@ -130,14 +95,13 @@
130
95
  * ===================== */
131
96
 
132
97
  function hideWithTransition() {
133
- // firefox drops transitionEnd events :{o
134
98
  var that = this
135
99
  , timeout = setTimeout(function () {
136
- that.$element.unbind(transitionEnd)
100
+ that.$element.unbind($.support.transition.end)
137
101
  hideModal.call(that)
138
102
  }, 500)
139
103
 
140
- this.$element.one(transitionEnd, function () {
104
+ this.$element.one($.support.transition.end, function () {
141
105
  clearTimeout(timeout)
142
106
  hideModal.call(that)
143
107
  })
@@ -154,35 +118,34 @@
154
118
  function backdrop ( callback ) {
155
119
  var that = this
156
120
  , animate = this.$element.hasClass('fade') ? 'fade' : ''
157
- if ( this.isShown && this.settings.backdrop ) {
121
+
122
+ if (this.isShown && this.settings.backdrop) {
158
123
  var doAnimate = $.support.transition && animate
159
124
 
160
125
  this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
161
126
  .appendTo(document.body)
162
127
 
163
- if ( this.settings.backdrop != 'static' ) {
128
+ if (this.settings.backdrop != 'static') {
164
129
  this.$backdrop.click($.proxy(this.hide, this))
165
130
  }
166
131
 
167
- if ( doAnimate ) {
168
- this.$backdrop[0].offsetWidth // force reflow
169
- }
132
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
170
133
 
171
134
  this.$backdrop.addClass('in')
172
135
 
173
136
  doAnimate ?
174
- this.$backdrop.one(transitionEnd, callback) :
137
+ this.$backdrop.one($.support.transition.end, callback) :
175
138
  callback()
176
139
 
177
- } else if ( !this.isShown && this.$backdrop ) {
140
+ } else if (!this.isShown && this.$backdrop) {
178
141
  this.$backdrop.removeClass('in')
179
142
 
180
143
  $.support.transition && this.$element.hasClass('fade')?
181
- this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
144
+ this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
182
145
  removeBackdrop.call(this)
183
146
 
184
- } else if ( callback ) {
185
- callback()
147
+ } else if (callback) {
148
+ callback()
186
149
  }
187
150
  }
188
151
 
@@ -193,14 +156,12 @@
193
156
 
194
157
  function escape() {
195
158
  var that = this
196
- if ( this.isShown && this.settings.keyboard ) {
197
- $(document).bind('keyup.modal', function ( e ) {
198
- if ( e.which == 27 ) {
199
- that.hide()
200
- }
159
+ if (this.isShown && this.settings.keyboard) {
160
+ $(document).bind('keyup.dismiss.modal', function ( e ) {
161
+ e.which == 27 && that.hide()
201
162
  })
202
- } else if ( !this.isShown ) {
203
- $(document).unbind('keyup.modal')
163
+ } else if (!this.isShown) {
164
+ $(document).unbind('keyup.dismiss.modal')
204
165
  }
205
166
  }
206
167
 
@@ -208,53 +169,36 @@
208
169
  /* MODAL PLUGIN DEFINITION
209
170
  * ======================= */
210
171
 
211
- $.fn.modal = function ( options ) {
212
- var modal = this.data('modal')
213
-
214
- if (!modal) {
215
-
216
- if (typeof options == 'string') {
217
- options = {
218
- show: /show|toggle/.test(options)
219
- }
220
- }
221
-
222
- return this.each(function () {
223
- $(this).data('modal', new Modal(this, options))
224
- })
225
- }
226
-
227
- if ( options === true ) {
228
- return modal
229
- }
230
-
231
- if ( typeof options == 'string' ) {
232
- modal[options]()
233
- } else if ( modal ) {
234
- modal.toggle()
235
- }
236
-
237
- return this
172
+ $.fn.modal = function ( option ) {
173
+ return this.each(function () {
174
+ var $this = $(this)
175
+ , data = $this.data('modal')
176
+ , options = typeof option == 'object' && option
177
+ if (!data) $this.data('modal', (data = new Modal(this, options)))
178
+ if (typeof option == 'string') data[option]()
179
+ })
238
180
  }
239
181
 
240
- $.fn.modal.Modal = Modal
241
-
242
182
  $.fn.modal.defaults = {
243
- backdrop: false
244
- , keyboard: false
245
- , show: false
183
+ backdrop: true
184
+ , keyboard: true
185
+ , show: true
246
186
  }
247
187
 
188
+ $.fn.modal.Modal = Modal
189
+
248
190
 
249
- /* MODAL DATA- IMPLEMENTATION
250
- * ========================== */
191
+ /* MODAL DATA-API
192
+ * ============== */
251
193
 
252
194
  $(document).ready(function () {
253
- $('body').delegate('[data-controls-modal]', 'click', function (e) {
195
+ $('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
196
+ var $this = $(this)
197
+ , target = $this.attr('data-target') || $this.attr('href')
198
+ , option = $(target).data('modal') ? 'toggle' : $this.data()
254
199
  e.preventDefault()
255
- var $this = $(this).data('show', true)
256
- $('#' + $this.attr('data-controls-modal')).modal( $this.data() )
200
+ $(target).modal(option)
257
201
  })
258
202
  })
259
203
 
260
- }( window.jQuery || window.ender );
204
+ }( window.jQuery || window.ender )
@@ -1,5 +1,5 @@
1
1
  /* ===========================================================
2
- * bootstrap-popover.js v1.4.0
2
+ * bootstrap-popover.js v2.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#popover
4
4
  * ===========================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -34,10 +34,16 @@
34
34
 
35
35
  Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
36
36
 
37
- setContent: function () {
37
+ constructor: Popover
38
+
39
+ , setContent: function () {
38
40
  var $tip = this.tip()
39
- $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
40
- $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
41
+ , title = this.getTitle()
42
+ , content = this.getContent()
43
+
44
+ $tip.find('.title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
45
+ $tip.find('.content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
46
+
41
47
  $tip[0].className = 'popover'
42
48
  }
43
49
 
@@ -51,10 +57,11 @@
51
57
  , o = this.options
52
58
 
53
59
  if (typeof this.options.content == 'string') {
54
- content = this.options.content
60
+ content = $e.attr(this.options.content)
55
61
  } else if (typeof this.options.content == 'function') {
56
62
  content = this.options.content.call(this.$element[0])
57
63
  }
64
+
58
65
  return content
59
66
  }
60
67
 
@@ -80,7 +87,10 @@
80
87
 
81
88
  $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
82
89
  placement: 'right'
90
+ , content: 'data-content'
83
91
  , template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
84
92
  })
85
93
 
86
- }( window.jQuery || window.ender );
94
+ $.fn.twipsy.rejectAttrOptions.push( 'content' )
95
+
96
+ }( window.jQuery || window.ender )
@@ -1,5 +1,5 @@
1
1
  /* =============================================================
2
- * bootstrap-scrollspy.js v1.4.0
2
+ * bootstrap-scrollspy.js v2.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#scrollspy
4
4
  * =============================================================
5
5
  * Copyright 2011 Twitter, Inc.
@@ -17,38 +17,45 @@
17
17
  * limitations under the License.
18
18
  * ============================================================== */
19
19
 
20
-
21
20
  !function ( $ ) {
22
21
 
23
22
  "use strict"
24
23
 
25
- var $window = $(window)
24
+ /* SCROLLSPY CLASS DEFINITION
25
+ * ========================== */
26
+
27
+ function ScrollSpy( element ) {
28
+ var process = $.proxy(this.process, this)
29
+
30
+ this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
31
+ this.selector = (this.$scrollElement.attr('data-target')
32
+ || this.$scrollElement.attr('href')
33
+ || '') + ' .nav li > a'
34
+ this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
26
35
 
27
- function ScrollSpy( topbar, selector ) {
28
- var processScroll = $.proxy(this.processScroll, this)
29
- this.$topbar = $(topbar)
30
- this.selector = selector || 'li > a'
31
36
  this.refresh()
32
- this.$topbar.delegate(this.selector, 'click', processScroll)
33
- $window.scroll(processScroll)
34
- this.processScroll()
37
+ this.process()
35
38
  }
36
39
 
37
40
  ScrollSpy.prototype = {
38
41
 
39
- refresh: function () {
40
- this.targets = this.$topbar.find(this.selector).map(function () {
41
- var href = $(this).attr('href')
42
- return /^#\w/.test(href) && $(href).length ? href : null
43
- })
42
+ constructor: ScrollSpy
43
+
44
+ , refresh: function () {
45
+ this.targets = this.$body
46
+ .find(this.selector)
47
+ .map(function () {
48
+ var href = $(this).attr('href')
49
+ return /^#\w/.test(href) && $(href).length ? href : null
50
+ })
44
51
 
45
52
  this.offsets = $.map(this.targets, function (id) {
46
- return $(id).offset().top
53
+ return $(id).position().top
47
54
  })
48
55
  }
49
56
 
50
- , processScroll: function () {
51
- var scrollTop = $window.scrollTop() + 10
57
+ , process: function () {
58
+ var scrollTop = this.$scrollElement.scrollTop() + 10
52
59
  , offsets = this.offsets
53
60
  , targets = this.targets
54
61
  , activeTarget = this.activeTarget
@@ -58,50 +65,50 @@
58
65
  activeTarget != targets[i]
59
66
  && scrollTop >= offsets[i]
60
67
  && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
61
- && this.activateButton( targets[i] )
68
+ && this.activate( targets[i] )
62
69
  }
63
70
  }
64
71
 
65
- , activateButton: function (target) {
72
+ , activate: function (target) {
73
+ var active
74
+
66
75
  this.activeTarget = target
67
76
 
68
- this.$topbar
77
+ this.$body
69
78
  .find(this.selector).parent('.active')
70
79
  .removeClass('active')
71
80
 
72
- this.$topbar
81
+ active = this.$body
73
82
  .find(this.selector + '[href="' + target + '"]')
74
83
  .parent('li')
75
84
  .addClass('active')
85
+
86
+ if ( active.parent('.dropdown-menu') ) {
87
+ active.closest('li.dropdown').addClass('active')
88
+ }
76
89
  }
77
90
 
78
91
  }
79
92
 
80
- /* SCROLLSPY PLUGIN DEFINITION
81
- * =========================== */
82
93
 
83
- $.fn.scrollSpy = function( options ) {
84
- var scrollspy = this.data('scrollspy')
94
+ /* SCROLLSPY PLUGIN DEFINITION
95
+ * =========================== */
85
96
 
86
- if (!scrollspy) {
87
- return this.each(function () {
88
- $(this).data('scrollspy', new ScrollSpy( this, options ))
89
- })
90
- }
97
+ $.fn.scrollspy = function ( option ) {
98
+ return this.each(function () {
99
+ var $this = $(this)
100
+ , data = $this.data('scrollspy')
101
+ if (!data) $this.data('scrollspy', (data = new ScrollSpy(this)))
102
+ if (typeof option == 'string') data[option]()
103
+ })
104
+ }
91
105
 
92
- if ( options === true ) {
93
- return scrollspy
94
- }
106
+ $.fn.scrollspy.ScrollSpy = ScrollSpy
95
107
 
96
- if ( typeof options == 'string' ) {
97
- scrollspy[options]()
98
- }
99
108
 
100
- return this
101
- }
109
+ /* SCROLLSPY DATA-API
110
+ * ============== */
102
111
 
103
- $(document).ready(function () {
104
- $('body').scrollSpy('[data-scrollspy] li > a')
105
- })
112
+ $(function () { $('[data-spy="scroll"]').scrollspy() })
106
113
 
107
- }( window.jQuery || window.ender );
114
+ }( window.jQuery || window.ender )