newton-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,210 @@
1
+ /* ========================================================================
2
+ * Bootstrap: carousel.js v3.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#carousel
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
+ // CAROUSEL CLASS DEFINITION
24
+ // =========================
25
+
26
+ var Carousel = function (element, options) {
27
+ this.$element = $(element)
28
+ this.$indicators = this.$element.find('.carousel-indicators')
29
+ this.options = options
30
+ this.paused =
31
+ this.sliding =
32
+ this.interval =
33
+ this.$active =
34
+ this.$items = null
35
+
36
+ this.options.pause == 'hover' && this.$element
37
+ .on('mouseenter', $.proxy(this.pause, this))
38
+ .on('mouseleave', $.proxy(this.cycle, this))
39
+ }
40
+
41
+ Carousel.DEFAULTS = {
42
+ interval: 5000
43
+ , pause: 'hover'
44
+ }
45
+
46
+ Carousel.prototype.cycle = function (e) {
47
+ e || (this.paused = false)
48
+
49
+ this.interval && clearInterval(this.interval)
50
+
51
+ this.options.interval
52
+ && !this.paused
53
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
54
+
55
+ return this
56
+ }
57
+
58
+ Carousel.prototype.getActiveIndex = function () {
59
+ this.$active = this.$element.find('.item.active')
60
+ this.$items = this.$active.parent().children()
61
+
62
+ return this.$items.index(this.$active)
63
+ }
64
+
65
+ Carousel.prototype.to = function (pos) {
66
+ var that = this
67
+ var activeIndex = this.getActiveIndex()
68
+
69
+ if (pos > (this.$items.length - 1) || pos < 0) return
70
+
71
+ if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
72
+ if (activeIndex == pos) return this.pause().cycle()
73
+
74
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
75
+ }
76
+
77
+ Carousel.prototype.pause = function (e) {
78
+ e || (this.paused = true)
79
+
80
+ if (this.$element.find('.next, .prev').length && $.support.transition.end) {
81
+ this.$element.trigger($.support.transition.end)
82
+ this.cycle(true)
83
+ }
84
+
85
+ this.interval = clearInterval(this.interval)
86
+
87
+ return this
88
+ }
89
+
90
+ Carousel.prototype.next = function () {
91
+ if (this.sliding) return
92
+ return this.slide('next')
93
+ }
94
+
95
+ Carousel.prototype.prev = function () {
96
+ if (this.sliding) return
97
+ return this.slide('prev')
98
+ }
99
+
100
+ Carousel.prototype.slide = function (type, next) {
101
+ var $active = this.$element.find('.item.active')
102
+ var $next = next || $active[type]()
103
+ var isCycling = this.interval
104
+ var direction = type == 'next' ? 'left' : 'right'
105
+ var fallback = type == 'next' ? 'first' : 'last'
106
+ var that = this
107
+
108
+ this.sliding = true
109
+
110
+ isCycling && this.pause()
111
+
112
+ $next = $next.length ? $next : this.$element.find('.item')[fallback]()
113
+
114
+ var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
115
+
116
+ if ($next.hasClass('active')) return
117
+
118
+ if (this.$indicators.length) {
119
+ this.$indicators.find('.active').removeClass('active')
120
+ this.$element.one('slid', function () {
121
+ var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
122
+ $nextIndicator && $nextIndicator.addClass('active')
123
+ })
124
+ }
125
+
126
+ if ($.support.transition && this.$element.hasClass('slide')) {
127
+ this.$element.trigger(e)
128
+ if (e.isDefaultPrevented()) return
129
+ $next.addClass(type)
130
+ $next[0].offsetWidth // force reflow
131
+ $active.addClass(direction)
132
+ $next.addClass(direction)
133
+ this.$element.one($.support.transition.end, function () {
134
+ $next.removeClass([type, direction].join(' ')).addClass('active')
135
+ $active.removeClass(['active', direction].join(' '))
136
+ that.sliding = false
137
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
138
+ })
139
+ } else {
140
+ this.$element.trigger(e)
141
+ if (e.isDefaultPrevented()) return
142
+ $active.removeClass('active')
143
+ $next.addClass('active')
144
+ this.sliding = false
145
+ this.$element.trigger('slid')
146
+ }
147
+
148
+ isCycling && this.cycle()
149
+
150
+ return this
151
+ }
152
+
153
+
154
+ // CAROUSEL PLUGIN DEFINITION
155
+ // ==========================
156
+
157
+ var old = $.fn.carousel
158
+
159
+ $.fn.carousel = function (option) {
160
+ return this.each(function () {
161
+ var $this = $(this)
162
+ var data = $this.data('bs.carousel')
163
+ var options = $.extend({}, Carousel.DEFAULTS, typeof option == 'object' && option)
164
+ var action = typeof option == 'string' ? option : options.slide
165
+
166
+ if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
167
+ if (typeof option == 'number') data.to(option)
168
+ else if (action) data[action]()
169
+ else if (options.interval) data.pause().cycle()
170
+ })
171
+ }
172
+
173
+ $.fn.carousel.Constructor = Carousel
174
+
175
+
176
+ // CAROUSEL NO CONFLICT
177
+ // ====================
178
+
179
+ $.fn.carousel.noConflict = function () {
180
+ $.fn.carousel = old
181
+ return this
182
+ }
183
+
184
+
185
+ // CAROUSEL DATA-API
186
+ // =================
187
+
188
+ $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
189
+ var $this = $(this), href
190
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
191
+ var options = $.extend({}, $target.data(), $this.data())
192
+ var slideIndex
193
+
194
+ $target.carousel(options)
195
+
196
+ if (slideIndex = $this.attr('data-slide-to')) {
197
+ $target.data('bs.carousel').pause().to(slideIndex).cycle()
198
+ }
199
+
200
+ e.preventDefault()
201
+ })
202
+
203
+ $(window).on('load', function () {
204
+ $('[data-ride="carousel"]').each(function () {
205
+ var $carousel = $(this)
206
+ $carousel.carousel($carousel.data())
207
+ })
208
+ })
209
+
210
+ }(window.jQuery);
@@ -0,0 +1,153 @@
1
+ /* ========================================================================
2
+ * Bootstrap: collapse.js v3.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#collapse
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
+ // COLLAPSE PUBLIC CLASS DEFINITION
24
+ // ================================
25
+
26
+ var Collapse = function (element, options) {
27
+ this.$element = $(element)
28
+ this.options = $.extend({}, Collapse.DEFAULTS, options)
29
+ this.transitioning = null
30
+
31
+ if (this.options.parent) this.$parent = $(this.options.parent)
32
+ if (this.options.toggle) this.toggle()
33
+ }
34
+
35
+ Collapse.DEFAULTS = {
36
+ toggle: true
37
+ }
38
+
39
+ Collapse.prototype.dimension = function () {
40
+ var hasWidth = this.$element.hasClass('width')
41
+ return hasWidth ? 'width' : 'height'
42
+ }
43
+
44
+ Collapse.prototype.show = function () {
45
+ if (this.transitioning || this.$element.hasClass('in')) return
46
+
47
+ var dimension = this.dimension()
48
+ var scroll = $.camelCase(['scroll', dimension].join('-'))
49
+ var actives = this.$parent && this.$parent.find('> .accordion-group > .in')
50
+
51
+ if (actives && actives.length) {
52
+ var hasData = actives.data('collapse')
53
+ if (hasData && hasData.transitioning) return
54
+ actives.collapse('hide')
55
+ hasData || actives.data('collapse', null)
56
+ }
57
+
58
+ this.$element[dimension](0)
59
+ this.transition('addClass', $.Event('show.bs.collapse'), 'shown.bs.collapse')
60
+
61
+ if ($.support.transition) this.$element[dimension](this.$element[0][scroll])
62
+ }
63
+
64
+ Collapse.prototype.hide = function () {
65
+ if (this.transitioning || !this.$element.hasClass('in')) return
66
+ var dimension = this.dimension()
67
+ this.reset(this.$element[dimension]())
68
+ this.transition('removeClass', $.Event('hide.bs.collapse'), 'hidden')
69
+ this.$element[dimension](0)
70
+ }
71
+
72
+ Collapse.prototype.reset = function (size) {
73
+ var dimension = this.dimension()
74
+
75
+ this.$element
76
+ .removeClass('collapse')
77
+ [dimension](size || 'auto')
78
+ [0].offsetWidth
79
+
80
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
81
+
82
+ return this
83
+ }
84
+
85
+ Collapse.prototype.transition = function (method, startEvent, completeEvent) {
86
+ var that = this
87
+ var complete = function () {
88
+ if (startEvent.type == 'show') that.reset()
89
+ that.transitioning = 0
90
+ that.$element.trigger(completeEvent)
91
+ }
92
+
93
+ this.$element.trigger(startEvent)
94
+
95
+ if (startEvent.isDefaultPrevented()) return
96
+
97
+ this.transitioning = 1
98
+
99
+ this.$element[method]('in')
100
+
101
+ $.support.transition && this.$element.hasClass('collapse') ?
102
+ this.$element.one($.support.transition.end, complete) :
103
+ complete()
104
+ }
105
+
106
+ Collapse.prototype.toggle = function () {
107
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
108
+ }
109
+
110
+
111
+ // COLLAPSE PLUGIN DEFINITION
112
+ // ==========================
113
+
114
+ var old = $.fn.collapse
115
+
116
+ $.fn.collapse = function (option) {
117
+ return this.each(function () {
118
+ var $this = $(this)
119
+ var data = $this.data('collapse')
120
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
121
+
122
+ if (!data) $this.data('collapse', (data = new Collapse(this, options)))
123
+ if (typeof option == 'string') data[option]()
124
+ })
125
+ }
126
+
127
+ $.fn.collapse.Constructor = Collapse
128
+
129
+
130
+ // COLLAPSE NO CONFLICT
131
+ // ====================
132
+
133
+ $.fn.collapse.noConflict = function () {
134
+ $.fn.collapse = old
135
+ return this
136
+ }
137
+
138
+
139
+ // COLLAPSE DATA-API
140
+ // =================
141
+
142
+ $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
143
+ var $this = $(this), href
144
+ var target = $this.attr('data-target')
145
+ || e.preventDefault()
146
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
147
+ var option = $(target).data('collapse') ? 'toggle' : $this.data()
148
+
149
+ $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
150
+ $(target).collapse(option)
151
+ })
152
+
153
+ }(window.jQuery);
@@ -0,0 +1,155 @@
1
+ /* ========================================================================
2
+ * Bootstrap: dropdown.js v3.0.0
3
+ * http://twitter.github.com/bootstrap/javascript.html#dropdowns
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
+ // DROPDOWN CLASS DEFINITION
24
+ // =========================
25
+
26
+ var backdrop = '.dropdown-backdrop'
27
+ var toggle = '[data-toggle=dropdown]'
28
+ var Dropdown = function (element) {
29
+ var $el = $(element).on('click.bs.dropdown', this.toggle)
30
+ }
31
+
32
+ Dropdown.prototype.toggle = function (e) {
33
+ var $this = $(this)
34
+
35
+ if ($this.is('.disabled, :disabled')) return
36
+
37
+ var $parent = getParent($this)
38
+ var isActive = $parent.hasClass('open')
39
+
40
+ clearMenus()
41
+
42
+ if (!isActive) {
43
+ if ('ontouchstart' in document.documentElement) {
44
+ // if mobile we we use a backdrop because click events don't delegate
45
+ $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
46
+ }
47
+
48
+ $parent.trigger(e = $.Event('show.bs.dropdown'))
49
+
50
+ if (e.isDefaultPrevented()) return
51
+
52
+ $parent
53
+ .toggleClass('open')
54
+ .trigger('shown.bs.dropdown')
55
+ }
56
+
57
+ $this.focus()
58
+
59
+ return false
60
+ }
61
+
62
+ Dropdown.prototype.keydown = function (e) {
63
+ if (!/(38|40|27)/.test(e.keyCode)) return
64
+
65
+ var $this = $(this)
66
+
67
+ e.preventDefault()
68
+ e.stopPropagation()
69
+
70
+ if ($this.is('.disabled, :disabled')) return
71
+
72
+ var $parent = getParent($this)
73
+ var isActive = $parent.hasClass('open')
74
+
75
+ if (!isActive || (isActive && e.keyCode == 27)) {
76
+ if (e.which == 27) $parent.find(toggle).focus()
77
+ return $this.click()
78
+ }
79
+
80
+ var $items = $('[role=menu] li:not(.divider):visible a', $parent)
81
+
82
+ if (!$items.length) return
83
+
84
+ var index = $items.index($items.filter(':focus'))
85
+
86
+ if (e.keyCode == 38 && index > 0) index-- // up
87
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
88
+ if (!~index) index=0
89
+
90
+ $items.eq(index).focus()
91
+ }
92
+
93
+ function clearMenus() {
94
+ $(backdrop).remove()
95
+ $(toggle).each(function (e) {
96
+ var $parent = getParent($(this))
97
+ if (!$parent.hasClass('open')) return
98
+ $parent.trigger(e = $.Event('hide.bs.dropdown'))
99
+ if (e.isDefaultPrevented()) return
100
+ $parent.removeClass('open').trigger('hidden.bs.dropdown')
101
+ })
102
+ }
103
+
104
+ function getParent($this) {
105
+ var selector = $this.attr('data-target')
106
+
107
+ if (!selector) {
108
+ selector = $this.attr('href')
109
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
110
+ }
111
+
112
+ var $parent = selector && $(selector)
113
+
114
+ return $parent && $parent.length ? $parent : $this.parent()
115
+ }
116
+
117
+
118
+ // DROPDOWN PLUGIN DEFINITION
119
+ // ==========================
120
+
121
+ var old = $.fn.dropdown
122
+
123
+ $.fn.dropdown = function (option) {
124
+ return this.each(function () {
125
+ var $this = $(this)
126
+ var data = $this.data('dropdown')
127
+
128
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
129
+ if (typeof option == 'string') data[option].call($this)
130
+ })
131
+ }
132
+
133
+ $.fn.dropdown.Constructor = Dropdown
134
+
135
+
136
+ // DROPDOWN NO CONFLICT
137
+ // ====================
138
+
139
+ $.fn.dropdown.noConflict = function () {
140
+ $.fn.dropdown = old
141
+ return this
142
+ }
143
+
144
+
145
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
146
+ // ===================================
147
+
148
+
149
+ $(document)
150
+ .on('click.bs.dropdown.data-api', clearMenus)
151
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
152
+ .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
153
+ .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
154
+
155
+ }(window.jQuery);