Skip to content

Commit 2a993bd

Browse files
committed
Downloaded Bootstrap assets to local.
1 parent 4cca78e commit 2a993bd

19 files changed

+11262
-36
lines changed

assets/js/application.js

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
2+
// IT'S ALL JUST JUNK FOR OUR DOCS!
3+
// ++++++++++++++++++++++++++++++++++++++++++
4+
5+
!function ($) {
6+
7+
$(function(){
8+
9+
// Disable certain links in docs
10+
$('section [href^=#]').click(function (e) {
11+
e.preventDefault()
12+
})
13+
14+
// make code pretty
15+
window.prettyPrint && prettyPrint()
16+
17+
// add-ons
18+
$('.add-on :checkbox').on('click', function () {
19+
var $this = $(this)
20+
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
21+
$(this).parents('.add-on')[method]('active')
22+
})
23+
24+
// position static twipsies for components page
25+
if ($(".twipsies a").length) {
26+
$(window).on('load resize', function () {
27+
$(".twipsies a").each(function () {
28+
$(this)
29+
.tooltip({
30+
placement: $(this).attr('title')
31+
, trigger: 'manual'
32+
})
33+
.tooltip('show')
34+
})
35+
})
36+
}
37+
38+
// add tipsies to grid for scaffolding
39+
if ($('#grid-system').length) {
40+
$('#grid-system').tooltip({
41+
selector: '.show-grid > div'
42+
, title: function () { return $(this).width() + 'px' }
43+
})
44+
}
45+
46+
// fix sub nav on scroll
47+
var $win = $(window)
48+
, $nav = $('.subnav')
49+
, navTop = $('.subnav').length && $('.subnav').offset().top - 40
50+
, isFixed = 0
51+
52+
processScroll()
53+
54+
$win.on('scroll', processScroll)
55+
56+
function processScroll() {
57+
var i, scrollTop = $win.scrollTop()
58+
if (scrollTop >= navTop && !isFixed) {
59+
isFixed = 1
60+
$nav.addClass('subnav-fixed')
61+
} else if (scrollTop <= navTop && isFixed) {
62+
isFixed = 0
63+
$nav.removeClass('subnav-fixed')
64+
}
65+
}
66+
67+
// tooltip demo
68+
$('.tooltip-demo.well').tooltip({
69+
selector: "a[rel=tooltip]"
70+
})
71+
72+
$('.tooltip-test').tooltip()
73+
$('.popover-test').popover()
74+
75+
// popover demo
76+
$("a[rel=popover]")
77+
.popover()
78+
.click(function(e) {
79+
e.preventDefault()
80+
})
81+
82+
// button state demo
83+
$('#fat-btn')
84+
.click(function () {
85+
var btn = $(this)
86+
btn.button('loading')
87+
setTimeout(function () {
88+
btn.button('reset')
89+
}, 3000)
90+
})
91+
92+
// carousel demo
93+
$('#myCarousel').carousel()
94+
95+
// javascript build logic
96+
var inputsComponent = $("#components.download input")
97+
, inputsPlugin = $("#plugins.download input")
98+
, inputsVariables = $("#variables.download input")
99+
100+
// toggle all plugin checkboxes
101+
$('#components.download .toggle-all').on('click', function (e) {
102+
e.preventDefault()
103+
inputsComponent.attr('checked', !inputsComponent.is(':checked'))
104+
})
105+
106+
$('#plugins.download .toggle-all').on('click', function (e) {
107+
e.preventDefault()
108+
inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
109+
})
110+
111+
$('#variables.download .toggle-all').on('click', function (e) {
112+
e.preventDefault()
113+
inputsVariables.val('')
114+
})
115+
116+
// request built javascript
117+
$('.download-btn').on('click', function () {
118+
119+
var css = $("#components.download input:checked")
120+
.map(function () { return this.value })
121+
.toArray()
122+
, js = $("#plugins.download input:checked")
123+
.map(function () { return this.value })
124+
.toArray()
125+
, vars = {}
126+
, img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
127+
128+
$("#variables.download input")
129+
.each(function () {
130+
$(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
131+
})
132+
133+
$.ajax({
134+
type: 'POST'
135+
, url: 'http://bootstrap.herokuapp.com'
136+
, dataType: 'jsonpi'
137+
, params: {
138+
js: js
139+
, css: css
140+
, vars: vars
141+
, img: img
142+
}
143+
})
144+
})
145+
146+
})
147+
148+
// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
149+
$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
150+
var url = opts.url;
151+
152+
return {
153+
send: function(_, completeCallback) {
154+
var name = 'jQuery_iframe_' + jQuery.now()
155+
, iframe, form
156+
157+
iframe = $('<iframe>')
158+
.attr('name', name)
159+
.appendTo('head')
160+
161+
form = $('<form>')
162+
.attr('method', opts.type) // GET or POST
163+
.attr('action', url)
164+
.attr('target', name)
165+
166+
$.each(opts.params, function(k, v) {
167+
168+
$('<input>')
169+
.attr('type', 'hidden')
170+
.attr('name', k)
171+
.attr('value', typeof v == 'string' ? v : JSON.stringify(v))
172+
.appendTo(form)
173+
})
174+
175+
form.appendTo('body').submit()
176+
}
177+
}
178+
})
179+
180+
}(window.jQuery)

assets/js/bootstrap-alert.js

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/* ==========================================================
2+
* bootstrap-alert.js v2.0.2
3+
* http://twitter.github.com/bootstrap/javascript.html#alerts
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+
"use strict"
24+
25+
/* ALERT CLASS DEFINITION
26+
* ====================== */
27+
28+
var dismiss = '[data-dismiss="alert"]'
29+
, Alert = function ( el ) {
30+
$(el).on('click', dismiss, this.close)
31+
}
32+
33+
Alert.prototype = {
34+
35+
constructor: Alert
36+
37+
, close: function ( e ) {
38+
var $this = $(this)
39+
, selector = $this.attr('data-target')
40+
, $parent
41+
42+
if (!selector) {
43+
selector = $this.attr('href')
44+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
45+
}
46+
47+
$parent = $(selector)
48+
$parent.trigger('close')
49+
50+
e && e.preventDefault()
51+
52+
$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
53+
54+
$parent
55+
.trigger('close')
56+
.removeClass('in')
57+
58+
function removeElement() {
59+
$parent
60+
.trigger('closed')
61+
.remove()
62+
}
63+
64+
$.support.transition && $parent.hasClass('fade') ?
65+
$parent.on($.support.transition.end, removeElement) :
66+
removeElement()
67+
}
68+
69+
}
70+
71+
72+
/* ALERT PLUGIN DEFINITION
73+
* ======================= */
74+
75+
$.fn.alert = function ( option ) {
76+
return this.each(function () {
77+
var $this = $(this)
78+
, data = $this.data('alert')
79+
if (!data) $this.data('alert', (data = new Alert(this)))
80+
if (typeof option == 'string') data[option].call($this)
81+
})
82+
}
83+
84+
$.fn.alert.Constructor = Alert
85+
86+
87+
/* ALERT DATA-API
88+
* ============== */
89+
90+
$(function () {
91+
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
92+
})
93+
94+
}( window.jQuery );

assets/js/bootstrap-button.js

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/* ============================================================
2+
* bootstrap-button.js v2.0.2
3+
* http://twitter.github.com/bootstrap/javascript.html#buttons
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+
!function( $ ){
21+
22+
"use strict"
23+
24+
/* BUTTON PUBLIC CLASS DEFINITION
25+
* ============================== */
26+
27+
var Button = function ( element, options ) {
28+
this.$element = $(element)
29+
this.options = $.extend({}, $.fn.button.defaults, options)
30+
}
31+
32+
Button.prototype = {
33+
34+
constructor: Button
35+
36+
, setState: function ( state ) {
37+
var d = 'disabled'
38+
, $el = this.$element
39+
, data = $el.data()
40+
, val = $el.is('input') ? 'val' : 'html'
41+
42+
state = state + 'Text'
43+
data.resetText || $el.data('resetText', $el[val]())
44+
45+
$el[val](data[state] || this.options[state])
46+
47+
// push to event loop to allow forms to submit
48+
setTimeout(function () {
49+
state == 'loadingText' ?
50+
$el.addClass(d).attr(d, d) :
51+
$el.removeClass(d).removeAttr(d)
52+
}, 0)
53+
}
54+
55+
, toggle: function () {
56+
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
57+
58+
$parent && $parent
59+
.find('.active')
60+
.removeClass('active')
61+
62+
this.$element.toggleClass('active')
63+
}
64+
65+
}
66+
67+
68+
/* BUTTON PLUGIN DEFINITION
69+
* ======================== */
70+
71+
$.fn.button = function ( option ) {
72+
return this.each(function () {
73+
var $this = $(this)
74+
, data = $this.data('button')
75+
, options = typeof option == 'object' && option
76+
if (!data) $this.data('button', (data = new Button(this, options)))
77+
if (option == 'toggle') data.toggle()
78+
else if (option) data.setState(option)
79+
})
80+
}
81+
82+
$.fn.button.defaults = {
83+
loadingText: 'loading...'
84+
}
85+
86+
$.fn.button.Constructor = Button
87+
88+
89+
/* BUTTON DATA-API
90+
* =============== */
91+
92+
$(function () {
93+
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
94+
var $btn = $(e.target)
95+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
96+
$btn.button('toggle')
97+
})
98+
})
99+
100+
}( window.jQuery );

0 commit comments

Comments
 (0)