twitter_bootstrap_builder 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twitter_bootstrap_builder/builders/fieldset_builder.rb +9 -3
- data/lib/twitter_bootstrap_builder/builders/nav_container_builder.rb +4 -0
- data/lib/twitter_bootstrap_builder/builders/nav_list_builder.rb +5 -1
- data/lib/twitter_bootstrap_builder/builders/tab_builder.rb +23 -0
- data/lib/twitter_bootstrap_builder/helpers/commons_helper.rb +24 -0
- data/lib/twitter_bootstrap_builder/version.rb +1 -1
- data/lib/twitter_bootstrap_builder.rb +1 -0
- data/vendor/assets/javascripts/bootstrap.js +1156 -1254
- data/vendor/assets/javascripts/twitter_bootstrap_builder.js +23 -0
- data/vendor/assets/stylesheets/twitter_bootstrap_builder.css +4 -0
- metadata +8 -6
@@ -20,43 +20,39 @@
|
|
20
20
|
|
21
21
|
!function ($) {
|
22
22
|
|
23
|
-
|
23
|
+
$(function () {
|
24
24
|
|
25
|
-
|
25
|
+
"use strict"; // jshint ;_;
|
26
26
|
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
|
29
|
+
* ======================================================= */
|
30
30
|
|
31
|
-
|
31
|
+
$.support.transition = (function () {
|
32
32
|
|
33
|
-
|
33
|
+
var transitionEnd = (function () {
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
, 'msTransition' : 'MSTransitionEnd'
|
41
|
-
, 'transition' : 'transitionend'
|
42
|
-
}
|
43
|
-
, name
|
35
|
+
var el = document.createElement('bootstrap')
|
36
|
+
, transEndEventNames = {
|
37
|
+
'WebkitTransition':'webkitTransitionEnd', 'MozTransition':'transitionend', 'OTransition':'oTransitionEnd', 'msTransition':'MSTransitionEnd', 'transition':'transitionend'
|
38
|
+
}
|
39
|
+
, name
|
44
40
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
for (name in transEndEventNames) {
|
42
|
+
if (el.style[name] !== undefined) {
|
43
|
+
return transEndEventNames[name]
|
44
|
+
}
|
45
|
+
}
|
50
46
|
|
51
|
-
|
47
|
+
}())
|
52
48
|
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
return transitionEnd && {
|
50
|
+
end:transitionEnd
|
51
|
+
}
|
56
52
|
|
57
|
-
|
53
|
+
})()
|
58
54
|
|
59
|
-
|
55
|
+
})
|
60
56
|
|
61
57
|
}(window.jQuery);
|
62
58
|
/* =========================================================
|
@@ -81,200 +77,194 @@
|
|
81
77
|
|
82
78
|
!function ($) {
|
83
79
|
|
84
|
-
|
80
|
+
"use strict"; // jshint ;_;
|
85
81
|
|
86
82
|
|
87
|
-
|
88
|
-
|
83
|
+
/* MODAL CLASS DEFINITION
|
84
|
+
* ====================== */
|
89
85
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
86
|
+
var Modal = function (content, options) {
|
87
|
+
this.options = options
|
88
|
+
this.$element = $(content)
|
89
|
+
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
90
|
+
}
|
95
91
|
|
96
|
-
|
92
|
+
Modal.prototype = {
|
97
93
|
|
98
|
-
|
94
|
+
constructor:Modal, toggle:function () {
|
95
|
+
return this[!this.isShown ? 'show' : 'hide']()
|
96
|
+
}, show:function () {
|
97
|
+
var that = this
|
98
|
+
, e = $.Event('show')
|
99
99
|
|
100
|
-
|
101
|
-
return this[!this.isShown ? 'show' : 'hide']()
|
102
|
-
}
|
100
|
+
this.$element.trigger(e)
|
103
101
|
|
104
|
-
|
105
|
-
var that = this
|
106
|
-
, e = $.Event('show')
|
102
|
+
if (this.isShown || e.isDefaultPrevented()) return
|
107
103
|
|
108
|
-
|
104
|
+
$('body').addClass('modal-open')
|
109
105
|
|
110
|
-
|
106
|
+
this.isShown = true
|
111
107
|
|
112
|
-
|
108
|
+
escape.call(this)
|
109
|
+
backdrop.call(this, function () {
|
110
|
+
var transition = $.support.transition && that.$element.hasClass('fade')
|
113
111
|
|
114
|
-
|
112
|
+
if (!that.$element.parent().length) {
|
113
|
+
that.$element.appendTo(document.body) //don't move modals dom position
|
114
|
+
}
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
var transition = $.support.transition && that.$element.hasClass('fade')
|
116
|
+
that.$element
|
117
|
+
.show()
|
119
118
|
|
120
|
-
|
121
|
-
|
122
|
-
|
119
|
+
if (transition) {
|
120
|
+
that.$element[0].offsetWidth // force reflow
|
121
|
+
}
|
123
122
|
|
124
|
-
|
125
|
-
.show()
|
123
|
+
that.$element.addClass('in')
|
126
124
|
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
transition ?
|
126
|
+
that.$element.one($.support.transition.end, function () {
|
127
|
+
that.$element.trigger('shown')
|
128
|
+
}) :
|
129
|
+
that.$element.trigger('shown')
|
130
130
|
|
131
|
-
|
131
|
+
})
|
132
|
+
}, hide:function (e) {
|
133
|
+
e && e.preventDefault()
|
132
134
|
|
133
|
-
|
134
|
-
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
|
135
|
-
that.$element.trigger('shown')
|
135
|
+
var that = this
|
136
136
|
|
137
|
-
|
138
|
-
}
|
137
|
+
e = $.Event('hide')
|
139
138
|
|
140
|
-
|
141
|
-
e && e.preventDefault()
|
142
|
-
|
143
|
-
var that = this
|
144
|
-
|
145
|
-
e = $.Event('hide')
|
139
|
+
this.$element.trigger(e)
|
146
140
|
|
147
|
-
|
141
|
+
if (!this.isShown || e.isDefaultPrevented()) return
|
148
142
|
|
149
|
-
|
143
|
+
this.isShown = false
|
150
144
|
|
151
|
-
|
145
|
+
$('body').removeClass('modal-open')
|
152
146
|
|
153
|
-
|
147
|
+
escape.call(this)
|
154
148
|
|
155
|
-
|
149
|
+
this.$element.removeClass('in')
|
156
150
|
|
157
|
-
|
151
|
+
$.support.transition && this.$element.hasClass('fade') ?
|
152
|
+
hideWithTransition.call(this) :
|
153
|
+
hideModal.call(this)
|
154
|
+
}
|
158
155
|
|
159
|
-
|
160
|
-
hideWithTransition.call(this) :
|
161
|
-
hideModal.call(this)
|
162
|
-
}
|
156
|
+
}
|
163
157
|
|
164
|
-
}
|
165
158
|
|
159
|
+
/* MODAL PRIVATE METHODS
|
160
|
+
* ===================== */
|
166
161
|
|
167
|
-
|
168
|
-
|
162
|
+
function hideWithTransition() {
|
163
|
+
var that = this
|
164
|
+
, timeout = setTimeout(function () {
|
165
|
+
that.$element.off($.support.transition.end)
|
166
|
+
hideModal.call(that)
|
167
|
+
}, 500)
|
169
168
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
}, 500)
|
169
|
+
this.$element.one($.support.transition.end, function () {
|
170
|
+
clearTimeout(timeout)
|
171
|
+
hideModal.call(that)
|
172
|
+
})
|
173
|
+
}
|
176
174
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
}
|
175
|
+
function hideModal(that) {
|
176
|
+
this.$element
|
177
|
+
.hide()
|
178
|
+
.trigger('hidden')
|
182
179
|
|
183
|
-
|
184
|
-
|
185
|
-
.hide()
|
186
|
-
.trigger('hidden')
|
180
|
+
backdrop.call(this)
|
181
|
+
}
|
187
182
|
|
188
|
-
backdrop
|
189
|
-
|
183
|
+
function backdrop(callback) {
|
184
|
+
var that = this
|
185
|
+
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
190
186
|
|
191
|
-
|
192
|
-
|
193
|
-
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
187
|
+
if (this.isShown && this.options.backdrop) {
|
188
|
+
var doAnimate = $.support.transition && animate
|
194
189
|
|
195
|
-
|
196
|
-
|
190
|
+
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
191
|
+
.appendTo(document.body)
|
197
192
|
|
198
|
-
|
199
|
-
|
193
|
+
if (this.options.backdrop != 'static') {
|
194
|
+
this.$backdrop.click($.proxy(this.hide, this))
|
195
|
+
}
|
200
196
|
|
201
|
-
|
202
|
-
this.$backdrop.click($.proxy(this.hide, this))
|
203
|
-
}
|
197
|
+
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
204
198
|
|
205
|
-
|
199
|
+
this.$backdrop.addClass('in')
|
206
200
|
|
207
|
-
|
201
|
+
doAnimate ?
|
202
|
+
this.$backdrop.one($.support.transition.end, callback) :
|
203
|
+
callback()
|
208
204
|
|
209
|
-
|
210
|
-
|
211
|
-
callback()
|
205
|
+
} else if (!this.isShown && this.$backdrop) {
|
206
|
+
this.$backdrop.removeClass('in')
|
212
207
|
|
213
|
-
|
214
|
-
|
208
|
+
$.support.transition && this.$element.hasClass('fade') ?
|
209
|
+
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
|
210
|
+
removeBackdrop.call(this)
|
215
211
|
|
216
|
-
|
217
|
-
|
218
|
-
|
212
|
+
} else if (callback) {
|
213
|
+
callback()
|
214
|
+
}
|
215
|
+
}
|
219
216
|
|
220
|
-
|
221
|
-
|
217
|
+
function removeBackdrop() {
|
218
|
+
this.$backdrop.remove()
|
219
|
+
this.$backdrop = null
|
222
220
|
}
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
$(document).on('keyup.dismiss.modal', function ( e ) {
|
234
|
-
e.which == 27 && that.hide()
|
235
|
-
})
|
236
|
-
} else if (!this.isShown) {
|
237
|
-
$(document).off('keyup.dismiss.modal')
|
221
|
+
|
222
|
+
function escape() {
|
223
|
+
var that = this
|
224
|
+
if (this.isShown && this.options.keyboard) {
|
225
|
+
$(document).on('keyup.dismiss.modal', function (e) {
|
226
|
+
e.which == 27 && that.hide()
|
227
|
+
})
|
228
|
+
} else if (!this.isShown) {
|
229
|
+
$(document).off('keyup.dismiss.modal')
|
230
|
+
}
|
238
231
|
}
|
239
|
-
}
|
240
232
|
|
241
233
|
|
242
|
-
|
243
|
-
|
234
|
+
/* MODAL PLUGIN DEFINITION
|
235
|
+
* ======================= */
|
244
236
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
237
|
+
$.fn.modal = function (option) {
|
238
|
+
return this.each(function () {
|
239
|
+
var $this = $(this)
|
240
|
+
, data = $this.data('modal')
|
241
|
+
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
|
242
|
+
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
243
|
+
if (typeof option == 'string') data[option]()
|
244
|
+
else if (options.show) data.show()
|
245
|
+
})
|
246
|
+
}
|
255
247
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
, show: true
|
260
|
-
}
|
248
|
+
$.fn.modal.defaults = {
|
249
|
+
backdrop:true, keyboard:true, show:true
|
250
|
+
}
|
261
251
|
|
262
|
-
|
252
|
+
$.fn.modal.Constructor = Modal
|
263
253
|
|
264
254
|
|
265
|
-
|
266
|
-
|
255
|
+
/* MODAL DATA-API
|
256
|
+
* ============== */
|
267
257
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
258
|
+
$(function () {
|
259
|
+
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
|
260
|
+
var $this = $(this), href
|
261
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
262
|
+
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
273
263
|
|
274
|
-
|
275
|
-
|
264
|
+
e.preventDefault()
|
265
|
+
$target.modal(option)
|
266
|
+
})
|
276
267
|
})
|
277
|
-
})
|
278
268
|
|
279
269
|
}(window.jQuery);
|
280
270
|
/* ============================================================
|
@@ -299,82 +289,82 @@
|
|
299
289
|
|
300
290
|
!function ($) {
|
301
291
|
|
302
|
-
|
292
|
+
"use strict"; // jshint ;_;
|
303
293
|
|
304
294
|
|
305
|
-
|
306
|
-
|
295
|
+
/* DROPDOWN CLASS DEFINITION
|
296
|
+
* ========================= */
|
307
297
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
298
|
+
var toggle = '[data-toggle="dropdown"]'
|
299
|
+
, Dropdown = function (element) {
|
300
|
+
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
301
|
+
$('html').on('click.dropdown.data-api', function () {
|
302
|
+
$el.parent().removeClass('open')
|
303
|
+
})
|
304
|
+
}
|
315
305
|
|
316
|
-
|
306
|
+
Dropdown.prototype = {
|
317
307
|
|
318
|
-
|
308
|
+
constructor:Dropdown, toggle:function (e) {
|
309
|
+
var $this = $(this)
|
310
|
+
, $parent
|
311
|
+
, selector
|
312
|
+
, isActive
|
319
313
|
|
320
|
-
|
321
|
-
var $this = $(this)
|
322
|
-
, $parent
|
323
|
-
, selector
|
324
|
-
, isActive
|
314
|
+
if ($this.is('.disabled, :disabled')) return
|
325
315
|
|
326
|
-
|
316
|
+
selector = $this.attr('data-target')
|
327
317
|
|
328
|
-
|
318
|
+
if (!selector) {
|
319
|
+
selector = $this.attr('href')
|
320
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
321
|
+
}
|
329
322
|
|
330
|
-
|
331
|
-
|
332
|
-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
333
|
-
}
|
323
|
+
$parent = $(selector)
|
324
|
+
$parent.length || ($parent = $this.parent())
|
334
325
|
|
335
|
-
|
336
|
-
$parent.length || ($parent = $this.parent())
|
326
|
+
isActive = $parent.hasClass('open')
|
337
327
|
|
338
|
-
|
328
|
+
clearMenus()
|
339
329
|
|
340
|
-
|
330
|
+
if (!isActive) $parent.toggleClass('open')
|
341
331
|
|
342
|
-
|
332
|
+
return false
|
333
|
+
}
|
343
334
|
|
344
|
-
return false
|
345
335
|
}
|
346
336
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
$(toggle).parent().removeClass('open')
|
351
|
-
}
|
337
|
+
function clearMenus() {
|
338
|
+
$(toggle).parent().removeClass('open')
|
339
|
+
}
|
352
340
|
|
353
341
|
|
354
|
-
|
355
|
-
|
342
|
+
/* DROPDOWN PLUGIN DEFINITION
|
343
|
+
* ========================== */
|
356
344
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
345
|
+
$.fn.dropdown = function (option) {
|
346
|
+
return this.each(function () {
|
347
|
+
var $this = $(this)
|
348
|
+
, data = $this.data('dropdown')
|
349
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
350
|
+
if (typeof option == 'string') data[option].call($this)
|
351
|
+
})
|
352
|
+
}
|
365
353
|
|
366
|
-
|
354
|
+
$.fn.dropdown.Constructor = Dropdown
|
367
355
|
|
368
356
|
|
369
|
-
|
370
|
-
|
357
|
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
358
|
+
* =================================== */
|
371
359
|
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
360
|
+
$(function () {
|
361
|
+
$('html').on('click.dropdown.data-api', clearMenus)
|
362
|
+
$('body')
|
363
|
+
.on('click.dropdown', '.dropdown form', function (e) {
|
364
|
+
e.stopPropagation()
|
365
|
+
})
|
366
|
+
.on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
367
|
+
})
|
378
368
|
|
379
369
|
}(window.jQuery);
|
380
370
|
/* =============================================================
|
@@ -399,133 +389,131 @@
|
|
399
389
|
|
400
390
|
!function ($) {
|
401
391
|
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
/* SCROLLSPY CLASS DEFINITION
|
406
|
-
* ========================== */
|
407
|
-
|
408
|
-
function ScrollSpy( element, options) {
|
409
|
-
var process = $.proxy(this.process, this)
|
410
|
-
, $element = $(element).is('body') ? $(window) : $(element)
|
411
|
-
, href
|
412
|
-
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
|
413
|
-
this.$scrollElement = $element.on('scroll.scroll.data-api', process)
|
414
|
-
this.selector = (this.options.target
|
415
|
-
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
416
|
-
|| '') + ' .nav li > a'
|
417
|
-
this.$body = $('body')
|
418
|
-
this.refresh()
|
419
|
-
this.process()
|
420
|
-
}
|
421
|
-
|
422
|
-
ScrollSpy.prototype = {
|
423
|
-
|
424
|
-
constructor: ScrollSpy
|
425
|
-
|
426
|
-
, refresh: function () {
|
427
|
-
var self = this
|
428
|
-
, $targets
|
429
|
-
|
430
|
-
this.offsets = $([])
|
431
|
-
this.targets = $([])
|
432
|
-
|
433
|
-
$targets = this.$body
|
434
|
-
.find(this.selector)
|
435
|
-
.map(function () {
|
436
|
-
var $el = $(this)
|
437
|
-
, href = $el.data('target') || $el.attr('href')
|
438
|
-
, $href = /^#\w/.test(href) && $(href)
|
439
|
-
return ( $href
|
440
|
-
&& href.length
|
441
|
-
&& [[ $href.position().top, href ]] ) || null
|
442
|
-
})
|
443
|
-
.sort(function (a, b) { return a[0] - b[0] })
|
444
|
-
.each(function () {
|
445
|
-
self.offsets.push(this[0])
|
446
|
-
self.targets.push(this[1])
|
447
|
-
})
|
448
|
-
}
|
449
|
-
|
450
|
-
, process: function () {
|
451
|
-
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
452
|
-
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
453
|
-
, maxScroll = scrollHeight - this.$scrollElement.height()
|
454
|
-
, offsets = this.offsets
|
455
|
-
, targets = this.targets
|
456
|
-
, activeTarget = this.activeTarget
|
457
|
-
, i
|
458
|
-
|
459
|
-
if (scrollTop >= maxScroll) {
|
460
|
-
return activeTarget != (i = targets.last()[0])
|
461
|
-
&& this.activate ( i )
|
462
|
-
}
|
392
|
+
"use strict"; // jshint ;_;
|
463
393
|
|
464
|
-
for (i = offsets.length; i--;) {
|
465
|
-
activeTarget != targets[i]
|
466
|
-
&& scrollTop >= offsets[i]
|
467
|
-
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
468
|
-
&& this.activate( targets[i] )
|
469
|
-
}
|
470
|
-
}
|
471
394
|
|
472
|
-
|
473
|
-
|
474
|
-
|
395
|
+
/* SCROLLSPY CLASS DEFINITION
|
396
|
+
* ========================== */
|
397
|
+
|
398
|
+
function ScrollSpy(element, options) {
|
399
|
+
var process = $.proxy(this.process, this)
|
400
|
+
, $element = $(element).is('body') ? $(window) : $(element)
|
401
|
+
, href
|
402
|
+
this.options = $.extend({}, $.fn.scrollspy.defaults, options)
|
403
|
+
this.$scrollElement = $element.on('scroll.scroll.data-api', process)
|
404
|
+
this.selector = (this.options.target
|
405
|
+
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
406
|
+
|| '') + ' .nav li > a'
|
407
|
+
this.$body = $('body')
|
408
|
+
this.refresh()
|
409
|
+
this.process()
|
410
|
+
}
|
475
411
|
|
476
|
-
|
412
|
+
ScrollSpy.prototype = {
|
413
|
+
|
414
|
+
constructor:ScrollSpy, refresh:function () {
|
415
|
+
var self = this
|
416
|
+
, $targets
|
417
|
+
|
418
|
+
this.offsets = $([])
|
419
|
+
this.targets = $([])
|
420
|
+
|
421
|
+
$targets = this.$body
|
422
|
+
.find(this.selector)
|
423
|
+
.map(function () {
|
424
|
+
var $el = $(this)
|
425
|
+
, href = $el.data('target') || $el.attr('href')
|
426
|
+
, $href = /^#\w/.test(href) && $(href)
|
427
|
+
return ( $href
|
428
|
+
&& href.length
|
429
|
+
&& [
|
430
|
+
[ $href.position().top, href ]
|
431
|
+
] ) || null
|
432
|
+
})
|
433
|
+
.sort(function (a, b) {
|
434
|
+
return a[0] - b[0]
|
435
|
+
})
|
436
|
+
.each(function () {
|
437
|
+
self.offsets.push(this[0])
|
438
|
+
self.targets.push(this[1])
|
439
|
+
})
|
440
|
+
}, process:function () {
|
441
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
442
|
+
, scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
443
|
+
, maxScroll = scrollHeight - this.$scrollElement.height()
|
444
|
+
, offsets = this.offsets
|
445
|
+
, targets = this.targets
|
446
|
+
, activeTarget = this.activeTarget
|
447
|
+
, i
|
448
|
+
|
449
|
+
if (scrollTop >= maxScroll) {
|
450
|
+
return activeTarget != (i = targets.last()[0])
|
451
|
+
&& this.activate(i)
|
452
|
+
}
|
477
453
|
|
478
|
-
|
479
|
-
|
480
|
-
|
454
|
+
for (i = offsets.length; i--;) {
|
455
|
+
activeTarget != targets[i]
|
456
|
+
&& scrollTop >= offsets[i]
|
457
|
+
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
458
|
+
&& this.activate(targets[i])
|
459
|
+
}
|
460
|
+
}, activate:function (target) {
|
461
|
+
var active
|
462
|
+
, selector
|
481
463
|
|
482
|
-
|
483
|
-
+ '[data-target="' + target + '"],'
|
484
|
-
+ this.selector + '[href="' + target + '"]'
|
464
|
+
this.activeTarget = target
|
485
465
|
|
486
|
-
|
487
|
-
|
488
|
-
|
466
|
+
$(this.selector)
|
467
|
+
.parent('.active')
|
468
|
+
.removeClass('active')
|
489
469
|
|
490
|
-
|
491
|
-
|
492
|
-
|
470
|
+
selector = this.selector
|
471
|
+
+ '[data-target="' + target + '"],'
|
472
|
+
+ this.selector + '[href="' + target + '"]'
|
493
473
|
|
494
|
-
|
495
|
-
|
474
|
+
active = $(selector)
|
475
|
+
.parent('li')
|
476
|
+
.addClass('active')
|
496
477
|
|
497
|
-
|
478
|
+
if (active.parent('.dropdown-menu')) {
|
479
|
+
active = active.closest('li.dropdown').addClass('active')
|
480
|
+
}
|
498
481
|
|
482
|
+
active.trigger('activate')
|
483
|
+
}
|
499
484
|
|
500
|
-
|
501
|
-
* =========================== */
|
485
|
+
}
|
502
486
|
|
503
|
-
$.fn.scrollspy = function ( option ) {
|
504
|
-
return this.each(function () {
|
505
|
-
var $this = $(this)
|
506
|
-
, data = $this.data('scrollspy')
|
507
|
-
, options = typeof option == 'object' && option
|
508
|
-
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
|
509
|
-
if (typeof option == 'string') data[option]()
|
510
|
-
})
|
511
|
-
}
|
512
487
|
|
513
|
-
|
488
|
+
/* SCROLLSPY PLUGIN DEFINITION
|
489
|
+
* =========================== */
|
490
|
+
|
491
|
+
$.fn.scrollspy = function (option) {
|
492
|
+
return this.each(function () {
|
493
|
+
var $this = $(this)
|
494
|
+
, data = $this.data('scrollspy')
|
495
|
+
, options = typeof option == 'object' && option
|
496
|
+
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
|
497
|
+
if (typeof option == 'string') data[option]()
|
498
|
+
})
|
499
|
+
}
|
500
|
+
|
501
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
514
502
|
|
515
|
-
|
516
|
-
|
517
|
-
|
503
|
+
$.fn.scrollspy.defaults = {
|
504
|
+
offset:10
|
505
|
+
}
|
518
506
|
|
519
507
|
|
520
|
-
|
521
|
-
|
508
|
+
/* SCROLLSPY DATA-API
|
509
|
+
* ================== */
|
522
510
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
511
|
+
$(function () {
|
512
|
+
$('[data-spy="scroll"]').each(function () {
|
513
|
+
var $spy = $(this)
|
514
|
+
$spy.scrollspy($spy.data())
|
515
|
+
})
|
527
516
|
})
|
528
|
-
})
|
529
517
|
|
530
518
|
}(window.jQuery);
|
531
519
|
/* ========================================================
|
@@ -550,117 +538,112 @@
|
|
550
538
|
|
551
539
|
!function ($) {
|
552
540
|
|
553
|
-
|
541
|
+
"use strict"; // jshint ;_;
|
554
542
|
|
555
543
|
|
556
|
-
|
557
|
-
|
544
|
+
/* TAB CLASS DEFINITION
|
545
|
+
* ==================== */
|
558
546
|
|
559
|
-
|
560
|
-
|
561
|
-
|
547
|
+
var Tab = function (element) {
|
548
|
+
this.element = $(element)
|
549
|
+
}
|
562
550
|
|
563
|
-
|
551
|
+
Tab.prototype = {
|
564
552
|
|
565
|
-
|
553
|
+
constructor:Tab, show:function () {
|
554
|
+
var $this = this.element
|
555
|
+
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
556
|
+
, selector = $this.attr('data-target')
|
557
|
+
, previous
|
558
|
+
, $target
|
559
|
+
, e
|
566
560
|
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
, previous
|
572
|
-
, $target
|
573
|
-
, e
|
561
|
+
if (!selector) {
|
562
|
+
selector = $this.attr('href')
|
563
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
564
|
+
}
|
574
565
|
|
575
|
-
|
576
|
-
selector = $this.attr('href')
|
577
|
-
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
578
|
-
}
|
566
|
+
if ($this.parent('li').hasClass('active')) return
|
579
567
|
|
580
|
-
|
568
|
+
previous = $ul.find('.active a').last()[0]
|
581
569
|
|
582
|
-
|
570
|
+
e = $.Event('show', {
|
571
|
+
relatedTarget:previous
|
572
|
+
})
|
583
573
|
|
584
|
-
|
585
|
-
relatedTarget: previous
|
586
|
-
})
|
574
|
+
$this.trigger(e)
|
587
575
|
|
588
|
-
|
576
|
+
if (e.isDefaultPrevented()) return
|
589
577
|
|
590
|
-
|
578
|
+
$target = $(selector)
|
591
579
|
|
592
|
-
|
580
|
+
this.activate($this.parent('li'), $ul)
|
581
|
+
this.activate($target, $target.parent(), function () {
|
582
|
+
$this.trigger({
|
583
|
+
type:'shown', relatedTarget:previous
|
584
|
+
})
|
585
|
+
})
|
586
|
+
}, activate:function (element, container, callback) {
|
587
|
+
var $active = container.find('> .active')
|
588
|
+
, transition = callback
|
589
|
+
&& $.support.transition
|
590
|
+
&& $active.hasClass('fade')
|
593
591
|
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
})
|
600
|
-
})
|
601
|
-
}
|
592
|
+
function next() {
|
593
|
+
$active
|
594
|
+
.removeClass('active')
|
595
|
+
.find('> .dropdown-menu > .active')
|
596
|
+
.removeClass('active')
|
602
597
|
|
603
|
-
|
604
|
-
var $active = container.find('> .active')
|
605
|
-
, transition = callback
|
606
|
-
&& $.support.transition
|
607
|
-
&& $active.hasClass('fade')
|
608
|
-
|
609
|
-
function next() {
|
610
|
-
$active
|
611
|
-
.removeClass('active')
|
612
|
-
.find('> .dropdown-menu > .active')
|
613
|
-
.removeClass('active')
|
614
|
-
|
615
|
-
element.addClass('active')
|
616
|
-
|
617
|
-
if (transition) {
|
618
|
-
element[0].offsetWidth // reflow for transition
|
619
|
-
element.addClass('in')
|
620
|
-
} else {
|
621
|
-
element.removeClass('fade')
|
622
|
-
}
|
598
|
+
element.addClass('active')
|
623
599
|
|
624
|
-
|
625
|
-
|
626
|
-
|
600
|
+
if (transition) {
|
601
|
+
element[0].offsetWidth // reflow for transition
|
602
|
+
element.addClass('in')
|
603
|
+
} else {
|
604
|
+
element.removeClass('fade')
|
605
|
+
}
|
606
|
+
|
607
|
+
if (element.parent('.dropdown-menu')) {
|
608
|
+
element.closest('li.dropdown').addClass('active')
|
609
|
+
}
|
627
610
|
|
628
|
-
|
629
|
-
|
611
|
+
callback && callback()
|
612
|
+
}
|
630
613
|
|
631
|
-
|
632
|
-
|
633
|
-
|
614
|
+
transition ?
|
615
|
+
$active.one($.support.transition.end, next) :
|
616
|
+
next()
|
634
617
|
|
635
|
-
|
618
|
+
$active.removeClass('in')
|
619
|
+
}
|
636
620
|
}
|
637
|
-
}
|
638
621
|
|
639
622
|
|
640
|
-
|
641
|
-
|
623
|
+
/* TAB PLUGIN DEFINITION
|
624
|
+
* ===================== */
|
642
625
|
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
626
|
+
$.fn.tab = function (option) {
|
627
|
+
return this.each(function () {
|
628
|
+
var $this = $(this)
|
629
|
+
, data = $this.data('tab')
|
630
|
+
if (!data) $this.data('tab', (data = new Tab(this)))
|
631
|
+
if (typeof option == 'string') data[option]()
|
632
|
+
})
|
633
|
+
}
|
651
634
|
|
652
|
-
|
635
|
+
$.fn.tab.Constructor = Tab
|
653
636
|
|
654
637
|
|
655
|
-
|
656
|
-
|
638
|
+
/* TAB DATA-API
|
639
|
+
* ============ */
|
657
640
|
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
641
|
+
$(function () {
|
642
|
+
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
643
|
+
e.preventDefault()
|
644
|
+
$(this).tab('show')
|
645
|
+
})
|
662
646
|
})
|
663
|
-
})
|
664
647
|
|
665
648
|
}(window.jQuery);
|
666
649
|
/* ===========================================================
|
@@ -686,257 +669,213 @@
|
|
686
669
|
|
687
670
|
!function ($) {
|
688
671
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
/* TOOLTIP PUBLIC CLASS DEFINITION
|
693
|
-
* =============================== */
|
694
|
-
|
695
|
-
var Tooltip = function (element, options) {
|
696
|
-
this.init('tooltip', element, options)
|
697
|
-
}
|
698
|
-
|
699
|
-
Tooltip.prototype = {
|
700
|
-
|
701
|
-
constructor: Tooltip
|
702
|
-
|
703
|
-
, init: function (type, element, options) {
|
704
|
-
var eventIn
|
705
|
-
, eventOut
|
706
|
-
|
707
|
-
this.type = type
|
708
|
-
this.$element = $(element)
|
709
|
-
this.options = this.getOptions(options)
|
710
|
-
this.enabled = true
|
711
|
-
|
712
|
-
if (this.options.trigger != 'manual') {
|
713
|
-
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
714
|
-
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
715
|
-
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
|
716
|
-
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
|
717
|
-
}
|
718
|
-
|
719
|
-
this.options.selector ?
|
720
|
-
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
721
|
-
this.fixTitle()
|
722
|
-
}
|
672
|
+
"use strict"; // jshint ;_;
|
723
673
|
|
724
|
-
, getOptions: function (options) {
|
725
|
-
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
726
674
|
|
727
|
-
|
728
|
-
|
729
|
-
show: options.delay
|
730
|
-
, hide: options.delay
|
731
|
-
}
|
732
|
-
}
|
675
|
+
/* TOOLTIP PUBLIC CLASS DEFINITION
|
676
|
+
* =============================== */
|
733
677
|
|
734
|
-
|
678
|
+
var Tooltip = function (element, options) {
|
679
|
+
this.init('tooltip', element, options)
|
735
680
|
}
|
736
681
|
|
737
|
-
|
738
|
-
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
682
|
+
Tooltip.prototype = {
|
739
683
|
|
740
|
-
|
684
|
+
constructor:Tooltip, init:function (type, element, options) {
|
685
|
+
var eventIn
|
686
|
+
, eventOut
|
741
687
|
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
}, self.options.delay.show)
|
747
|
-
}
|
688
|
+
this.type = type
|
689
|
+
this.$element = $(element)
|
690
|
+
this.options = this.getOptions(options)
|
691
|
+
this.enabled = true
|
748
692
|
|
749
|
-
|
750
|
-
|
693
|
+
if (this.options.trigger != 'manual') {
|
694
|
+
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
695
|
+
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
696
|
+
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
|
697
|
+
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
|
698
|
+
}
|
751
699
|
|
752
|
-
|
753
|
-
|
700
|
+
this.options.selector ?
|
701
|
+
(this._options = $.extend({}, this.options, { trigger:'manual', selector:'' })) :
|
702
|
+
this.fixTitle()
|
703
|
+
}, getOptions:function (options) {
|
704
|
+
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
754
705
|
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
706
|
+
if (options.delay && typeof options.delay == 'number') {
|
707
|
+
options.delay = {
|
708
|
+
show:options.delay, hide:options.delay
|
709
|
+
}
|
710
|
+
}
|
760
711
|
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
712
|
+
return options
|
713
|
+
}, enter:function (e) {
|
714
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
715
|
+
|
716
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
717
|
+
|
718
|
+
clearTimeout(this.timeout)
|
719
|
+
self.hoverState = 'in'
|
720
|
+
this.timeout = setTimeout(function () {
|
721
|
+
if (self.hoverState == 'in') self.show()
|
722
|
+
}, self.options.delay.show)
|
723
|
+
}, leave:function (e) {
|
724
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
725
|
+
|
726
|
+
if (this.timeout) clearTimeout(this.timeout)
|
727
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
728
|
+
|
729
|
+
self.hoverState = 'out'
|
730
|
+
this.timeout = setTimeout(function () {
|
731
|
+
if (self.hoverState == 'out') self.hide()
|
732
|
+
}, self.options.delay.hide)
|
733
|
+
}, show:function () {
|
734
|
+
var $tip
|
735
|
+
, inside
|
736
|
+
, pos
|
737
|
+
, actualWidth
|
738
|
+
, actualHeight
|
739
|
+
, placement
|
740
|
+
, tp
|
741
|
+
|
742
|
+
if (this.hasContent() && this.enabled) {
|
743
|
+
$tip = this.tip()
|
744
|
+
this.setContent()
|
745
|
+
|
746
|
+
if (this.options.animation) {
|
747
|
+
$tip.addClass('fade')
|
748
|
+
}
|
749
|
+
|
750
|
+
placement = typeof this.options.placement == 'function' ?
|
751
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
752
|
+
this.options.placement
|
753
|
+
|
754
|
+
inside = /in/.test(placement)
|
755
|
+
|
756
|
+
$tip
|
757
|
+
.remove()
|
758
|
+
.css({ top:0, left:0, display:'block' })
|
759
|
+
.appendTo(inside ? this.$element : document.body)
|
760
|
+
|
761
|
+
pos = this.getPosition(inside)
|
762
|
+
|
763
|
+
actualWidth = $tip[0].offsetWidth
|
764
|
+
actualHeight = $tip[0].offsetHeight
|
765
|
+
|
766
|
+
switch (inside ? placement.split(' ')[1] : placement) {
|
767
|
+
case 'bottom':
|
768
|
+
tp = {top:pos.top + pos.height, left:pos.left + pos.width / 2 - actualWidth / 2}
|
769
|
+
break
|
770
|
+
case 'top':
|
771
|
+
tp = {top:pos.top - actualHeight, left:pos.left + pos.width / 2 - actualWidth / 2}
|
772
|
+
break
|
773
|
+
case 'left':
|
774
|
+
tp = {top:pos.top + pos.height / 2 - actualHeight / 2, left:pos.left - actualWidth}
|
775
|
+
break
|
776
|
+
case 'right':
|
777
|
+
tp = {top:pos.top + pos.height / 2 - actualHeight / 2, left:pos.left + pos.width}
|
778
|
+
break
|
779
|
+
}
|
780
|
+
|
781
|
+
$tip
|
782
|
+
.css(tp)
|
783
|
+
.addClass(placement)
|
784
|
+
.addClass('in')
|
785
|
+
}
|
786
|
+
}, isHTML:function (text) {
|
787
|
+
// html string detection logic adapted from jQuery
|
788
|
+
return typeof text != 'string'
|
789
|
+
|| ( text.charAt(0) === "<"
|
790
|
+
&& text.charAt(text.length - 1) === ">"
|
791
|
+
&& text.length >= 3
|
792
|
+
) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
|
793
|
+
}, setContent:function () {
|
794
|
+
var $tip = this.tip()
|
795
|
+
, title = this.getTitle()
|
796
|
+
|
797
|
+
$tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
|
798
|
+
$tip.removeClass('fade in top bottom left right')
|
799
|
+
}, hide:function () {
|
800
|
+
var that = this
|
801
|
+
, $tip = this.tip()
|
802
|
+
|
803
|
+
$tip.removeClass('in')
|
804
|
+
|
805
|
+
function removeWithAnimation() {
|
806
|
+
var timeout = setTimeout(function () {
|
807
|
+
$tip.off($.support.transition.end).remove()
|
808
|
+
}, 500)
|
809
|
+
|
810
|
+
$tip.one($.support.transition.end, function () {
|
811
|
+
clearTimeout(timeout)
|
812
|
+
$tip.remove()
|
813
|
+
})
|
814
|
+
}
|
777
815
|
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
816
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
817
|
+
removeWithAnimation() :
|
818
|
+
$tip.remove()
|
819
|
+
}, fixTitle:function () {
|
820
|
+
var $e = this.$element
|
821
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
822
|
+
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
|
823
|
+
}
|
824
|
+
}, hasContent:function () {
|
825
|
+
return this.getTitle()
|
826
|
+
}, getPosition:function (inside) {
|
827
|
+
return $.extend({}, (inside ? {top:0, left:0} : this.$element.offset()), {
|
828
|
+
width:this.$element[0].offsetWidth, height:this.$element[0].offsetHeight
|
829
|
+
})
|
830
|
+
}, getTitle:function () {
|
831
|
+
var title
|
832
|
+
, $e = this.$element
|
833
|
+
, o = this.options
|
834
|
+
|
835
|
+
title = $e.attr('data-original-title')
|
836
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
837
|
+
|
838
|
+
return title
|
839
|
+
}, tip:function () {
|
840
|
+
return this.$tip = this.$tip || $(this.options.template)
|
841
|
+
}, validate:function () {
|
842
|
+
if (!this.$element[0].parentNode) {
|
843
|
+
this.hide()
|
844
|
+
this.$element = null
|
845
|
+
this.options = null
|
846
|
+
}
|
847
|
+
}, enable:function () {
|
848
|
+
this.enabled = true
|
849
|
+
}, disable:function () {
|
850
|
+
this.enabled = false
|
851
|
+
}, toggleEnabled:function () {
|
852
|
+
this.enabled = !this.enabled
|
853
|
+
}, toggle:function () {
|
854
|
+
this[this.tip().hasClass('in') ? 'hide' : 'show']()
|
807
855
|
}
|
808
856
|
|
809
|
-
$tip
|
810
|
-
.css(tp)
|
811
|
-
.addClass(placement)
|
812
|
-
.addClass('in')
|
813
|
-
}
|
814
|
-
}
|
815
|
-
|
816
|
-
, isHTML: function(text) {
|
817
|
-
// html string detection logic adapted from jQuery
|
818
|
-
return typeof text != 'string'
|
819
|
-
|| ( text.charAt(0) === "<"
|
820
|
-
&& text.charAt( text.length - 1 ) === ">"
|
821
|
-
&& text.length >= 3
|
822
|
-
) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
|
823
|
-
}
|
824
|
-
|
825
|
-
, setContent: function () {
|
826
|
-
var $tip = this.tip()
|
827
|
-
, title = this.getTitle()
|
828
|
-
|
829
|
-
$tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
|
830
|
-
$tip.removeClass('fade in top bottom left right')
|
831
857
|
}
|
832
858
|
|
833
|
-
, hide: function () {
|
834
|
-
var that = this
|
835
|
-
, $tip = this.tip()
|
836
|
-
|
837
|
-
$tip.removeClass('in')
|
838
859
|
|
839
|
-
|
840
|
-
|
841
|
-
$tip.off($.support.transition.end).remove()
|
842
|
-
}, 500)
|
860
|
+
/* TOOLTIP PLUGIN DEFINITION
|
861
|
+
* ========================= */
|
843
862
|
|
844
|
-
|
845
|
-
|
846
|
-
|
863
|
+
$.fn.tooltip = function (option) {
|
864
|
+
return this.each(function () {
|
865
|
+
var $this = $(this)
|
866
|
+
, data = $this.data('tooltip')
|
867
|
+
, options = typeof option == 'object' && option
|
868
|
+
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
869
|
+
if (typeof option == 'string') data[option]()
|
847
870
|
})
|
848
|
-
}
|
849
|
-
|
850
|
-
$.support.transition && this.$tip.hasClass('fade') ?
|
851
|
-
removeWithAnimation() :
|
852
|
-
$tip.remove()
|
853
871
|
}
|
854
872
|
|
855
|
-
|
856
|
-
var $e = this.$element
|
857
|
-
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
858
|
-
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
|
859
|
-
}
|
860
|
-
}
|
873
|
+
$.fn.tooltip.Constructor = Tooltip
|
861
874
|
|
862
|
-
|
863
|
-
|
875
|
+
$.fn.tooltip.defaults = {
|
876
|
+
animation:true, placement:'top', selector:false, template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger:'hover', title:'', delay:0
|
864
877
|
}
|
865
878
|
|
866
|
-
, getPosition: function (inside) {
|
867
|
-
return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
|
868
|
-
width: this.$element[0].offsetWidth
|
869
|
-
, height: this.$element[0].offsetHeight
|
870
|
-
})
|
871
|
-
}
|
872
|
-
|
873
|
-
, getTitle: function () {
|
874
|
-
var title
|
875
|
-
, $e = this.$element
|
876
|
-
, o = this.options
|
877
|
-
|
878
|
-
title = $e.attr('data-original-title')
|
879
|
-
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
880
|
-
|
881
|
-
return title
|
882
|
-
}
|
883
|
-
|
884
|
-
, tip: function () {
|
885
|
-
return this.$tip = this.$tip || $(this.options.template)
|
886
|
-
}
|
887
|
-
|
888
|
-
, validate: function () {
|
889
|
-
if (!this.$element[0].parentNode) {
|
890
|
-
this.hide()
|
891
|
-
this.$element = null
|
892
|
-
this.options = null
|
893
|
-
}
|
894
|
-
}
|
895
|
-
|
896
|
-
, enable: function () {
|
897
|
-
this.enabled = true
|
898
|
-
}
|
899
|
-
|
900
|
-
, disable: function () {
|
901
|
-
this.enabled = false
|
902
|
-
}
|
903
|
-
|
904
|
-
, toggleEnabled: function () {
|
905
|
-
this.enabled = !this.enabled
|
906
|
-
}
|
907
|
-
|
908
|
-
, toggle: function () {
|
909
|
-
this[this.tip().hasClass('in') ? 'hide' : 'show']()
|
910
|
-
}
|
911
|
-
|
912
|
-
}
|
913
|
-
|
914
|
-
|
915
|
-
/* TOOLTIP PLUGIN DEFINITION
|
916
|
-
* ========================= */
|
917
|
-
|
918
|
-
$.fn.tooltip = function ( option ) {
|
919
|
-
return this.each(function () {
|
920
|
-
var $this = $(this)
|
921
|
-
, data = $this.data('tooltip')
|
922
|
-
, options = typeof option == 'object' && option
|
923
|
-
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
924
|
-
if (typeof option == 'string') data[option]()
|
925
|
-
})
|
926
|
-
}
|
927
|
-
|
928
|
-
$.fn.tooltip.Constructor = Tooltip
|
929
|
-
|
930
|
-
$.fn.tooltip.defaults = {
|
931
|
-
animation: true
|
932
|
-
, placement: 'top'
|
933
|
-
, selector: false
|
934
|
-
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
935
|
-
, trigger: 'hover'
|
936
|
-
, title: ''
|
937
|
-
, delay: 0
|
938
|
-
}
|
939
|
-
|
940
879
|
}(window.jQuery);
|
941
880
|
|
942
881
|
/* ===========================================================
|
@@ -961,80 +900,70 @@
|
|
961
900
|
|
962
901
|
!function ($) {
|
963
902
|
|
964
|
-
|
903
|
+
"use strict"; // jshint ;_;
|
965
904
|
|
966
905
|
|
967
|
-
|
968
|
-
|
906
|
+
/* POPOVER PUBLIC CLASS DEFINITION
|
907
|
+
* =============================== */
|
969
908
|
|
970
|
-
|
971
|
-
|
972
|
-
|
909
|
+
var Popover = function (element, options) {
|
910
|
+
this.init('popover', element, options)
|
911
|
+
}
|
973
912
|
|
974
913
|
|
975
|
-
|
914
|
+
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
976
915
|
========================================== */
|
977
916
|
|
978
|
-
|
917
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
979
918
|
|
980
|
-
|
919
|
+
constructor:Popover, setContent:function () {
|
920
|
+
var $tip = this.tip()
|
921
|
+
, title = this.getTitle()
|
922
|
+
, content = this.getContent()
|
981
923
|
|
982
|
-
|
983
|
-
|
984
|
-
, title = this.getTitle()
|
985
|
-
, content = this.getContent()
|
924
|
+
$tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
|
925
|
+
$tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
|
986
926
|
|
987
|
-
|
988
|
-
|
927
|
+
$tip.removeClass('fade top bottom left right in')
|
928
|
+
}, hasContent:function () {
|
929
|
+
return this.getTitle() || this.getContent()
|
930
|
+
}, getContent:function () {
|
931
|
+
var content
|
932
|
+
, $e = this.$element
|
933
|
+
, o = this.options
|
989
934
|
|
990
|
-
|
991
|
-
|
935
|
+
content = $e.attr('data-content')
|
936
|
+
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
992
937
|
|
993
|
-
|
994
|
-
|
995
|
-
|
938
|
+
return content
|
939
|
+
}, tip:function () {
|
940
|
+
if (!this.$tip) {
|
941
|
+
this.$tip = $(this.options.template)
|
942
|
+
}
|
943
|
+
return this.$tip
|
944
|
+
}
|
996
945
|
|
997
|
-
|
998
|
-
var content
|
999
|
-
, $e = this.$element
|
1000
|
-
, o = this.options
|
946
|
+
})
|
1001
947
|
|
1002
|
-
content = $e.attr('data-content')
|
1003
|
-
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
1004
948
|
|
1005
|
-
|
1006
|
-
|
949
|
+
/* POPOVER PLUGIN DEFINITION
|
950
|
+
* ======================= */
|
1007
951
|
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
952
|
+
$.fn.popover = function (option) {
|
953
|
+
return this.each(function () {
|
954
|
+
var $this = $(this)
|
955
|
+
, data = $this.data('popover')
|
956
|
+
, options = typeof option == 'object' && option
|
957
|
+
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
958
|
+
if (typeof option == 'string') data[option]()
|
959
|
+
})
|
1013
960
|
}
|
1014
961
|
|
1015
|
-
|
962
|
+
$.fn.popover.Constructor = Popover
|
1016
963
|
|
1017
|
-
|
1018
|
-
|
1019
|
-
* ======================= */
|
1020
|
-
|
1021
|
-
$.fn.popover = function (option) {
|
1022
|
-
return this.each(function () {
|
1023
|
-
var $this = $(this)
|
1024
|
-
, data = $this.data('popover')
|
1025
|
-
, options = typeof option == 'object' && option
|
1026
|
-
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
1027
|
-
if (typeof option == 'string') data[option]()
|
964
|
+
$.fn.popover.defaults = $.extend({}, $.fn.tooltip.defaults, {
|
965
|
+
placement:'right', content:'', 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>'
|
1028
966
|
})
|
1029
|
-
}
|
1030
|
-
|
1031
|
-
$.fn.popover.Constructor = Popover
|
1032
|
-
|
1033
|
-
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
1034
|
-
placement: 'right'
|
1035
|
-
, content: ''
|
1036
|
-
, 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>'
|
1037
|
-
})
|
1038
967
|
|
1039
968
|
}(window.jQuery);
|
1040
969
|
/* ==========================================================
|
@@ -1059,72 +988,72 @@
|
|
1059
988
|
|
1060
989
|
!function ($) {
|
1061
990
|
|
1062
|
-
|
991
|
+
"use strict"; // jshint ;_;
|
1063
992
|
|
1064
993
|
|
1065
|
-
|
1066
|
-
|
994
|
+
/* ALERT CLASS DEFINITION
|
995
|
+
* ====================== */
|
1067
996
|
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
997
|
+
var dismiss = '[data-dismiss="alert"]'
|
998
|
+
, Alert = function (el) {
|
999
|
+
$(el).on('click', dismiss, this.close)
|
1000
|
+
}
|
1072
1001
|
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1002
|
+
Alert.prototype.close = function (e) {
|
1003
|
+
var $this = $(this)
|
1004
|
+
, selector = $this.attr('data-target')
|
1005
|
+
, $parent
|
1077
1006
|
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1007
|
+
if (!selector) {
|
1008
|
+
selector = $this.attr('href')
|
1009
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
1010
|
+
}
|
1082
1011
|
|
1083
|
-
|
1012
|
+
$parent = $(selector)
|
1084
1013
|
|
1085
|
-
|
1014
|
+
e && e.preventDefault()
|
1086
1015
|
|
1087
|
-
|
1016
|
+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
|
1088
1017
|
|
1089
|
-
|
1018
|
+
$parent.trigger(e = $.Event('close'))
|
1090
1019
|
|
1091
|
-
|
1020
|
+
if (e.isDefaultPrevented()) return
|
1092
1021
|
|
1093
|
-
|
1022
|
+
$parent.removeClass('in')
|
1094
1023
|
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1024
|
+
function removeElement() {
|
1025
|
+
$parent
|
1026
|
+
.trigger('closed')
|
1027
|
+
.remove()
|
1028
|
+
}
|
1100
1029
|
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1030
|
+
$.support.transition && $parent.hasClass('fade') ?
|
1031
|
+
$parent.on($.support.transition.end, removeElement) :
|
1032
|
+
removeElement()
|
1033
|
+
}
|
1105
1034
|
|
1106
1035
|
|
1107
|
-
|
1108
|
-
|
1036
|
+
/* ALERT PLUGIN DEFINITION
|
1037
|
+
* ======================= */
|
1109
1038
|
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1039
|
+
$.fn.alert = function (option) {
|
1040
|
+
return this.each(function () {
|
1041
|
+
var $this = $(this)
|
1042
|
+
, data = $this.data('alert')
|
1043
|
+
if (!data) $this.data('alert', (data = new Alert(this)))
|
1044
|
+
if (typeof option == 'string') data[option].call($this)
|
1045
|
+
})
|
1046
|
+
}
|
1118
1047
|
|
1119
|
-
|
1048
|
+
$.fn.alert.Constructor = Alert
|
1120
1049
|
|
1121
1050
|
|
1122
|
-
|
1123
|
-
|
1051
|
+
/* ALERT DATA-API
|
1052
|
+
* ============== */
|
1124
1053
|
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1054
|
+
$(function () {
|
1055
|
+
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
1056
|
+
})
|
1128
1057
|
|
1129
1058
|
}(window.jQuery);
|
1130
1059
|
/* ============================================================
|
@@ -1149,78 +1078,78 @@
|
|
1149
1078
|
|
1150
1079
|
!function ($) {
|
1151
1080
|
|
1152
|
-
|
1081
|
+
"use strict"; // jshint ;_;
|
1153
1082
|
|
1154
1083
|
|
1155
|
-
|
1156
|
-
|
1084
|
+
/* BUTTON PUBLIC CLASS DEFINITION
|
1085
|
+
* ============================== */
|
1157
1086
|
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1087
|
+
var Button = function (element, options) {
|
1088
|
+
this.$element = $(element)
|
1089
|
+
this.options = $.extend({}, $.fn.button.defaults, options)
|
1090
|
+
}
|
1162
1091
|
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1092
|
+
Button.prototype.setState = function (state) {
|
1093
|
+
var d = 'disabled'
|
1094
|
+
, $el = this.$element
|
1095
|
+
, data = $el.data()
|
1096
|
+
, val = $el.is('input') ? 'val' : 'html'
|
1168
1097
|
|
1169
|
-
|
1170
|
-
|
1098
|
+
state = state + 'Text'
|
1099
|
+
data.resetText || $el.data('resetText', $el[val]())
|
1171
1100
|
|
1172
|
-
|
1101
|
+
$el[val](data[state] || this.options[state])
|
1173
1102
|
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1103
|
+
// push to event loop to allow forms to submit
|
1104
|
+
setTimeout(function () {
|
1105
|
+
state == 'loadingText' ?
|
1106
|
+
$el.addClass(d).attr(d, d) :
|
1107
|
+
$el.removeClass(d).removeAttr(d)
|
1108
|
+
}, 0)
|
1109
|
+
}
|
1181
1110
|
|
1182
|
-
|
1183
|
-
|
1111
|
+
Button.prototype.toggle = function () {
|
1112
|
+
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
|
1184
1113
|
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1114
|
+
$parent && $parent
|
1115
|
+
.find('.active')
|
1116
|
+
.removeClass('active')
|
1188
1117
|
|
1189
|
-
|
1190
|
-
|
1118
|
+
this.$element.toggleClass('active')
|
1119
|
+
}
|
1191
1120
|
|
1192
1121
|
|
1193
|
-
|
1194
|
-
|
1122
|
+
/* BUTTON PLUGIN DEFINITION
|
1123
|
+
* ======================== */
|
1195
1124
|
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1125
|
+
$.fn.button = function (option) {
|
1126
|
+
return this.each(function () {
|
1127
|
+
var $this = $(this)
|
1128
|
+
, data = $this.data('button')
|
1129
|
+
, options = typeof option == 'object' && option
|
1130
|
+
if (!data) $this.data('button', (data = new Button(this, options)))
|
1131
|
+
if (option == 'toggle') data.toggle()
|
1132
|
+
else if (option) data.setState(option)
|
1133
|
+
})
|
1134
|
+
}
|
1206
1135
|
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1136
|
+
$.fn.button.defaults = {
|
1137
|
+
loadingText:'loading...'
|
1138
|
+
}
|
1210
1139
|
|
1211
|
-
|
1140
|
+
$.fn.button.Constructor = Button
|
1212
1141
|
|
1213
1142
|
|
1214
|
-
|
1215
|
-
|
1143
|
+
/* BUTTON DATA-API
|
1144
|
+
* =============== */
|
1216
1145
|
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1146
|
+
$(function () {
|
1147
|
+
$('body').on('click.button.data-api', '[data-toggle^=button]', function (e) {
|
1148
|
+
var $btn = $(e.target)
|
1149
|
+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
1150
|
+
$btn.button('toggle')
|
1151
|
+
})
|
1222
1152
|
})
|
1223
|
-
})
|
1224
1153
|
|
1225
1154
|
}(window.jQuery);
|
1226
1155
|
/* =============================================================
|
@@ -1245,139 +1174,127 @@
|
|
1245
1174
|
|
1246
1175
|
!function ($) {
|
1247
1176
|
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
/* COLLAPSE PUBLIC CLASS DEFINITION
|
1252
|
-
* ================================ */
|
1253
|
-
|
1254
|
-
var Collapse = function (element, options) {
|
1255
|
-
this.$element = $(element)
|
1256
|
-
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
1177
|
+
"use strict"; // jshint ;_;
|
1257
1178
|
|
1258
|
-
if (this.options.parent) {
|
1259
|
-
this.$parent = $(this.options.parent)
|
1260
|
-
}
|
1261
1179
|
|
1262
|
-
|
1263
|
-
|
1180
|
+
/* COLLAPSE PUBLIC CLASS DEFINITION
|
1181
|
+
* ================================ */
|
1264
1182
|
|
1265
|
-
|
1183
|
+
var Collapse = function (element, options) {
|
1184
|
+
this.$element = $(element)
|
1185
|
+
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
1266
1186
|
|
1267
|
-
|
1187
|
+
if (this.options.parent) {
|
1188
|
+
this.$parent = $(this.options.parent)
|
1189
|
+
}
|
1268
1190
|
|
1269
|
-
|
1270
|
-
var hasWidth = this.$element.hasClass('width')
|
1271
|
-
return hasWidth ? 'width' : 'height'
|
1191
|
+
this.options.toggle && this.toggle()
|
1272
1192
|
}
|
1273
1193
|
|
1274
|
-
|
1275
|
-
var dimension
|
1276
|
-
, scroll
|
1277
|
-
, actives
|
1278
|
-
, hasData
|
1194
|
+
Collapse.prototype = {
|
1279
1195
|
|
1280
|
-
|
1196
|
+
constructor:Collapse, dimension:function () {
|
1197
|
+
var hasWidth = this.$element.hasClass('width')
|
1198
|
+
return hasWidth ? 'width' : 'height'
|
1199
|
+
}, show:function () {
|
1200
|
+
var dimension
|
1201
|
+
, scroll
|
1202
|
+
, actives
|
1203
|
+
, hasData
|
1281
1204
|
|
1282
|
-
|
1283
|
-
scroll = $.camelCase(['scroll', dimension].join('-'))
|
1284
|
-
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
1205
|
+
if (this.transitioning) return
|
1285
1206
|
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
actives.collapse('hide')
|
1290
|
-
hasData || actives.data('collapse', null)
|
1291
|
-
}
|
1292
|
-
|
1293
|
-
this.$element[dimension](0)
|
1294
|
-
this.transition('addClass', $.Event('show'), 'shown')
|
1295
|
-
this.$element[dimension](this.$element[0][scroll])
|
1296
|
-
}
|
1207
|
+
dimension = this.dimension()
|
1208
|
+
scroll = $.camelCase(['scroll', dimension].join('-'))
|
1209
|
+
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
1297
1210
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
this.$element[dimension](0)
|
1305
|
-
}
|
1306
|
-
|
1307
|
-
, reset: function (size) {
|
1308
|
-
var dimension = this.dimension()
|
1309
|
-
|
1310
|
-
this.$element
|
1311
|
-
.removeClass('collapse')
|
1312
|
-
[dimension](size || 'auto')
|
1313
|
-
[0].offsetWidth
|
1211
|
+
if (actives && actives.length) {
|
1212
|
+
hasData = actives.data('collapse')
|
1213
|
+
if (hasData && hasData.transitioning) return
|
1214
|
+
actives.collapse('hide')
|
1215
|
+
hasData || actives.data('collapse', null)
|
1216
|
+
}
|
1314
1217
|
|
1315
|
-
|
1218
|
+
this.$element[dimension](0)
|
1219
|
+
this.transition('addClass', $.Event('show'), 'shown')
|
1220
|
+
this.$element[dimension](this.$element[0][scroll])
|
1221
|
+
}, hide:function () {
|
1222
|
+
var dimension
|
1223
|
+
if (this.transitioning) return
|
1224
|
+
dimension = this.dimension()
|
1225
|
+
this.reset(this.$element[dimension]())
|
1226
|
+
this.transition('removeClass', $.Event('hide'), 'hidden')
|
1227
|
+
this.$element[dimension](0)
|
1228
|
+
}, reset:function (size) {
|
1229
|
+
var dimension = this.dimension()
|
1230
|
+
|
1231
|
+
this.$element
|
1232
|
+
.removeClass('collapse')
|
1233
|
+
[dimension](size || 'auto')
|
1234
|
+
[0].offsetWidth
|
1235
|
+
|
1236
|
+
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
1237
|
+
|
1238
|
+
return this
|
1239
|
+
}, transition:function (method, startEvent, completeEvent) {
|
1240
|
+
var that = this
|
1241
|
+
, complete = function () {
|
1242
|
+
if (startEvent.type == 'show') that.reset()
|
1243
|
+
that.transitioning = 0
|
1244
|
+
that.$element.trigger(completeEvent)
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
this.$element.trigger(startEvent)
|
1248
|
+
|
1249
|
+
if (startEvent.isDefaultPrevented()) return
|
1250
|
+
|
1251
|
+
this.transitioning = 1
|
1252
|
+
|
1253
|
+
this.$element[method]('in')
|
1254
|
+
|
1255
|
+
$.support.transition && this.$element.hasClass('collapse') ?
|
1256
|
+
this.$element.one($.support.transition.end, complete) :
|
1257
|
+
complete()
|
1258
|
+
}, toggle:function () {
|
1259
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
1260
|
+
}
|
1316
1261
|
|
1317
|
-
return this
|
1318
1262
|
}
|
1319
1263
|
|
1320
|
-
, transition: function (method, startEvent, completeEvent) {
|
1321
|
-
var that = this
|
1322
|
-
, complete = function () {
|
1323
|
-
if (startEvent.type == 'show') that.reset()
|
1324
|
-
that.transitioning = 0
|
1325
|
-
that.$element.trigger(completeEvent)
|
1326
|
-
}
|
1327
|
-
|
1328
|
-
this.$element.trigger(startEvent)
|
1329
|
-
|
1330
|
-
if (startEvent.isDefaultPrevented()) return
|
1331
|
-
|
1332
|
-
this.transitioning = 1
|
1333
1264
|
|
1334
|
-
|
1265
|
+
/* COLLAPSIBLE PLUGIN DEFINITION
|
1266
|
+
* ============================== */
|
1335
1267
|
|
1336
|
-
|
1337
|
-
this
|
1338
|
-
|
1268
|
+
$.fn.collapse = function (option) {
|
1269
|
+
return this.each(function () {
|
1270
|
+
var $this = $(this)
|
1271
|
+
, data = $this.data('collapse')
|
1272
|
+
, options = typeof option == 'object' && option
|
1273
|
+
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
1274
|
+
if (typeof option == 'string') data[option]()
|
1275
|
+
})
|
1339
1276
|
}
|
1340
1277
|
|
1341
|
-
|
1342
|
-
|
1278
|
+
$.fn.collapse.defaults = {
|
1279
|
+
toggle:true
|
1343
1280
|
}
|
1344
1281
|
|
1345
|
-
|
1346
|
-
|
1282
|
+
$.fn.collapse.Constructor = Collapse
|
1347
1283
|
|
1348
|
-
/* COLLAPSIBLE PLUGIN DEFINITION
|
1349
|
-
* ============================== */
|
1350
|
-
|
1351
|
-
$.fn.collapse = function (option) {
|
1352
|
-
return this.each(function () {
|
1353
|
-
var $this = $(this)
|
1354
|
-
, data = $this.data('collapse')
|
1355
|
-
, options = typeof option == 'object' && option
|
1356
|
-
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
1357
|
-
if (typeof option == 'string') data[option]()
|
1358
|
-
})
|
1359
|
-
}
|
1360
1284
|
|
1361
|
-
|
1362
|
-
|
1363
|
-
}
|
1285
|
+
/* COLLAPSIBLE DATA-API
|
1286
|
+
* ==================== */
|
1364
1287
|
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
, target = $this.attr('data-target')
|
1375
|
-
|| e.preventDefault()
|
1376
|
-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
1377
|
-
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
1378
|
-
$(target).collapse(option)
|
1288
|
+
$(function () {
|
1289
|
+
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
1290
|
+
var $this = $(this), href
|
1291
|
+
, target = $this.attr('data-target')
|
1292
|
+
|| e.preventDefault()
|
1293
|
+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
1294
|
+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
1295
|
+
$(target).collapse(option)
|
1296
|
+
})
|
1379
1297
|
})
|
1380
|
-
})
|
1381
1298
|
|
1382
1299
|
}(window.jQuery);
|
1383
1300
|
/* ==========================================================
|
@@ -1402,151 +1319,142 @@
|
|
1402
1319
|
|
1403
1320
|
!function ($) {
|
1404
1321
|
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
/* CAROUSEL CLASS DEFINITION
|
1409
|
-
* ========================= */
|
1322
|
+
"use strict"; // jshint ;_;
|
1410
1323
|
|
1411
|
-
var Carousel = function (element, options) {
|
1412
|
-
this.$element = $(element)
|
1413
|
-
this.options = options
|
1414
|
-
this.options.slide && this.slide(this.options.slide)
|
1415
|
-
this.options.pause == 'hover' && this.$element
|
1416
|
-
.on('mouseenter', $.proxy(this.pause, this))
|
1417
|
-
.on('mouseleave', $.proxy(this.cycle, this))
|
1418
|
-
}
|
1419
1324
|
|
1420
|
-
|
1325
|
+
/* CAROUSEL CLASS DEFINITION
|
1326
|
+
* ========================= */
|
1421
1327
|
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
&&
|
1426
|
-
|
1427
|
-
|
1328
|
+
var Carousel = function (element, options) {
|
1329
|
+
this.$element = $(element)
|
1330
|
+
this.options = options
|
1331
|
+
this.options.slide && this.slide(this.options.slide)
|
1332
|
+
this.options.pause == 'hover' && this.$element
|
1333
|
+
.on('mouseenter', $.proxy(this.pause, this))
|
1334
|
+
.on('mouseleave', $.proxy(this.cycle, this))
|
1428
1335
|
}
|
1429
1336
|
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1337
|
+
Carousel.prototype = {
|
1338
|
+
|
1339
|
+
cycle:function (e) {
|
1340
|
+
if (!e) this.paused = false
|
1341
|
+
this.options.interval
|
1342
|
+
&& !this.paused
|
1343
|
+
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
|
1344
|
+
return this
|
1345
|
+
}, to:function (pos) {
|
1346
|
+
var $active = this.$element.find('.active')
|
1347
|
+
, children = $active.parent().children()
|
1348
|
+
, activePos = children.index($active)
|
1349
|
+
, that = this
|
1350
|
+
|
1351
|
+
if (pos > (children.length - 1) || pos < 0) return
|
1352
|
+
|
1353
|
+
if (this.sliding) {
|
1354
|
+
return this.$element.one('slid', function () {
|
1355
|
+
that.to(pos)
|
1356
|
+
})
|
1357
|
+
}
|
1443
1358
|
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1359
|
+
if (activePos == pos) {
|
1360
|
+
return this.pause().cycle()
|
1361
|
+
}
|
1447
1362
|
|
1448
|
-
|
1449
|
-
|
1363
|
+
return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
|
1364
|
+
}, pause:function (e) {
|
1365
|
+
if (!e) this.paused = true
|
1366
|
+
clearInterval(this.interval)
|
1367
|
+
this.interval = null
|
1368
|
+
return this
|
1369
|
+
}, next:function () {
|
1370
|
+
if (this.sliding) return
|
1371
|
+
return this.slide('next')
|
1372
|
+
}, prev:function () {
|
1373
|
+
if (this.sliding) return
|
1374
|
+
return this.slide('prev')
|
1375
|
+
}, slide:function (type, next) {
|
1376
|
+
var $active = this.$element.find('.active')
|
1377
|
+
, $next = next || $active[type]()
|
1378
|
+
, isCycling = this.interval
|
1379
|
+
, direction = type == 'next' ? 'left' : 'right'
|
1380
|
+
, fallback = type == 'next' ? 'first' : 'last'
|
1381
|
+
, that = this
|
1382
|
+
, e = $.Event('slide')
|
1383
|
+
|
1384
|
+
this.sliding = true
|
1385
|
+
|
1386
|
+
isCycling && this.pause()
|
1387
|
+
|
1388
|
+
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
|
1389
|
+
|
1390
|
+
if ($next.hasClass('active')) return
|
1391
|
+
|
1392
|
+
if ($.support.transition && this.$element.hasClass('slide')) {
|
1393
|
+
this.$element.trigger(e)
|
1394
|
+
if (e.isDefaultPrevented()) return
|
1395
|
+
$next.addClass(type)
|
1396
|
+
$next[0].offsetWidth // force reflow
|
1397
|
+
$active.addClass(direction)
|
1398
|
+
$next.addClass(direction)
|
1399
|
+
this.$element.one($.support.transition.end, function () {
|
1400
|
+
$next.removeClass([type, direction].join(' ')).addClass('active')
|
1401
|
+
$active.removeClass(['active', direction].join(' '))
|
1402
|
+
that.sliding = false
|
1403
|
+
setTimeout(function () {
|
1404
|
+
that.$element.trigger('slid')
|
1405
|
+
}, 0)
|
1406
|
+
})
|
1407
|
+
} else {
|
1408
|
+
this.$element.trigger(e)
|
1409
|
+
if (e.isDefaultPrevented()) return
|
1410
|
+
$active.removeClass('active')
|
1411
|
+
$next.addClass('active')
|
1412
|
+
this.sliding = false
|
1413
|
+
this.$element.trigger('slid')
|
1414
|
+
}
|
1450
1415
|
|
1451
|
-
|
1452
|
-
if (!e) this.paused = true
|
1453
|
-
clearInterval(this.interval)
|
1454
|
-
this.interval = null
|
1455
|
-
return this
|
1456
|
-
}
|
1416
|
+
isCycling && this.cycle()
|
1457
1417
|
|
1458
|
-
|
1459
|
-
|
1460
|
-
return this.slide('next')
|
1461
|
-
}
|
1418
|
+
return this
|
1419
|
+
}
|
1462
1420
|
|
1463
|
-
, prev: function () {
|
1464
|
-
if (this.sliding) return
|
1465
|
-
return this.slide('prev')
|
1466
1421
|
}
|
1467
1422
|
|
1468
|
-
, slide: function (type, next) {
|
1469
|
-
var $active = this.$element.find('.active')
|
1470
|
-
, $next = next || $active[type]()
|
1471
|
-
, isCycling = this.interval
|
1472
|
-
, direction = type == 'next' ? 'left' : 'right'
|
1473
|
-
, fallback = type == 'next' ? 'first' : 'last'
|
1474
|
-
, that = this
|
1475
|
-
, e = $.Event('slide')
|
1476
|
-
|
1477
|
-
this.sliding = true
|
1478
|
-
|
1479
|
-
isCycling && this.pause()
|
1480
1423
|
|
1481
|
-
|
1424
|
+
/* CAROUSEL PLUGIN DEFINITION
|
1425
|
+
* ========================== */
|
1482
1426
|
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
this.$element.one($.support.transition.end, function () {
|
1493
|
-
$next.removeClass([type, direction].join(' ')).addClass('active')
|
1494
|
-
$active.removeClass(['active', direction].join(' '))
|
1495
|
-
that.sliding = false
|
1496
|
-
setTimeout(function () { that.$element.trigger('slid') }, 0)
|
1427
|
+
$.fn.carousel = function (option) {
|
1428
|
+
return this.each(function () {
|
1429
|
+
var $this = $(this)
|
1430
|
+
, data = $this.data('carousel')
|
1431
|
+
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
|
1432
|
+
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
|
1433
|
+
if (typeof option == 'number') data.to(option)
|
1434
|
+
else if (typeof option == 'string' || (option = options.slide)) data[option]()
|
1435
|
+
else if (options.interval) data.cycle()
|
1497
1436
|
})
|
1498
|
-
} else {
|
1499
|
-
this.$element.trigger(e)
|
1500
|
-
if (e.isDefaultPrevented()) return
|
1501
|
-
$active.removeClass('active')
|
1502
|
-
$next.addClass('active')
|
1503
|
-
this.sliding = false
|
1504
|
-
this.$element.trigger('slid')
|
1505
|
-
}
|
1506
|
-
|
1507
|
-
isCycling && this.cycle()
|
1508
|
-
|
1509
|
-
return this
|
1510
1437
|
}
|
1511
1438
|
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
/* CAROUSEL PLUGIN DEFINITION
|
1516
|
-
* ========================== */
|
1517
|
-
|
1518
|
-
$.fn.carousel = function (option) {
|
1519
|
-
return this.each(function () {
|
1520
|
-
var $this = $(this)
|
1521
|
-
, data = $this.data('carousel')
|
1522
|
-
, options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
|
1523
|
-
if (!data) $this.data('carousel', (data = new Carousel(this, options)))
|
1524
|
-
if (typeof option == 'number') data.to(option)
|
1525
|
-
else if (typeof option == 'string' || (option = options.slide)) data[option]()
|
1526
|
-
else if (options.interval) data.cycle()
|
1527
|
-
})
|
1528
|
-
}
|
1529
|
-
|
1530
|
-
$.fn.carousel.defaults = {
|
1531
|
-
interval: 5000
|
1532
|
-
, pause: 'hover'
|
1533
|
-
}
|
1439
|
+
$.fn.carousel.defaults = {
|
1440
|
+
interval:5000, pause:'hover'
|
1441
|
+
}
|
1534
1442
|
|
1535
|
-
|
1443
|
+
$.fn.carousel.Constructor = Carousel
|
1536
1444
|
|
1537
1445
|
|
1538
|
-
|
1539
|
-
|
1446
|
+
/* CAROUSEL DATA-API
|
1447
|
+
* ================= */
|
1540
1448
|
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1449
|
+
$(function () {
|
1450
|
+
$('body').on('click.carousel.data-api', '[data-slide]', function (e) {
|
1451
|
+
var $this = $(this), href
|
1452
|
+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
1453
|
+
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
1454
|
+
$target.carousel(options)
|
1455
|
+
e.preventDefault()
|
1456
|
+
})
|
1548
1457
|
})
|
1549
|
-
})
|
1550
1458
|
|
1551
1459
|
}(window.jQuery);
|
1552
1460
|
/* =============================================================
|
@@ -1569,268 +1477,262 @@
|
|
1569
1477
|
* ============================================================ */
|
1570
1478
|
|
1571
1479
|
|
1572
|
-
!function($){
|
1573
|
-
|
1574
|
-
"use strict"; // jshint ;_;
|
1575
|
-
|
1576
|
-
|
1577
|
-
/* TYPEAHEAD PUBLIC CLASS DEFINITION
|
1578
|
-
* ================================= */
|
1579
|
-
|
1580
|
-
var Typeahead = function (element, options) {
|
1581
|
-
this.$element = $(element)
|
1582
|
-
this.options = $.extend({}, $.fn.typeahead.defaults, options)
|
1583
|
-
this.matcher = this.options.matcher || this.matcher
|
1584
|
-
this.sorter = this.options.sorter || this.sorter
|
1585
|
-
this.highlighter = this.options.highlighter || this.highlighter
|
1586
|
-
this.updater = this.options.updater || this.updater
|
1587
|
-
this.$menu = $(this.options.menu).appendTo('body')
|
1588
|
-
this.source = this.options.source
|
1589
|
-
this.shown = false
|
1590
|
-
this.listen()
|
1591
|
-
}
|
1592
|
-
|
1593
|
-
Typeahead.prototype = {
|
1594
|
-
|
1595
|
-
constructor: Typeahead
|
1596
|
-
|
1597
|
-
, select: function () {
|
1598
|
-
var val = this.$menu.find('.active').attr('data-value')
|
1599
|
-
this.$element
|
1600
|
-
.val(this.updater(val))
|
1601
|
-
.change()
|
1602
|
-
return this.hide()
|
1603
|
-
}
|
1604
|
-
|
1605
|
-
, updater: function (item) {
|
1606
|
-
return item
|
1607
|
-
}
|
1608
|
-
|
1609
|
-
, show: function () {
|
1610
|
-
var pos = $.extend({}, this.$element.offset(), {
|
1611
|
-
height: this.$element[0].offsetHeight
|
1612
|
-
})
|
1613
|
-
|
1614
|
-
this.$menu.css({
|
1615
|
-
top: pos.top + pos.height
|
1616
|
-
, left: pos.left
|
1617
|
-
})
|
1618
|
-
|
1619
|
-
this.$menu.show()
|
1620
|
-
this.shown = true
|
1621
|
-
return this
|
1622
|
-
}
|
1623
|
-
|
1624
|
-
, hide: function () {
|
1625
|
-
this.$menu.hide()
|
1626
|
-
this.shown = false
|
1627
|
-
return this
|
1628
|
-
}
|
1629
|
-
|
1630
|
-
, lookup: function (event) {
|
1631
|
-
var that = this
|
1632
|
-
, items
|
1633
|
-
, q
|
1634
|
-
|
1635
|
-
this.query = this.$element.val()
|
1636
|
-
|
1637
|
-
if (!this.query) {
|
1638
|
-
return this.shown ? this.hide() : this
|
1639
|
-
}
|
1640
|
-
|
1641
|
-
items = $.grep(this.source, function (item) {
|
1642
|
-
return that.matcher(item)
|
1643
|
-
})
|
1644
|
-
|
1645
|
-
items = this.sorter(items)
|
1646
|
-
|
1647
|
-
if (!items.length) {
|
1648
|
-
return this.shown ? this.hide() : this
|
1649
|
-
}
|
1480
|
+
!function ($) {
|
1650
1481
|
|
1651
|
-
|
1482
|
+
"use strict"
|
1483
|
+
|
1484
|
+
var Typeahead = function (element, options) {
|
1485
|
+
this.$element = $(element)
|
1486
|
+
this.options = $.extend({}, $.fn.typeahead.defaults, options)
|
1487
|
+
this.assigner = this.options.assigner || this.assigner
|
1488
|
+
this.matcher = this.options.matcher || this.matcher
|
1489
|
+
this.sorter = this.options.sorter || this.sorter
|
1490
|
+
this.highlighter = this.options.highlighter || this.highlighter
|
1491
|
+
this.$menu = $(this.options.menu).appendTo('body')
|
1492
|
+
this.source = this.options.source
|
1493
|
+
this.onselect = this.options.onselect
|
1494
|
+
this.strings = true
|
1495
|
+
this.shown = false
|
1496
|
+
this.listen()
|
1652
1497
|
}
|
1653
1498
|
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1499
|
+
Typeahead.prototype = {
|
1500
|
+
|
1501
|
+
constructor:Typeahead, select:function () {
|
1502
|
+
var val = JSON.parse(this.$menu.find('.active').attr('data-value'))
|
1503
|
+
, text
|
1504
|
+
|
1505
|
+
if (!this.strings) text = val[this.options.property]
|
1506
|
+
else text = val
|
1507
|
+
|
1508
|
+
this.assigner(text, val)
|
1509
|
+
|
1510
|
+
if (typeof this.onselect == "function")
|
1511
|
+
this.onselect(val)
|
1512
|
+
|
1513
|
+
return this.hide()
|
1514
|
+
}, assigner:function (text) {
|
1515
|
+
this.$element.val(text)
|
1516
|
+
}, show:function () {
|
1517
|
+
var pos = $.extend({}, this.$element.offset(), {
|
1518
|
+
height:this.$element[0].offsetHeight
|
1519
|
+
})
|
1520
|
+
|
1521
|
+
this.$menu.css({
|
1522
|
+
top:pos.top + pos.height, left:pos.left
|
1523
|
+
})
|
1524
|
+
|
1525
|
+
this.$menu.show()
|
1526
|
+
this.shown = true
|
1527
|
+
return this
|
1528
|
+
}, hide:function () {
|
1529
|
+
this.$menu.hide()
|
1530
|
+
this.shown = false
|
1531
|
+
return this
|
1532
|
+
}, lookup:function (event) {
|
1533
|
+
var that = this
|
1534
|
+
, items
|
1535
|
+
, q
|
1536
|
+
, value
|
1537
|
+
|
1538
|
+
this.query = this.$element.val()
|
1539
|
+
|
1540
|
+
if (typeof this.source == "function") {
|
1541
|
+
value = this.source(this, this.query, event)
|
1542
|
+
if (value) this.process(value)
|
1543
|
+
} else {
|
1544
|
+
this.process(this.source)
|
1545
|
+
}
|
1546
|
+
}, process:function (results) {
|
1547
|
+
var that = this
|
1548
|
+
, items
|
1549
|
+
, q
|
1657
1550
|
|
1658
|
-
|
1659
|
-
|
1660
|
-
, caseSensitive = []
|
1661
|
-
, caseInsensitive = []
|
1662
|
-
, item
|
1551
|
+
if (results.length && typeof results[0] != "string")
|
1552
|
+
this.strings = false
|
1663
1553
|
|
1664
|
-
|
1665
|
-
if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
|
1666
|
-
else if (~item.indexOf(this.query)) caseSensitive.push(item)
|
1667
|
-
else caseInsensitive.push(item)
|
1668
|
-
}
|
1554
|
+
this.query = this.$element.val()
|
1669
1555
|
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
, highlighter: function (item) {
|
1674
|
-
var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
|
1675
|
-
return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
|
1676
|
-
return '<strong>' + match + '</strong>'
|
1677
|
-
})
|
1678
|
-
}
|
1556
|
+
if (!this.query) {
|
1557
|
+
return this.shown ? this.hide() : this
|
1558
|
+
}
|
1679
1559
|
|
1680
|
-
|
1681
|
-
|
1560
|
+
items = $.grep(results, function (item) {
|
1561
|
+
if (!that.strings)
|
1562
|
+
item = item[that.options.property]
|
1563
|
+
if (that.matcher(item)) return item
|
1564
|
+
})
|
1682
1565
|
|
1683
|
-
|
1684
|
-
i = $(that.options.item).attr('data-value', item)
|
1685
|
-
i.find('a').html(that.highlighter(item))
|
1686
|
-
return i[0]
|
1687
|
-
})
|
1566
|
+
items = this.sorter(items)
|
1688
1567
|
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
}
|
1568
|
+
if (!items.length) {
|
1569
|
+
return this.shown ? this.hide() : this
|
1570
|
+
}
|
1693
1571
|
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1572
|
+
return this.render(items.slice(0, this.options.items)).show()
|
1573
|
+
}, matcher:function (item) {
|
1574
|
+
return ~item.toLowerCase().indexOf(this.query.toLowerCase())
|
1575
|
+
}, sorter:function (items) {
|
1576
|
+
var beginswith = []
|
1577
|
+
, caseSensitive = []
|
1578
|
+
, caseInsensitive = []
|
1579
|
+
, item
|
1580
|
+
, sortby
|
1581
|
+
|
1582
|
+
while (item = items.shift()) {
|
1583
|
+
if (this.strings) sortby = item
|
1584
|
+
else sortby = item[this.options.property]
|
1585
|
+
|
1586
|
+
if (!sortby.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
|
1587
|
+
else if (~sortby.indexOf(this.query)) caseSensitive.push(item)
|
1588
|
+
else caseInsensitive.push(item)
|
1589
|
+
}
|
1697
1590
|
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1591
|
+
return beginswith.concat(caseSensitive, caseInsensitive)
|
1592
|
+
}, highlighter:function (item) {
|
1593
|
+
return item.replace(('(' + this.query + ')').toRegExp('ig'), function ($1, match) {
|
1594
|
+
return '<strong>' + match + '</strong>'
|
1595
|
+
})
|
1596
|
+
}, render:function (items) {
|
1597
|
+
var that = this
|
1598
|
+
|
1599
|
+
items = $(items).map(function (i, item) {
|
1600
|
+
i = $(that.options.item).attr('data-value', JSON.stringify(item))
|
1601
|
+
if (!that.strings)
|
1602
|
+
item = item[that.options.property]
|
1603
|
+
i.find('a').html(that.highlighter(item))
|
1604
|
+
return i[0]
|
1605
|
+
})
|
1606
|
+
|
1607
|
+
items.first().addClass('active')
|
1608
|
+
this.$menu.html(items)
|
1609
|
+
return this
|
1610
|
+
}, next:function (event) {
|
1611
|
+
var active = this.$menu.find('.active').removeClass('active')
|
1612
|
+
, next = active.next()
|
1613
|
+
|
1614
|
+
if (!next.length) {
|
1615
|
+
next = $(this.$menu.find('li')[0])
|
1616
|
+
}
|
1701
1617
|
|
1702
|
-
|
1703
|
-
|
1618
|
+
next.addClass('active')
|
1619
|
+
}, prev:function (event) {
|
1620
|
+
var active = this.$menu.find('.active').removeClass('active')
|
1621
|
+
, prev = active.prev()
|
1704
1622
|
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1623
|
+
if (!prev.length) {
|
1624
|
+
prev = this.$menu.find('li').last()
|
1625
|
+
}
|
1708
1626
|
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1627
|
+
prev.addClass('active')
|
1628
|
+
}, listen:function () {
|
1629
|
+
this.$element
|
1630
|
+
.on('blur', $.proxy(this.blur, this))
|
1631
|
+
.on('keypress', $.proxy(this.keypress, this))
|
1632
|
+
.on('keyup', $.proxy(this.keyup, this))
|
1712
1633
|
|
1713
|
-
|
1714
|
-
|
1634
|
+
if ($.browser.webkit || $.browser.msie) {
|
1635
|
+
this.$element.on('keydown', $.proxy(this.keypress, this))
|
1636
|
+
}
|
1715
1637
|
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1638
|
+
this.$menu
|
1639
|
+
.on('click', $.proxy(this.click, this))
|
1640
|
+
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
|
1641
|
+
}, keyup:function (e) {
|
1642
|
+
e.stopPropagation()
|
1643
|
+
e.preventDefault()
|
1644
|
+
|
1645
|
+
switch (e.keyCode) {
|
1646
|
+
case 40: // down arrow
|
1647
|
+
case 38: // up arrow
|
1648
|
+
break
|
1649
|
+
|
1650
|
+
case 9: // tab
|
1651
|
+
case 13: // enter
|
1652
|
+
if (!this.shown) return
|
1653
|
+
this.select()
|
1654
|
+
break
|
1655
|
+
|
1656
|
+
case 27: // escape
|
1657
|
+
this.hide()
|
1658
|
+
break
|
1659
|
+
|
1660
|
+
default:
|
1661
|
+
this.lookup(e)
|
1662
|
+
}
|
1721
1663
|
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1664
|
+
}, keypress:function (e) {
|
1665
|
+
e.stopPropagation()
|
1666
|
+
if (!this.shown) return
|
1667
|
+
|
1668
|
+
switch (e.keyCode) {
|
1669
|
+
case 9: // tab
|
1670
|
+
case 13: // enter
|
1671
|
+
case 27: // escape
|
1672
|
+
e.preventDefault()
|
1673
|
+
break
|
1674
|
+
|
1675
|
+
case 38: // up arrow
|
1676
|
+
e.preventDefault()
|
1677
|
+
this.prev()
|
1678
|
+
break
|
1679
|
+
|
1680
|
+
case 40: // down arrow
|
1681
|
+
e.preventDefault()
|
1682
|
+
this.next()
|
1683
|
+
break
|
1684
|
+
}
|
1685
|
+
}, blur:function (e) {
|
1686
|
+
var that = this
|
1687
|
+
e.stopPropagation()
|
1688
|
+
e.preventDefault()
|
1689
|
+
setTimeout(function () {
|
1690
|
+
that.hide()
|
1691
|
+
}, 150)
|
1692
|
+
}, click:function (e) {
|
1693
|
+
e.stopPropagation()
|
1694
|
+
e.preventDefault()
|
1695
|
+
this.select()
|
1696
|
+
}, mouseenter:function (e) {
|
1697
|
+
this.$menu.find('.active').removeClass('active')
|
1698
|
+
$(e.currentTarget).addClass('active')
|
1699
|
+
}
|
1725
1700
|
|
1726
|
-
this.$menu
|
1727
|
-
.on('click', $.proxy(this.click, this))
|
1728
|
-
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
|
1729
1701
|
}
|
1730
1702
|
|
1731
|
-
, keyup: function (e) {
|
1732
|
-
switch(e.keyCode) {
|
1733
|
-
case 40: // down arrow
|
1734
|
-
case 38: // up arrow
|
1735
|
-
break
|
1736
|
-
|
1737
|
-
case 9: // tab
|
1738
|
-
case 13: // enter
|
1739
|
-
if (!this.shown) return
|
1740
|
-
this.select()
|
1741
|
-
break
|
1742
|
-
|
1743
|
-
case 27: // escape
|
1744
|
-
if (!this.shown) return
|
1745
|
-
this.hide()
|
1746
|
-
break
|
1747
|
-
|
1748
|
-
default:
|
1749
|
-
this.lookup()
|
1750
|
-
}
|
1751
|
-
|
1752
|
-
e.stopPropagation()
|
1753
|
-
e.preventDefault()
|
1754
|
-
}
|
1755
|
-
|
1756
|
-
, keypress: function (e) {
|
1757
|
-
if (!this.shown) return
|
1758
|
-
|
1759
|
-
switch(e.keyCode) {
|
1760
|
-
case 9: // tab
|
1761
|
-
case 13: // enter
|
1762
|
-
case 27: // escape
|
1763
|
-
e.preventDefault()
|
1764
|
-
break
|
1765
|
-
|
1766
|
-
case 38: // up arrow
|
1767
|
-
if (e.type != 'keydown') break
|
1768
|
-
e.preventDefault()
|
1769
|
-
this.prev()
|
1770
|
-
break
|
1771
|
-
|
1772
|
-
case 40: // down arrow
|
1773
|
-
if (e.type != 'keydown') break
|
1774
|
-
e.preventDefault()
|
1775
|
-
this.next()
|
1776
|
-
break
|
1777
|
-
}
|
1778
|
-
|
1779
|
-
e.stopPropagation()
|
1780
|
-
}
|
1781
1703
|
|
1782
|
-
|
1783
|
-
|
1784
|
-
setTimeout(function () { that.hide() }, 150)
|
1785
|
-
}
|
1704
|
+
/* TYPEAHEAD PLUGIN DEFINITION
|
1705
|
+
* =========================== */
|
1786
1706
|
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1707
|
+
$.fn.typeahead = function (option) {
|
1708
|
+
return this.each(function () {
|
1709
|
+
var $this = $(this)
|
1710
|
+
, data = $this.data('typeahead')
|
1711
|
+
, options = typeof option == 'object' && option
|
1712
|
+
if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
|
1713
|
+
if (typeof option == 'string') data[option]()
|
1714
|
+
//FIX: hide browser default autocomplete
|
1715
|
+
$this.attr('autocomplete', 'off')
|
1716
|
+
})
|
1791
1717
|
}
|
1792
1718
|
|
1793
|
-
|
1794
|
-
|
1795
|
-
$(e.currentTarget).addClass('active')
|
1719
|
+
$.fn.typeahead.defaults = {
|
1720
|
+
source:[], items:8, menu:'<ul class="typeahead dropdown-menu"></ul>', item:'<li><a href="#"></a></li>', onselect:null, property:'value'
|
1796
1721
|
}
|
1797
1722
|
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
/* TYPEAHEAD PLUGIN DEFINITION
|
1802
|
-
* =========================== */
|
1803
|
-
|
1804
|
-
$.fn.typeahead = function (option) {
|
1805
|
-
return this.each(function () {
|
1806
|
-
var $this = $(this)
|
1807
|
-
, data = $this.data('typeahead')
|
1808
|
-
, options = typeof option == 'object' && option
|
1809
|
-
if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
|
1810
|
-
if (typeof option == 'string') data[option]()
|
1811
|
-
})
|
1812
|
-
}
|
1813
|
-
|
1814
|
-
$.fn.typeahead.defaults = {
|
1815
|
-
source: []
|
1816
|
-
, items: 8
|
1817
|
-
, menu: '<ul class="typeahead dropdown-menu"></ul>'
|
1818
|
-
, item: '<li><a href="#"></a></li>'
|
1819
|
-
}
|
1723
|
+
$.fn.typeahead.Constructor = Typeahead
|
1820
1724
|
|
1821
|
-
$.fn.typeahead.Constructor = Typeahead
|
1822
1725
|
|
1726
|
+
/* TYPEAHEAD DATA-API
|
1727
|
+
* ================== */
|
1823
1728
|
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
e.preventDefault()
|
1832
|
-
$this.typeahead($this.data())
|
1729
|
+
$(function () {
|
1730
|
+
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
|
1731
|
+
var $this = $(this)
|
1732
|
+
if ($this.data('typeahead')) return
|
1733
|
+
e.preventDefault()
|
1734
|
+
$this.typeahead($this.data())
|
1735
|
+
})
|
1833
1736
|
})
|
1834
|
-
})
|
1835
1737
|
|
1836
1738
|
}(window.jQuery);
|