synapses-cas 0.1.0 → 0.1.1

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