indvd00m@0
|
1 |
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
|
indvd00m@0
|
2 |
// IT'S ALL JUST JUNK FOR OUR DOCS!
|
indvd00m@0
|
3 |
// ++++++++++++++++++++++++++++++++++++++++++
|
indvd00m@0
|
4 |
|
indvd00m@0
|
5 |
!function ($) {
|
indvd00m@0
|
6 |
|
indvd00m@0
|
7 |
$(function(){
|
indvd00m@0
|
8 |
// oh how stylish! no semicolons. I'm not hipster enough for that.
|
indvd00m@0
|
9 |
// Keep your stumptown coffee and pbr, twats.
|
indvd00m@0
|
10 |
// real-javascript {{
|
indvd00m@0
|
11 |
/*
|
indvd00m@0
|
12 |
document.body.appendChild(document.createElement('div')).setAttribute('style', [
|
indvd00m@0
|
13 |
'position:fixed',
|
indvd00m@0
|
14 |
'z-index:1000',
|
indvd00m@0
|
15 |
'top:0',
|
indvd00m@0
|
16 |
'left:0',
|
indvd00m@0
|
17 |
'width:100%',
|
indvd00m@0
|
18 |
'height:100%',
|
indvd00m@0
|
19 |
'background:url("../img/8x5overlay.png") repeat'
|
indvd00m@0
|
20 |
].join(';'));
|
indvd00m@0
|
21 |
*/
|
indvd00m@0
|
22 |
// }}
|
indvd00m@0
|
23 |
var $window = $(window)
|
indvd00m@0
|
24 |
|
indvd00m@0
|
25 |
// Disable certain links in docs
|
indvd00m@0
|
26 |
$('section [href^=#]').click(function (e) {
|
indvd00m@0
|
27 |
e.preventDefault()
|
indvd00m@0
|
28 |
})
|
indvd00m@0
|
29 |
|
indvd00m@0
|
30 |
// side bar
|
indvd00m@0
|
31 |
setTimeout(function () {
|
indvd00m@0
|
32 |
$('.bs-docs-sidenav').affix({
|
indvd00m@0
|
33 |
offset: {
|
indvd00m@0
|
34 |
top: function () { return $window.width() <= 980 ? 290 : 210 }
|
indvd00m@0
|
35 |
, bottom: 270
|
indvd00m@0
|
36 |
}
|
indvd00m@0
|
37 |
})
|
indvd00m@0
|
38 |
}, 100)
|
indvd00m@0
|
39 |
|
indvd00m@0
|
40 |
// make code pretty
|
indvd00m@0
|
41 |
window.prettyPrint && prettyPrint()
|
indvd00m@0
|
42 |
|
indvd00m@0
|
43 |
// add-ons
|
indvd00m@0
|
44 |
$('.add-on :checkbox').on('click', function () {
|
indvd00m@0
|
45 |
var $this = $(this)
|
indvd00m@0
|
46 |
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
|
indvd00m@0
|
47 |
$(this).parents('.add-on')[method]('active')
|
indvd00m@0
|
48 |
})
|
indvd00m@0
|
49 |
|
indvd00m@0
|
50 |
// add tipsies to grid for scaffolding
|
indvd00m@0
|
51 |
if ($('#gridSystem').length) {
|
indvd00m@0
|
52 |
$('#gridSystem').tooltip({
|
indvd00m@0
|
53 |
selector: '.show-grid > [class*="span"]'
|
indvd00m@0
|
54 |
, title: function () { return $(this).width() + 'px' }
|
indvd00m@0
|
55 |
})
|
indvd00m@0
|
56 |
}
|
indvd00m@0
|
57 |
|
indvd00m@0
|
58 |
// tooltip demo
|
indvd00m@0
|
59 |
$('.tooltip-demo').tooltip({
|
indvd00m@0
|
60 |
selector: "a[data-toggle=tooltip]"
|
indvd00m@0
|
61 |
})
|
indvd00m@0
|
62 |
|
indvd00m@0
|
63 |
$('.tooltip-test').tooltip()
|
indvd00m@0
|
64 |
$('.popover-test').popover()
|
indvd00m@0
|
65 |
|
indvd00m@0
|
66 |
// popover demo
|
indvd00m@0
|
67 |
$("a[data-toggle=popover]")
|
indvd00m@0
|
68 |
.popover()
|
indvd00m@0
|
69 |
.click(function(e) {
|
indvd00m@0
|
70 |
e.preventDefault()
|
indvd00m@0
|
71 |
})
|
indvd00m@0
|
72 |
|
indvd00m@0
|
73 |
// button state demo
|
indvd00m@0
|
74 |
$('#fat-btn')
|
indvd00m@0
|
75 |
.click(function () {
|
indvd00m@0
|
76 |
var btn = $(this)
|
indvd00m@0
|
77 |
btn.button('loading')
|
indvd00m@0
|
78 |
setTimeout(function () {
|
indvd00m@0
|
79 |
btn.button('reset')
|
indvd00m@0
|
80 |
}, 3000)
|
indvd00m@0
|
81 |
})
|
indvd00m@0
|
82 |
|
indvd00m@0
|
83 |
// carousel demo
|
indvd00m@0
|
84 |
$('#myCarousel').carousel()
|
indvd00m@0
|
85 |
|
indvd00m@0
|
86 |
// javascript build logic
|
indvd00m@0
|
87 |
var inputsComponent = $("#components.download input")
|
indvd00m@0
|
88 |
, inputsPlugin = $("#plugins.download input")
|
indvd00m@0
|
89 |
, inputsVariables = $("#variables.download input")
|
indvd00m@0
|
90 |
|
indvd00m@0
|
91 |
// toggle all plugin checkboxes
|
indvd00m@0
|
92 |
$('#components.download .toggle-all').on('click', function (e) {
|
indvd00m@0
|
93 |
e.preventDefault()
|
indvd00m@0
|
94 |
inputsComponent.attr('checked', !inputsComponent.is(':checked'))
|
indvd00m@0
|
95 |
})
|
indvd00m@0
|
96 |
|
indvd00m@0
|
97 |
$('#plugins.download .toggle-all').on('click', function (e) {
|
indvd00m@0
|
98 |
e.preventDefault()
|
indvd00m@0
|
99 |
inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
|
indvd00m@0
|
100 |
})
|
indvd00m@0
|
101 |
|
indvd00m@0
|
102 |
$('#variables.download .toggle-all').on('click', function (e) {
|
indvd00m@0
|
103 |
e.preventDefault()
|
indvd00m@0
|
104 |
inputsVariables.val('')
|
indvd00m@0
|
105 |
})
|
indvd00m@0
|
106 |
|
indvd00m@0
|
107 |
// request built javascript
|
indvd00m@0
|
108 |
$('.download-btn .btn').on('click', function () {
|
indvd00m@0
|
109 |
|
indvd00m@0
|
110 |
var css = $("#components.download input:checked")
|
indvd00m@0
|
111 |
.map(function () { return this.value })
|
indvd00m@0
|
112 |
.toArray()
|
indvd00m@0
|
113 |
, js = $("#plugins.download input:checked")
|
indvd00m@0
|
114 |
.map(function () { return this.value })
|
indvd00m@0
|
115 |
.toArray()
|
indvd00m@0
|
116 |
, vars = {}
|
indvd00m@0
|
117 |
, img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
|
indvd00m@0
|
118 |
|
indvd00m@0
|
119 |
$("#variables.download input")
|
indvd00m@0
|
120 |
.each(function () {
|
indvd00m@0
|
121 |
$(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
|
indvd00m@0
|
122 |
})
|
indvd00m@0
|
123 |
|
indvd00m@0
|
124 |
$.ajax({
|
indvd00m@0
|
125 |
type: 'POST'
|
indvd00m@0
|
126 |
, url: /\?dev/.test(window.location) ? 'http://localhost:3000' : 'http://bootstrap.herokuapp.com'
|
indvd00m@0
|
127 |
, dataType: 'jsonpi'
|
indvd00m@0
|
128 |
, params: {
|
indvd00m@0
|
129 |
js: js
|
indvd00m@0
|
130 |
, css: css
|
indvd00m@0
|
131 |
, vars: vars
|
indvd00m@0
|
132 |
, img: img
|
indvd00m@0
|
133 |
}
|
indvd00m@0
|
134 |
})
|
indvd00m@0
|
135 |
})
|
indvd00m@0
|
136 |
})
|
indvd00m@0
|
137 |
|
indvd00m@0
|
138 |
// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
|
indvd00m@0
|
139 |
$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
|
indvd00m@0
|
140 |
var url = opts.url;
|
indvd00m@0
|
141 |
|
indvd00m@0
|
142 |
return {
|
indvd00m@0
|
143 |
send: function(_, completeCallback) {
|
indvd00m@0
|
144 |
var name = 'jQuery_iframe_' + jQuery.now()
|
indvd00m@0
|
145 |
, iframe, form
|
indvd00m@0
|
146 |
|
indvd00m@0
|
147 |
iframe = $('<iframe>')
|
indvd00m@0
|
148 |
.attr('name', name)
|
indvd00m@0
|
149 |
.appendTo('head')
|
indvd00m@0
|
150 |
|
indvd00m@0
|
151 |
form = $('<form>')
|
indvd00m@0
|
152 |
.attr('method', opts.type) // GET or POST
|
indvd00m@0
|
153 |
.attr('action', url)
|
indvd00m@0
|
154 |
.attr('target', name)
|
indvd00m@0
|
155 |
|
indvd00m@0
|
156 |
$.each(opts.params, function(k, v) {
|
indvd00m@0
|
157 |
|
indvd00m@0
|
158 |
$('<input>')
|
indvd00m@0
|
159 |
.attr('type', 'hidden')
|
indvd00m@0
|
160 |
.attr('name', k)
|
indvd00m@0
|
161 |
.attr('value', typeof v == 'string' ? v : JSON.stringify(v))
|
indvd00m@0
|
162 |
.appendTo(form)
|
indvd00m@0
|
163 |
})
|
indvd00m@0
|
164 |
|
indvd00m@0
|
165 |
form.appendTo('body').submit()
|
indvd00m@0
|
166 |
}
|
indvd00m@0
|
167 |
}
|
indvd00m@0
|
168 |
})
|
indvd00m@0
|
169 |
|
indvd00m@0
|
170 |
}(window.jQuery)
|