twigg-app 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/data/quips.yml +45 -0
- data/lib/twigg-app/app/quips.rb +13 -0
- data/lib/twigg-app/app/routes.rb +43 -0
- data/lib/twigg-app/app/server.rb +146 -0
- data/lib/twigg-app/app/version.rb +5 -0
- data/lib/twigg-app/app.rb +14 -0
- data/lib/twigg-app.rb +5 -0
- data/public/application.js +106 -0
- data/public/favicon.ico +0 -0
- data/public/favicon.png +0 -0
- data/public/vendor/bootstrap/CNAME +1 -0
- data/public/vendor/bootstrap/CONTRIBUTING.md +66 -0
- data/public/vendor/bootstrap/Gruntfile.js +195 -0
- data/public/vendor/bootstrap/LICENSE +176 -0
- data/public/vendor/bootstrap/README.md +139 -0
- data/public/vendor/bootstrap/_config.yml +28 -0
- data/public/vendor/bootstrap/_includes/ads.html +1 -0
- data/public/vendor/bootstrap/_includes/footer.html +33 -0
- data/public/vendor/bootstrap/_includes/header.html +43 -0
- data/public/vendor/bootstrap/_includes/nav-components.html +135 -0
- data/public/vendor/bootstrap/_includes/nav-css.html +77 -0
- data/public/vendor/bootstrap/_includes/nav-customize.html +40 -0
- data/public/vendor/bootstrap/_includes/nav-getting-started.html +28 -0
- data/public/vendor/bootstrap/_includes/nav-javascript.html +88 -0
- data/public/vendor/bootstrap/_includes/nav-main.html +32 -0
- data/public/vendor/bootstrap/_includes/old-bs-docs.html +8 -0
- data/public/vendor/bootstrap/_includes/social-buttons.html +16 -0
- data/public/vendor/bootstrap/_layouts/customize.html +52 -0
- data/public/vendor/bootstrap/_layouts/default.html +72 -0
- data/public/vendor/bootstrap/_layouts/home.html +43 -0
- data/public/vendor/bootstrap/assets/css/docs.css +896 -0
- data/public/vendor/bootstrap/assets/css/pygments-manni.css +66 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
- data/public/vendor/bootstrap/assets/js/application.js +82 -0
- data/public/vendor/bootstrap/assets/js/customizer.js +175 -0
- data/public/vendor/bootstrap/assets/js/holder.js +419 -0
- data/public/vendor/bootstrap/assets/js/html5shiv.js +8 -0
- data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +1287 -0
- data/public/vendor/bootstrap/assets/js/jquery.js +5 -0
- data/public/vendor/bootstrap/assets/js/jszip.js +1425 -0
- data/public/vendor/bootstrap/assets/js/less.js +9 -0
- data/public/vendor/bootstrap/assets/js/respond.min.js +6 -0
- data/public/vendor/bootstrap/assets/js/uglify.js +14 -0
- data/public/vendor/bootstrap/bower.json +11 -0
- data/public/vendor/bootstrap/browserstack.json +37 -0
- data/public/vendor/bootstrap/components.html +2555 -0
- data/public/vendor/bootstrap/composer.json +20 -0
- data/public/vendor/bootstrap/css.html +2276 -0
- data/public/vendor/bootstrap/customize.html +1480 -0
- data/public/vendor/bootstrap/dist/css/bootstrap.css +5579 -0
- data/public/vendor/bootstrap/dist/css/bootstrap.min.css +9 -0
- data/public/vendor/bootstrap/dist/js/bootstrap.js +1993 -0
- data/public/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
- data/public/vendor/bootstrap/getting-started.html +375 -0
- data/public/vendor/bootstrap/index.html +16 -0
- data/public/vendor/bootstrap/javascript.html +1904 -0
- data/public/vendor/bootstrap/js/affix.js +126 -0
- data/public/vendor/bootstrap/js/alert.js +98 -0
- data/public/vendor/bootstrap/js/button.js +109 -0
- data/public/vendor/bootstrap/js/carousel.js +217 -0
- data/public/vendor/bootstrap/js/collapse.js +179 -0
- data/public/vendor/bootstrap/js/dropdown.js +154 -0
- data/public/vendor/bootstrap/js/modal.js +244 -0
- data/public/vendor/bootstrap/js/popover.js +117 -0
- data/public/vendor/bootstrap/js/scrollspy.js +158 -0
- data/public/vendor/bootstrap/js/tab.js +135 -0
- data/public/vendor/bootstrap/js/tests/index.html +52 -0
- data/public/vendor/bootstrap/js/tests/phantom.js +63 -0
- data/public/vendor/bootstrap/js/tests/server.js +14 -0
- data/public/vendor/bootstrap/js/tests/unit/affix.js +25 -0
- data/public/vendor/bootstrap/js/tests/unit/alert.js +62 -0
- data/public/vendor/bootstrap/js/tests/unit/button.js +116 -0
- data/public/vendor/bootstrap/js/tests/unit/carousel.js +87 -0
- data/public/vendor/bootstrap/js/tests/unit/collapse.js +164 -0
- data/public/vendor/bootstrap/js/tests/unit/dropdown.js +219 -0
- data/public/vendor/bootstrap/js/tests/unit/modal.js +177 -0
- data/public/vendor/bootstrap/js/tests/unit/phantom.js +69 -0
- data/public/vendor/bootstrap/js/tests/unit/popover.js +133 -0
- data/public/vendor/bootstrap/js/tests/unit/scrollspy.js +37 -0
- data/public/vendor/bootstrap/js/tests/unit/tab.js +86 -0
- data/public/vendor/bootstrap/js/tests/unit/tooltip.js +437 -0
- data/public/vendor/bootstrap/js/tests/unit/transition.js +13 -0
- data/public/vendor/bootstrap/js/tests/vendor/jquery.js +5 -0
- data/public/vendor/bootstrap/js/tests/vendor/qunit.css +232 -0
- data/public/vendor/bootstrap/js/tests/vendor/qunit.js +1510 -0
- data/public/vendor/bootstrap/js/tooltip.js +382 -0
- data/public/vendor/bootstrap/js/transition.js +56 -0
- data/public/vendor/bootstrap/less/alerts.less +71 -0
- data/public/vendor/bootstrap/less/badges.less +51 -0
- data/public/vendor/bootstrap/less/bootstrap.less +63 -0
- data/public/vendor/bootstrap/less/breadcrumbs.less +23 -0
- data/public/vendor/bootstrap/less/button-groups.less +244 -0
- data/public/vendor/bootstrap/less/buttons.less +159 -0
- data/public/vendor/bootstrap/less/carousel.less +204 -0
- data/public/vendor/bootstrap/less/close.less +33 -0
- data/public/vendor/bootstrap/less/code.less +56 -0
- data/public/vendor/bootstrap/less/component-animations.less +29 -0
- data/public/vendor/bootstrap/less/dropdowns.less +176 -0
- data/public/vendor/bootstrap/less/forms.less +332 -0
- data/public/vendor/bootstrap/less/grid.less +340 -0
- data/public/vendor/bootstrap/less/input-groups.less +127 -0
- data/public/vendor/bootstrap/less/jumbotron.less +29 -0
- data/public/vendor/bootstrap/less/labels.less +54 -0
- data/public/vendor/bootstrap/less/list-group.less +88 -0
- data/public/vendor/bootstrap/less/media.less +56 -0
- data/public/vendor/bootstrap/less/mixins.less +693 -0
- data/public/vendor/bootstrap/less/modals.less +133 -0
- data/public/vendor/bootstrap/less/navbar.less +559 -0
- data/public/vendor/bootstrap/less/navs.less +228 -0
- data/public/vendor/bootstrap/less/normalize.less +396 -0
- data/public/vendor/bootstrap/less/pager.less +55 -0
- data/public/vendor/bootstrap/less/pagination.less +72 -0
- data/public/vendor/bootstrap/less/panels.less +128 -0
- data/public/vendor/bootstrap/less/popovers.less +133 -0
- data/public/vendor/bootstrap/less/print.less +100 -0
- data/public/vendor/bootstrap/less/progress-bars.less +99 -0
- data/public/vendor/bootstrap/less/responsive-utilities.less +149 -0
- data/public/vendor/bootstrap/less/scaffolding.less +111 -0
- data/public/vendor/bootstrap/less/tables.less +211 -0
- data/public/vendor/bootstrap/less/thumbnails.less +42 -0
- data/public/vendor/bootstrap/less/tooltip.less +95 -0
- data/public/vendor/bootstrap/less/type.less +238 -0
- data/public/vendor/bootstrap/less/utilities.less +42 -0
- data/public/vendor/bootstrap/less/variables.less +607 -0
- data/public/vendor/bootstrap/less/wells.less +29 -0
- data/public/vendor/bootstrap/package.json +33 -0
- data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +3 -0
- data/public/vendor/bootstrap-glyphicons/CNAME +1 -0
- data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +54 -0
- data/public/vendor/bootstrap-glyphicons/LICENSE +19 -0
- data/public/vendor/bootstrap-glyphicons/README.md +61 -0
- data/public/vendor/bootstrap-glyphicons/_config.yml +12 -0
- data/public/vendor/bootstrap-glyphicons/composer.json +9 -0
- data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +2 -0
- data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +9 -0
- data/public/vendor/bootstrap-glyphicons/css/docs.css +160 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +175 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
- data/public/vendor/bootstrap-glyphicons/index.html +255 -0
- data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +201 -0
- data/public/vendor/bootstrap-glyphicons/package.json +18 -0
- data/public/vendor/d3/LICENSE +26 -0
- data/public/vendor/d3/README.md +7 -0
- data/public/vendor/d3/bower.json +25 -0
- data/public/vendor/d3/d3.js +8810 -0
- data/public/vendor/d3/d3.min.js +5 -0
- data/public/vendor/jquery/README.md +11 -0
- data/public/vendor/jquery/bower.json +11 -0
- data/public/vendor/jquery/component.json +15 -0
- data/public/vendor/jquery/composer.json +35 -0
- data/public/vendor/jquery/jquery-migrate.js +511 -0
- data/public/vendor/jquery/jquery-migrate.min.js +3 -0
- data/public/vendor/jquery/jquery.js +8829 -0
- data/public/vendor/jquery/jquery.min.js +6 -0
- data/public/vendor/jquery/jquery.min.map +1 -0
- data/public/vendor/jquery/package.json +7 -0
- data/public/vendor/replacejs/CHANGELOG.md +3 -0
- data/public/vendor/replacejs/MIT-LICENSE.txt +20 -0
- data/public/vendor/replacejs/README.md +123 -0
- data/public/vendor/replacejs/bower.json +24 -0
- data/public/vendor/replacejs/primer.js +17 -0
- data/public/vendor/replacejs/primer.min.js +1 -0
- data/public/vendor/replacejs/replace.js +182 -0
- data/public/vendor/stupidtable.js +158 -0
- data/views/dashboard.haml +17 -0
- data/views/layout.haml +60 -0
- metadata +330 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: scrollspy.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#scrollspy
|
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 ($) { "use strict";
|
22
|
+
|
23
|
+
// SCROLLSPY CLASS DEFINITION
|
24
|
+
// ==========================
|
25
|
+
|
26
|
+
function ScrollSpy(element, options) {
|
27
|
+
var href
|
28
|
+
var process = $.proxy(this.process, this)
|
29
|
+
|
30
|
+
this.$element = $(element).is('body') ? $(window) : $(element)
|
31
|
+
this.$body = $('body')
|
32
|
+
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
|
33
|
+
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
34
|
+
this.selector = (this.options.target
|
35
|
+
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
36
|
+
|| '') + ' .nav li > a'
|
37
|
+
this.offsets = $([])
|
38
|
+
this.targets = $([])
|
39
|
+
this.activeTarget = null
|
40
|
+
|
41
|
+
this.refresh()
|
42
|
+
this.process()
|
43
|
+
}
|
44
|
+
|
45
|
+
ScrollSpy.DEFAULTS = {
|
46
|
+
offset: 10
|
47
|
+
}
|
48
|
+
|
49
|
+
ScrollSpy.prototype.refresh = function () {
|
50
|
+
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
|
51
|
+
|
52
|
+
this.offsets = $([])
|
53
|
+
this.targets = $([])
|
54
|
+
|
55
|
+
var self = this
|
56
|
+
var $targets = this.$body
|
57
|
+
.find(this.selector)
|
58
|
+
.map(function () {
|
59
|
+
var $el = $(this)
|
60
|
+
var href = $el.data('target') || $el.attr('href')
|
61
|
+
var $href = /^#\w/.test(href) && $(href)
|
62
|
+
|
63
|
+
return ($href
|
64
|
+
&& $href.length
|
65
|
+
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
|
66
|
+
})
|
67
|
+
.sort(function (a, b) { return a[0] - b[0] })
|
68
|
+
.each(function () {
|
69
|
+
self.offsets.push(this[0])
|
70
|
+
self.targets.push(this[1])
|
71
|
+
})
|
72
|
+
}
|
73
|
+
|
74
|
+
ScrollSpy.prototype.process = function () {
|
75
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
|
76
|
+
var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
|
77
|
+
var maxScroll = scrollHeight - this.$scrollElement.height()
|
78
|
+
var offsets = this.offsets
|
79
|
+
var targets = this.targets
|
80
|
+
var activeTarget = this.activeTarget
|
81
|
+
var i
|
82
|
+
|
83
|
+
if (scrollTop >= maxScroll) {
|
84
|
+
return activeTarget != (i = targets.last()[0]) && this.activate(i)
|
85
|
+
}
|
86
|
+
|
87
|
+
for (i = offsets.length; i--;) {
|
88
|
+
activeTarget != targets[i]
|
89
|
+
&& scrollTop >= offsets[i]
|
90
|
+
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
|
91
|
+
&& this.activate( targets[i] )
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
ScrollSpy.prototype.activate = function (target) {
|
96
|
+
this.activeTarget = target
|
97
|
+
|
98
|
+
$(this.selector)
|
99
|
+
.parents('.active')
|
100
|
+
.removeClass('active')
|
101
|
+
|
102
|
+
var selector = this.selector
|
103
|
+
+ '[data-target="' + target + '"],'
|
104
|
+
+ this.selector + '[href="' + target + '"]'
|
105
|
+
|
106
|
+
var active = $(selector)
|
107
|
+
.parents('li')
|
108
|
+
.addClass('active')
|
109
|
+
|
110
|
+
if (active.parent('.dropdown-menu').length) {
|
111
|
+
active = active
|
112
|
+
.closest('li.dropdown')
|
113
|
+
.addClass('active')
|
114
|
+
}
|
115
|
+
|
116
|
+
active.trigger('activate')
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
// SCROLLSPY PLUGIN DEFINITION
|
121
|
+
// ===========================
|
122
|
+
|
123
|
+
var old = $.fn.scrollspy
|
124
|
+
|
125
|
+
$.fn.scrollspy = function (option) {
|
126
|
+
return this.each(function () {
|
127
|
+
var $this = $(this)
|
128
|
+
var data = $this.data('bs.scrollspy')
|
129
|
+
var options = typeof option == 'object' && option
|
130
|
+
|
131
|
+
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
|
132
|
+
if (typeof option == 'string') data[option]()
|
133
|
+
})
|
134
|
+
}
|
135
|
+
|
136
|
+
$.fn.scrollspy.Constructor = ScrollSpy
|
137
|
+
|
138
|
+
|
139
|
+
// SCROLLSPY NO CONFLICT
|
140
|
+
// =====================
|
141
|
+
|
142
|
+
$.fn.scrollspy.noConflict = function () {
|
143
|
+
$.fn.scrollspy = old
|
144
|
+
return this
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
// SCROLLSPY DATA-API
|
149
|
+
// ==================
|
150
|
+
|
151
|
+
$(window).on('load', function () {
|
152
|
+
$('[data-spy="scroll"]').each(function () {
|
153
|
+
var $spy = $(this)
|
154
|
+
$spy.scrollspy($spy.data())
|
155
|
+
})
|
156
|
+
})
|
157
|
+
|
158
|
+
}(window.jQuery);
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* Bootstrap: tab.js v3.0.0
|
3
|
+
* http://twbs.github.com/bootstrap/javascript.html#tabs
|
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 ($) { "use strict";
|
22
|
+
|
23
|
+
// TAB CLASS DEFINITION
|
24
|
+
// ====================
|
25
|
+
|
26
|
+
var Tab = function (element) {
|
27
|
+
this.element = $(element)
|
28
|
+
}
|
29
|
+
|
30
|
+
Tab.prototype.show = function () {
|
31
|
+
var $this = this.element
|
32
|
+
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
33
|
+
var selector = $this.attr('data-target')
|
34
|
+
|
35
|
+
if (!selector) {
|
36
|
+
selector = $this.attr('href')
|
37
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
38
|
+
}
|
39
|
+
|
40
|
+
if ($this.parent('li').hasClass('active')) return
|
41
|
+
|
42
|
+
var previous = $ul.find('.active:last a')[0]
|
43
|
+
var e = $.Event('show.bs.tab', {
|
44
|
+
relatedTarget: previous
|
45
|
+
})
|
46
|
+
|
47
|
+
$this.trigger(e)
|
48
|
+
|
49
|
+
if (e.isDefaultPrevented()) return
|
50
|
+
|
51
|
+
var $target = $(selector)
|
52
|
+
|
53
|
+
this.activate($this.parent('li'), $ul)
|
54
|
+
this.activate($target, $target.parent(), function () {
|
55
|
+
$this.trigger({
|
56
|
+
type: 'shown.bs.tab'
|
57
|
+
, relatedTarget: previous
|
58
|
+
})
|
59
|
+
})
|
60
|
+
}
|
61
|
+
|
62
|
+
Tab.prototype.activate = function (element, container, callback) {
|
63
|
+
var $active = container.find('> .active')
|
64
|
+
var transition = callback
|
65
|
+
&& $.support.transition
|
66
|
+
&& $active.hasClass('fade')
|
67
|
+
|
68
|
+
function next() {
|
69
|
+
$active
|
70
|
+
.removeClass('active')
|
71
|
+
.find('> .dropdown-menu > .active')
|
72
|
+
.removeClass('active')
|
73
|
+
|
74
|
+
element.addClass('active')
|
75
|
+
|
76
|
+
if (transition) {
|
77
|
+
element[0].offsetWidth // reflow for transition
|
78
|
+
element.addClass('in')
|
79
|
+
} else {
|
80
|
+
element.removeClass('fade')
|
81
|
+
}
|
82
|
+
|
83
|
+
if (element.parent('.dropdown-menu')) {
|
84
|
+
element.closest('li.dropdown').addClass('active')
|
85
|
+
}
|
86
|
+
|
87
|
+
callback && callback()
|
88
|
+
}
|
89
|
+
|
90
|
+
transition ?
|
91
|
+
$active
|
92
|
+
.one($.support.transition.end, next)
|
93
|
+
.emulateTransitionEnd(150) :
|
94
|
+
next()
|
95
|
+
|
96
|
+
$active.removeClass('in')
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
// TAB PLUGIN DEFINITION
|
101
|
+
// =====================
|
102
|
+
|
103
|
+
var old = $.fn.tab
|
104
|
+
|
105
|
+
$.fn.tab = function ( option ) {
|
106
|
+
return this.each(function () {
|
107
|
+
var $this = $(this)
|
108
|
+
var data = $this.data('bs.tab')
|
109
|
+
|
110
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
111
|
+
if (typeof option == 'string') data[option]()
|
112
|
+
})
|
113
|
+
}
|
114
|
+
|
115
|
+
$.fn.tab.Constructor = Tab
|
116
|
+
|
117
|
+
|
118
|
+
// TAB NO CONFLICT
|
119
|
+
// ===============
|
120
|
+
|
121
|
+
$.fn.tab.noConflict = function () {
|
122
|
+
$.fn.tab = old
|
123
|
+
return this
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
// TAB DATA-API
|
128
|
+
// ============
|
129
|
+
|
130
|
+
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
131
|
+
e.preventDefault()
|
132
|
+
$(this).tab('show')
|
133
|
+
})
|
134
|
+
|
135
|
+
}(window.jQuery);
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Bootstrap Plugin Test Suite</title>
|
5
|
+
|
6
|
+
<!-- jquery -->
|
7
|
+
<!--<script src="http://code.jquery.com/jquery-1.7.min.js"></script>-->
|
8
|
+
<script src="vendor/jquery.js"></script>
|
9
|
+
|
10
|
+
<!-- qunit -->
|
11
|
+
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
|
12
|
+
<script src="vendor/qunit.js"></script>
|
13
|
+
|
14
|
+
<!-- plugin sources -->
|
15
|
+
<script src="../../js/transition.js"></script>
|
16
|
+
<script src="../../js/alert.js"></script>
|
17
|
+
<script src="../../js/button.js"></script>
|
18
|
+
<script src="../../js/carousel.js"></script>
|
19
|
+
<script src="../../js/collapse.js"></script>
|
20
|
+
<script src="../../js/dropdown.js"></script>
|
21
|
+
<script src="../../js/modal.js"></script>
|
22
|
+
<script src="../../js/scrollspy.js"></script>
|
23
|
+
<script src="../../js/tab.js"></script>
|
24
|
+
<script src="../../js/tooltip.js"></script>
|
25
|
+
<script src="../../js/popover.js"></script>
|
26
|
+
<script src="../../js/affix.js"></script>
|
27
|
+
|
28
|
+
<!-- unit tests -->
|
29
|
+
<script src="unit/transition.js"></script>
|
30
|
+
<script src="unit/alert.js"></script>
|
31
|
+
<script src="unit/button.js"></script>
|
32
|
+
<script src="unit/carousel.js"></script>
|
33
|
+
<script src="unit/collapse.js"></script>
|
34
|
+
<script src="unit/dropdown.js"></script>
|
35
|
+
<script src="unit/modal.js"></script>
|
36
|
+
<script src="unit/scrollspy.js"></script>
|
37
|
+
<script src="unit/tab.js"></script>
|
38
|
+
<script src="unit/tooltip.js"></script>
|
39
|
+
<script src="unit/popover.js"></script>
|
40
|
+
<script src="unit/affix.js"></script>
|
41
|
+
|
42
|
+
</head>
|
43
|
+
<body>
|
44
|
+
<div>
|
45
|
+
<h1 id="qunit-header">Bootstrap Plugin Test Suite</h1>
|
46
|
+
<h2 id="qunit-banner"></h2>
|
47
|
+
<h2 id="qunit-userAgent"></h2>
|
48
|
+
<ol id="qunit-tests"></ol>
|
49
|
+
<div id="qunit-fixture"></div>
|
50
|
+
</div>
|
51
|
+
</body>
|
52
|
+
</html>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Simple phantom.js integration script
|
2
|
+
// Adapted from Modernizr
|
3
|
+
|
4
|
+
function waitFor(testFx, onReady, timeOutMillis) {
|
5
|
+
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 5001 //< Default Max Timout is 5s
|
6
|
+
, start = new Date().getTime()
|
7
|
+
, condition = false
|
8
|
+
, interval = setInterval(function () {
|
9
|
+
if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) {
|
10
|
+
// If not time-out yet and condition not yet fulfilled
|
11
|
+
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()) //< defensive code
|
12
|
+
} else {
|
13
|
+
if (!condition) {
|
14
|
+
// If condition still not fulfilled (timeout but condition is 'false')
|
15
|
+
console.log("'waitFor()' timeout")
|
16
|
+
phantom.exit(1)
|
17
|
+
} else {
|
18
|
+
// Condition fulfilled (timeout and/or condition is 'true')
|
19
|
+
typeof(onReady) === "string" ? eval(onReady) : onReady() //< Do what it's supposed to do once the condition is fulfilled
|
20
|
+
clearInterval(interval) //< Stop this interval
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}, 100) //< repeat check every 100ms
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
if (phantom.args.length === 0 || phantom.args.length > 2) {
|
28
|
+
console.log('Usage: phantom.js URL')
|
29
|
+
phantom.exit()
|
30
|
+
}
|
31
|
+
|
32
|
+
var page = new WebPage()
|
33
|
+
|
34
|
+
// Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
|
35
|
+
page.onConsoleMessage = function(msg) {
|
36
|
+
console.log(msg)
|
37
|
+
};
|
38
|
+
|
39
|
+
page.open(phantom.args[0], function(status){
|
40
|
+
if (status !== "success") {
|
41
|
+
console.log("Unable to access network")
|
42
|
+
phantom.exit()
|
43
|
+
} else {
|
44
|
+
waitFor(function(){
|
45
|
+
return page.evaluate(function(){
|
46
|
+
var el = document.getElementById('qunit-testresult')
|
47
|
+
if (el && el.innerText.match('completed')) {
|
48
|
+
return true
|
49
|
+
}
|
50
|
+
return false
|
51
|
+
})
|
52
|
+
}, function(){
|
53
|
+
var failedNum = page.evaluate(function(){
|
54
|
+
var el = document.getElementById('qunit-testresult')
|
55
|
+
try {
|
56
|
+
return el.getElementsByClassName('failed')[0].innerHTML
|
57
|
+
} catch (e) { }
|
58
|
+
return 10000
|
59
|
+
});
|
60
|
+
phantom.exit((parseInt(failedNum, 10) > 0) ? 1 : 0)
|
61
|
+
})
|
62
|
+
}
|
63
|
+
})
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* Simple connect server for phantom.js
|
3
|
+
* Adapted from Modernizr
|
4
|
+
*/
|
5
|
+
|
6
|
+
var connect = require('connect')
|
7
|
+
, http = require('http')
|
8
|
+
, fs = require('fs')
|
9
|
+
, app = connect()
|
10
|
+
.use(connect.static(__dirname + '/../../'));
|
11
|
+
|
12
|
+
http.createServer(app).listen(3000);
|
13
|
+
|
14
|
+
fs.writeFileSync(__dirname + '/pid.txt', process.pid, 'utf-8')
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$(function () {
|
2
|
+
|
3
|
+
module("affix")
|
4
|
+
|
5
|
+
test("should provide no conflict", function () {
|
6
|
+
var affix = $.fn.affix.noConflict()
|
7
|
+
ok(!$.fn.affix, 'affix was set back to undefined (org value)')
|
8
|
+
$.fn.affix = affix
|
9
|
+
})
|
10
|
+
|
11
|
+
test("should be defined on jquery object", function () {
|
12
|
+
ok($(document.body).affix, 'affix method is defined')
|
13
|
+
})
|
14
|
+
|
15
|
+
test("should return element", function () {
|
16
|
+
ok($(document.body).affix()[0] == document.body, 'document.body returned')
|
17
|
+
})
|
18
|
+
|
19
|
+
test("should exit early if element is not visible", function () {
|
20
|
+
var $affix = $('<div style="display: none"></div>').affix()
|
21
|
+
$affix.data('bs.affix').checkPosition()
|
22
|
+
ok(!$affix.hasClass('affix'), 'affix class was not added')
|
23
|
+
})
|
24
|
+
|
25
|
+
})
|
@@ -0,0 +1,62 @@
|
|
1
|
+
$(function () {
|
2
|
+
|
3
|
+
module("alert")
|
4
|
+
|
5
|
+
test("should provide no conflict", function () {
|
6
|
+
var alert = $.fn.alert.noConflict()
|
7
|
+
ok(!$.fn.alert, 'alert was set back to undefined (org value)')
|
8
|
+
$.fn.alert = alert
|
9
|
+
})
|
10
|
+
|
11
|
+
test("should be defined on jquery object", function () {
|
12
|
+
ok($(document.body).alert, 'alert method is defined')
|
13
|
+
})
|
14
|
+
|
15
|
+
test("should return element", function () {
|
16
|
+
ok($(document.body).alert()[0] == document.body, 'document.body returned')
|
17
|
+
})
|
18
|
+
|
19
|
+
test("should fade element out on clicking .close", function () {
|
20
|
+
var alertHTML = '<div class="alert-message warning fade in">'
|
21
|
+
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
22
|
+
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
|
23
|
+
+ '</div>'
|
24
|
+
, alert = $(alertHTML).alert()
|
25
|
+
|
26
|
+
alert.find('.close').click()
|
27
|
+
|
28
|
+
ok(!alert.hasClass('in'), 'remove .in class on .close click')
|
29
|
+
})
|
30
|
+
|
31
|
+
test("should remove element when clicking .close", function () {
|
32
|
+
$.support.transition = false
|
33
|
+
|
34
|
+
var alertHTML = '<div class="alert-message warning fade in">'
|
35
|
+
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
36
|
+
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
|
37
|
+
+ '</div>'
|
38
|
+
, alert = $(alertHTML).appendTo('#qunit-fixture').alert()
|
39
|
+
|
40
|
+
ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
|
41
|
+
|
42
|
+
alert.find('.close').click()
|
43
|
+
|
44
|
+
ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
|
45
|
+
})
|
46
|
+
|
47
|
+
test("should not fire closed when close is prevented", function () {
|
48
|
+
$.support.transition = false
|
49
|
+
stop();
|
50
|
+
$('<div class="alert"/>')
|
51
|
+
.on('close.bs.alert', function (e) {
|
52
|
+
e.preventDefault();
|
53
|
+
ok(true);
|
54
|
+
start();
|
55
|
+
})
|
56
|
+
.on('closed.bs.alert', function () {
|
57
|
+
ok(false);
|
58
|
+
})
|
59
|
+
.alert('close')
|
60
|
+
})
|
61
|
+
|
62
|
+
})
|
@@ -0,0 +1,116 @@
|
|
1
|
+
$(function () {
|
2
|
+
|
3
|
+
module("button")
|
4
|
+
|
5
|
+
test("should provide no conflict", function () {
|
6
|
+
var button = $.fn.button.noConflict()
|
7
|
+
ok(!$.fn.button, 'button was set back to undefined (org value)')
|
8
|
+
$.fn.button = button
|
9
|
+
})
|
10
|
+
|
11
|
+
test("should be defined on jquery object", function () {
|
12
|
+
ok($(document.body).button, 'button method is defined')
|
13
|
+
})
|
14
|
+
|
15
|
+
test("should return element", function () {
|
16
|
+
ok($(document.body).button()[0] == document.body, 'document.body returned')
|
17
|
+
})
|
18
|
+
|
19
|
+
test("should return set state to loading", function () {
|
20
|
+
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
21
|
+
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
22
|
+
btn.button('loading')
|
23
|
+
equals(btn.html(), 'fat', 'btn text equals fat')
|
24
|
+
stop()
|
25
|
+
setTimeout(function () {
|
26
|
+
ok(btn.attr('disabled'), 'btn is disabled')
|
27
|
+
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
28
|
+
start()
|
29
|
+
}, 0)
|
30
|
+
})
|
31
|
+
|
32
|
+
test("should return reset state", function () {
|
33
|
+
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
|
34
|
+
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
35
|
+
btn.button('loading')
|
36
|
+
equals(btn.html(), 'fat', 'btn text equals fat')
|
37
|
+
stop()
|
38
|
+
setTimeout(function () {
|
39
|
+
ok(btn.attr('disabled'), 'btn is disabled')
|
40
|
+
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
41
|
+
start()
|
42
|
+
stop()
|
43
|
+
btn.button('reset')
|
44
|
+
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
45
|
+
setTimeout(function () {
|
46
|
+
ok(!btn.attr('disabled'), 'btn is not disabled')
|
47
|
+
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
|
48
|
+
start()
|
49
|
+
}, 0)
|
50
|
+
}, 0)
|
51
|
+
|
52
|
+
})
|
53
|
+
|
54
|
+
test("should toggle active", function () {
|
55
|
+
var btn = $('<button class="btn">mdo</button>')
|
56
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
57
|
+
btn.button('toggle')
|
58
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
59
|
+
})
|
60
|
+
|
61
|
+
test("should toggle active when btn children are clicked", function () {
|
62
|
+
var btn = $('<button class="btn" data-toggle="button">mdo</button>')
|
63
|
+
, inner = $('<i></i>')
|
64
|
+
btn
|
65
|
+
.append(inner)
|
66
|
+
.appendTo($('#qunit-fixture'))
|
67
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
68
|
+
inner.click()
|
69
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
70
|
+
})
|
71
|
+
|
72
|
+
test("should toggle active when btn children are clicked within btn-group", function () {
|
73
|
+
var btngroup = $('<div class="btn-group" data-toggle="buttons"></div>')
|
74
|
+
, btn = $('<button class="btn">fat</button>')
|
75
|
+
, inner = $('<i></i>')
|
76
|
+
btngroup
|
77
|
+
.append(btn.append(inner))
|
78
|
+
.appendTo($('#qunit-fixture'))
|
79
|
+
ok(!btn.hasClass('active'), 'btn does not have active class')
|
80
|
+
inner.click()
|
81
|
+
ok(btn.hasClass('active'), 'btn has class active')
|
82
|
+
})
|
83
|
+
|
84
|
+
test("should check for closest matching toggle", function () {
|
85
|
+
var group = '<div class="btn-group" data-toggle="buttons">' +
|
86
|
+
'<label class="btn btn-primary active">' +
|
87
|
+
'<input type="radio" name="options" id="option1" checked="true"> Option 1' +
|
88
|
+
'</label>' +
|
89
|
+
'<label class="btn btn-primary">' +
|
90
|
+
'<input type="radio" name="options" id="option2"> Option 2' +
|
91
|
+
'</label>' +
|
92
|
+
'<label class="btn btn-primary">' +
|
93
|
+
'<input type="radio" name="options" id="option3"> Option 3' +
|
94
|
+
'</label>' +
|
95
|
+
'</div>'
|
96
|
+
|
97
|
+
group = $(group)
|
98
|
+
|
99
|
+
var btn1 = $(group.children()[0])
|
100
|
+
var btn2 = $(group.children()[1])
|
101
|
+
var btn3 = $(group.children()[2])
|
102
|
+
|
103
|
+
group.appendTo($('#qunit-fixture'))
|
104
|
+
|
105
|
+
ok(btn1.hasClass('active'), 'btn1 has active class')
|
106
|
+
ok(btn1.find('input').prop('checked'), 'btn1 is checked')
|
107
|
+
ok(!btn2.hasClass('active'), 'btn2 does not have active class')
|
108
|
+
ok(!btn2.find('input').prop('checked'), 'btn2 is not checked')
|
109
|
+
btn2.find('input').click()
|
110
|
+
ok(!btn1.hasClass('active'), 'btn1 does not have active class')
|
111
|
+
ok(!btn1.find('input').prop('checked'), 'btn1 is checked')
|
112
|
+
ok(btn2.hasClass('active'), 'btn2 has active class')
|
113
|
+
ok(btn2.find('input').prop('checked'), 'btn2 is checked')
|
114
|
+
})
|
115
|
+
|
116
|
+
})
|