twigg-app 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/assets/javascripts/_bootstrap.js +7 -0
  3. data/assets/javascripts/_jquery.js +19 -0
  4. data/assets/javascripts/_tables.js +3 -0
  5. data/assets/javascripts/_views.js +10 -0
  6. data/assets/javascripts/application.js +9 -0
  7. data/{public/application.js → assets/javascripts/views/_commit_set_bar_chart.js} +32 -34
  8. data/assets/javascripts/views/_russia.js +61 -0
  9. data/assets/javascripts/views/_tags.js +56 -0
  10. data/assets/javascripts/views/_tags_word_cloud.js +51 -0
  11. data/assets/stylesheets/_bootstrap_overrides.scss +15 -0
  12. data/assets/stylesheets/_footer.scss +28 -0
  13. data/assets/stylesheets/_global.scss +14 -0
  14. data/assets/stylesheets/_tables.scss +20 -0
  15. data/assets/stylesheets/application.scss +10 -0
  16. data/assets/stylesheets/d3/_bar_chart.scss +25 -0
  17. data/assets/stylesheets/d3/_bubble_chart.scss +22 -0
  18. data/lib/twigg-app/app/routes.rb +4 -0
  19. data/lib/twigg-app/app/server.rb +78 -21
  20. data/lib/twigg-app/app/version.rb +1 -1
  21. data/public/vendor/bootstrap/Gruntfile.js +32 -10
  22. data/public/vendor/bootstrap/README.md +2 -0
  23. data/public/vendor/bootstrap/_config.yml +5 -10
  24. data/public/vendor/bootstrap/_includes/footer.html +2 -1
  25. data/public/vendor/bootstrap/_includes/nav-components.html +33 -31
  26. data/public/vendor/bootstrap/_includes/nav-css.html +32 -22
  27. data/public/vendor/bootstrap/_includes/nav-getting-started.html +17 -1
  28. data/public/vendor/bootstrap/_includes/nav-javascript.html +1 -1
  29. data/public/vendor/bootstrap/_includes/nav-main.html +1 -1
  30. data/public/vendor/bootstrap/_includes/social-buttons.html +1 -1
  31. data/public/vendor/bootstrap/_layouts/default.html +18 -14
  32. data/public/vendor/bootstrap/_layouts/home.html +9 -6
  33. data/public/vendor/bootstrap/assets/css/docs.css +584 -396
  34. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  35. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  36. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  37. data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  38. data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
  39. data/public/vendor/bootstrap/assets/js/application.js +2 -1
  40. data/public/vendor/bootstrap/assets/js/customizer.js +160 -45
  41. data/public/vendor/bootstrap/assets/js/filesaver.js +169 -0
  42. data/public/vendor/bootstrap/assets/js/jquery.js +6 -5
  43. data/public/vendor/bootstrap/assets/js/raw-files.js +3 -0
  44. data/public/vendor/bootstrap/bower.json +1 -1
  45. data/public/vendor/bootstrap/components.html +787 -364
  46. data/public/vendor/bootstrap/composer.json +1 -1
  47. data/public/vendor/bootstrap/css.html +413 -248
  48. data/public/vendor/bootstrap/customize.html +413 -447
  49. data/public/vendor/bootstrap/dist/css/bootstrap-theme.css +384 -0
  50. data/public/vendor/bootstrap/dist/css/bootstrap-theme.min.css +1 -0
  51. data/public/vendor/bootstrap/dist/css/bootstrap.css +3033 -1807
  52. data/public/vendor/bootstrap/dist/css/bootstrap.min.css +1 -1
  53. data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  54. data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +228 -0
  55. data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  56. data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  57. data/public/vendor/bootstrap/dist/js/bootstrap.js +18 -12
  58. data/public/vendor/bootstrap/dist/js/bootstrap.min.js +1 -1
  59. data/public/vendor/bootstrap/examples/carousel/carousel.css +128 -0
  60. data/public/vendor/bootstrap/examples/carousel/index.html +201 -0
  61. data/public/vendor/bootstrap/examples/grid/grid.css +28 -0
  62. data/public/vendor/bootstrap/examples/grid/index.html +119 -0
  63. data/public/vendor/bootstrap/examples/jumbotron/index.html +111 -0
  64. data/public/vendor/bootstrap/examples/jumbotron/jumbotron.css +5 -0
  65. data/public/vendor/bootstrap/examples/jumbotron-narrow/index.html +78 -0
  66. data/public/vendor/bootstrap/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
  67. data/public/vendor/bootstrap/examples/justified-nav/index.html +79 -0
  68. data/public/vendor/bootstrap/examples/justified-nav/justified-nav.css +88 -0
  69. data/public/vendor/bootstrap/examples/navbar/index.html +83 -0
  70. data/public/vendor/bootstrap/examples/navbar/navbar.css +7 -0
  71. data/public/vendor/bootstrap/examples/navbar-fixed-top/index.html +86 -0
  72. data/public/vendor/bootstrap/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
  73. data/public/vendor/bootstrap/examples/navbar-static-top/index.html +87 -0
  74. data/public/vendor/bootstrap/examples/navbar-static-top/navbar-static-top.css +7 -0
  75. data/public/vendor/bootstrap/examples/non-responsive/index.html +96 -0
  76. data/public/vendor/bootstrap/examples/non-responsive/non-responsive.css +117 -0
  77. data/public/vendor/bootstrap/examples/offcanvas/index.html +127 -0
  78. data/public/vendor/bootstrap/examples/offcanvas/offcanvas.css +48 -0
  79. data/public/vendor/bootstrap/examples/offcanvas/offcanvas.js +5 -0
  80. data/public/vendor/bootstrap/examples/screenshots/carousel.jpg +0 -0
  81. data/public/vendor/bootstrap/examples/screenshots/grid.jpg +0 -0
  82. data/public/vendor/bootstrap/examples/screenshots/jumbotron-narrow.jpg +0 -0
  83. data/public/vendor/bootstrap/examples/screenshots/jumbotron.jpg +0 -0
  84. data/public/vendor/bootstrap/examples/screenshots/justified-nav.jpg +0 -0
  85. data/public/vendor/bootstrap/examples/screenshots/navbar-fixed.jpg +0 -0
  86. data/public/vendor/bootstrap/examples/screenshots/navbar-static.jpg +0 -0
  87. data/public/vendor/bootstrap/examples/screenshots/navbar.jpg +0 -0
  88. data/public/vendor/bootstrap/examples/screenshots/non-responsive.jpg +0 -0
  89. data/public/vendor/bootstrap/examples/screenshots/offcanvas.jpg +0 -0
  90. data/public/vendor/bootstrap/examples/screenshots/sign-in.jpg +0 -0
  91. data/public/vendor/bootstrap/examples/screenshots/starter-template.jpg +0 -0
  92. data/public/vendor/bootstrap/examples/screenshots/sticky-footer-navbar.jpg +0 -0
  93. data/public/vendor/bootstrap/examples/screenshots/sticky-footer.jpg +0 -0
  94. data/public/vendor/bootstrap/examples/screenshots/theme.jpg +0 -0
  95. data/public/vendor/bootstrap/examples/signin/index.html +46 -0
  96. data/public/vendor/bootstrap/examples/signin/signin.css +40 -0
  97. data/public/vendor/bootstrap/examples/starter-template/index.html +63 -0
  98. data/public/vendor/bootstrap/examples/starter-template/starter-template.css +7 -0
  99. data/public/vendor/bootstrap/examples/sticky-footer/index.html +51 -0
  100. data/public/vendor/bootstrap/examples/sticky-footer/sticky-footer.css +39 -0
  101. data/public/vendor/bootstrap/examples/sticky-footer-navbar/index.html +86 -0
  102. data/public/vendor/bootstrap/examples/sticky-footer-navbar/sticky-footer-navbar.css +46 -0
  103. data/public/vendor/bootstrap/examples/theme/index.html +387 -0
  104. data/public/vendor/bootstrap/examples/theme/theme.css +14 -0
  105. data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  106. data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +228 -0
  107. data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  108. data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  109. data/public/vendor/bootstrap/getting-started.html +513 -22
  110. data/public/vendor/bootstrap/index.html +3 -4
  111. data/public/vendor/bootstrap/javascript.html +123 -115
  112. data/public/vendor/bootstrap/js/dropdown.js +3 -3
  113. data/public/vendor/bootstrap/js/modal.js +5 -3
  114. data/public/vendor/bootstrap/js/tests/unit/modal.js +19 -0
  115. data/public/vendor/bootstrap/js/tests/vendor/jquery.js +6 -5
  116. data/public/vendor/bootstrap/js/tooltip.js +9 -5
  117. data/public/vendor/bootstrap/js/transition.js +1 -1
  118. data/public/vendor/bootstrap/less/alerts.less +7 -11
  119. data/public/vendor/bootstrap/less/bootstrap.less +17 -21
  120. data/public/vendor/bootstrap/less/button-groups.less +14 -10
  121. data/public/vendor/bootstrap/less/buttons.less +3 -2
  122. data/public/vendor/bootstrap/less/carousel.less +6 -1
  123. data/public/vendor/bootstrap/less/dropdowns.less +22 -5
  124. data/public/vendor/bootstrap/less/forms.less +36 -15
  125. data/public/vendor/bootstrap/less/glyphicons.less +232 -0
  126. data/public/vendor/bootstrap/less/grid.less +9 -3
  127. data/public/vendor/bootstrap/less/input-groups.less +1 -1
  128. data/public/vendor/bootstrap/less/jumbotron.less +16 -5
  129. data/public/vendor/bootstrap/less/labels.less +9 -5
  130. data/public/vendor/bootstrap/less/mixins.less +73 -43
  131. data/public/vendor/bootstrap/less/modals.less +8 -0
  132. data/public/vendor/bootstrap/less/navbar.less +251 -189
  133. data/public/vendor/bootstrap/less/navs.less +13 -12
  134. data/public/vendor/bootstrap/less/pager.less +1 -1
  135. data/public/vendor/bootstrap/less/pagination.less +20 -9
  136. data/public/vendor/bootstrap/less/panels.less +28 -8
  137. data/public/vendor/bootstrap/less/progress-bars.less +6 -10
  138. data/public/vendor/bootstrap/less/responsive-utilities.less +120 -49
  139. data/public/vendor/bootstrap/less/scaffolding.less +37 -18
  140. data/public/vendor/bootstrap/less/tables.less +84 -59
  141. data/public/vendor/bootstrap/less/theme.less +232 -0
  142. data/public/vendor/bootstrap/less/thumbnails.less +8 -19
  143. data/public/vendor/bootstrap/less/type.less +2 -2
  144. data/public/vendor/bootstrap/less/variables.less +63 -50
  145. data/public/vendor/bootstrap/package.json +2 -1
  146. data/public/vendor/components-backbone/LICENSE +22 -0
  147. data/public/vendor/components-backbone/README.md +10 -0
  148. data/public/vendor/components-backbone/backbone-min.js +4 -0
  149. data/public/vendor/components-backbone/backbone.js +1571 -0
  150. data/public/vendor/components-backbone/bower.json +17 -0
  151. data/public/vendor/components-backbone/component.json +21 -0
  152. data/public/vendor/components-backbone/composer.json +37 -0
  153. data/public/vendor/components-backbone/package.json +24 -0
  154. data/public/vendor/d3.layout.cloud.js +401 -0
  155. data/public/vendor/replacejs/CHANGELOG.md +4 -0
  156. data/public/vendor/replacejs/replace.js +21 -2
  157. data/public/vendor/underscore/CNAME +1 -0
  158. data/public/vendor/underscore/CONTRIBUTING.md +9 -0
  159. data/public/vendor/underscore/LICENSE +22 -0
  160. data/public/vendor/underscore/README.md +19 -0
  161. data/public/vendor/underscore/Rakefile +10 -0
  162. data/public/vendor/underscore/docs/docco.css +192 -0
  163. data/public/vendor/underscore/docs/favicon.ico +0 -0
  164. data/public/vendor/underscore/docs/images/background.png +0 -0
  165. data/public/vendor/underscore/docs/images/underscore.png +0 -0
  166. data/public/vendor/underscore/docs/underscore.html +823 -0
  167. data/public/vendor/underscore/favicon.ico +0 -0
  168. data/public/vendor/underscore/index.html +2467 -0
  169. data/public/vendor/underscore/index.js +1 -0
  170. data/public/vendor/underscore/package.json +16 -0
  171. data/public/vendor/underscore/test/arrays.js +200 -0
  172. data/public/vendor/underscore/test/chaining.js +59 -0
  173. data/public/vendor/underscore/test/collections.js +453 -0
  174. data/public/vendor/underscore/test/functions.js +265 -0
  175. data/public/vendor/underscore/test/index.html +44 -0
  176. data/public/vendor/underscore/test/objects.js +570 -0
  177. data/public/vendor/underscore/test/speed.js +75 -0
  178. data/public/vendor/underscore/test/utility.js +266 -0
  179. data/public/vendor/underscore/test/vendor/jquery.js +9404 -0
  180. data/public/vendor/underscore/test/vendor/jslitmus.js +670 -0
  181. data/public/vendor/underscore/test/vendor/qunit.css +235 -0
  182. data/public/vendor/underscore/test/vendor/qunit.js +1977 -0
  183. data/public/vendor/underscore/test/vendor/runner.js +98 -0
  184. data/public/vendor/underscore/underscore-min.js +1 -0
  185. data/public/vendor/underscore/underscore.js +1226 -0
  186. data/views/dashboard.haml +1 -1
  187. data/views/layout.haml +8 -4
  188. metadata +132 -25
  189. data/public/vendor/bootstrap/_layouts/customize.html +0 -52
  190. data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +0 -1287
  191. data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +0 -3
  192. data/public/vendor/bootstrap-glyphicons/CNAME +0 -1
  193. data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +0 -54
  194. data/public/vendor/bootstrap-glyphicons/LICENSE +0 -19
  195. data/public/vendor/bootstrap-glyphicons/README.md +0 -61
  196. data/public/vendor/bootstrap-glyphicons/_config.yml +0 -12
  197. data/public/vendor/bootstrap-glyphicons/composer.json +0 -9
  198. data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +0 -2
  199. data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +0 -9
  200. data/public/vendor/bootstrap-glyphicons/css/docs.css +0 -160
  201. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
  202. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
  203. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +0 -175
  204. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
  205. data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
  206. data/public/vendor/bootstrap-glyphicons/index.html +0 -255
  207. data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +0 -201
  208. data/public/vendor/bootstrap-glyphicons/package.json +0 -18
@@ -50,7 +50,8 @@
50
50
 
51
51
  // tooltip demo
52
52
  $('.tooltip-demo').tooltip({
53
- selector: "[data-toggle=tooltip]"
53
+ selector: "[data-toggle=tooltip]",
54
+ container: "body"
54
55
  })
55
56
 
56
57
  $('.tooltip-test').tooltip()
@@ -1,7 +1,61 @@
1
1
  window.onload = function () { // wait for load in a dumb way because B-0
2
- var cw = '/*!\n * Bootstrap v3.0.0-rc.2\n *\n * Copyright 2013 Twitter, Inc\n * Licensed under the Apache License v2.0\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Designed and built with all the love in the world @twitter by @mdo and @fat.\n */\n\n'
2
+ var cw = '/*!\n * Bootstrap v3.0.0\n *\n * Copyright 2013 Twitter, Inc\n * Licensed under the Apache License v2.0\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Designed and built with all the love in the world @twitter by @mdo and @fat.\n */\n\n'
3
+
4
+ function showError(msg, err) {
5
+ $('<div id="bsCustomizerAlert" class="bs-customizer-alert">\
6
+ <div class="container">\
7
+ <a href="#bsCustomizerAlert" data-dismiss="alert" class="close pull-right">&times;</a>\
8
+ <p class="bs-customizer-alert-text"><span class="glyphicon glyphicon-warning-sign"></span>' + msg + '</p>' +
9
+ (err.extract ? '<pre class="bs-customizer-alert-extract">' + err.extract.join('\n') + '</pre>' : '') + '\
10
+ </div>\
11
+ </div>').appendTo('body').alert()
12
+ throw err
13
+ }
14
+
15
+ function showCallout(msg, showUpTop) {
16
+ var callout = $('<div class="bs-callout bs-callout-danger">\
17
+ <h4>Attention!</h4>\
18
+ <p>' + msg + '</p>\
19
+ </div>')
20
+
21
+ if (showUpTop) {
22
+ callout.appendTo('.bs-docs-container')
23
+ } else {
24
+ callout.insertAfter('.bs-customize-download')
25
+ }
26
+ }
27
+
28
+ function getQueryParam(key) {
29
+ key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
30
+ var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
31
+ return match && decodeURIComponent(match[1].replace(/\+/g, " "));
32
+ }
3
33
 
4
- function generateUrl() {
34
+ function createGist(configData) {
35
+ var data = {
36
+ "description": "Bootstrap Customizer Config",
37
+ "public": true,
38
+ "files": {
39
+ "config.json": {
40
+ "content": JSON.stringify(configData, null, 2)
41
+ }
42
+ }
43
+ }
44
+ $.ajax({
45
+ url: 'https://api.github.com/gists',
46
+ type: 'POST',
47
+ dataType: 'json',
48
+ data: JSON.stringify(data)
49
+ })
50
+ .success(function(result) {
51
+ history.replaceState(false, document.title, window.location.origin + window.location.pathname + '?id=' + result.id)
52
+ })
53
+ .error(function(err) {
54
+ showError('<strong>Ruh roh!</strong> Could not save gist file, configuration not saved.', err)
55
+ })
56
+ }
57
+
58
+ function getCustomizerData() {
5
59
  var vars = {}
6
60
 
7
61
  $('#less-variables-section input')
@@ -11,39 +65,50 @@ window.onload = function () { // wait for load in a dumb way because B-0
11
65
 
12
66
  var data = {
13
67
  vars: vars,
14
- css: $('#less-section input:not(:checked)').map(function () { return this.value }).toArray(),
15
- js: $('#plugin-section input:not(:checked)').map(function () { return this.value }).toArray()
68
+ css: $('#less-section input:checked') .map(function () { return this.value }).toArray(),
69
+ js: $('#plugin-section input:checked').map(function () { return this.value }).toArray()
16
70
  }
17
71
 
18
72
  if ($.isEmptyObject(data.vars) && !data.css.length && !data.js.length) return
19
73
 
20
- window.location = jQuery.param.querystring('/customize/', data)
74
+ return data
21
75
  }
22
76
 
23
77
  function parseUrl() {
24
- var data = jQuery.deparam.querystring()
78
+ var id = getQueryParam('id')
25
79
 
26
- if (data.js) {
27
- for (var i = 0; i < data.js.length; i++) {
28
- var input = $('input[value="'+data.js[i]+'"]')
29
- input && input.prop('checked', false)
30
- }
31
- }
80
+ if (!id) return
32
81
 
33
- if (data.css) {
34
- for (var i = 0; i < data.css.length; i++) {
35
- var input = $('input[value="'+data.css[i]+'"]')
36
- input && input.prop('checked', false)
82
+ $.ajax({
83
+ url: 'https://api.github.com/gists/' + id,
84
+ type: 'GET',
85
+ dataType: 'json'
86
+ })
87
+ .success(function(result) {
88
+ var data = JSON.parse(result.files['config.json'].content)
89
+ if (data.js) {
90
+ $('#plugin-section input').each(function () {
91
+ $(this).prop('checked', ~$.inArray(this.value, data.js))
92
+ })
37
93
  }
38
- }
39
-
40
- if (data.vars) {
41
- // todo (fat): vars
42
- }
94
+ if (data.css) {
95
+ $('#less-section input').each(function () {
96
+ $(this).prop('checked', ~$.inArray(this.value, data.css))
97
+ })
98
+ }
99
+ if (data.vars) {
100
+ for (var i in data.vars) {
101
+ $('input[data-var="' + i + '"]').val(data.vars[i])
102
+ }
103
+ }
104
+ })
105
+ .error(function(err) {
106
+ showError('Error fetching bootstrap config file', err)
107
+ })
43
108
  }
44
109
 
45
- function generateZip(css, js, complete) {
46
- if (!css && !js) return alert('you want to build nothing… o_O')
110
+ function generateZip(css, js, fonts, complete) {
111
+ if (!css && !js) return showError('<strong>Ruh roh!</strong> No Bootstrap files selected.', new Error('no Bootstrap'))
47
112
 
48
113
  var zip = new JSZip()
49
114
 
@@ -61,11 +126,16 @@ window.onload = function () { // wait for load in a dumb way because B-0
61
126
  }
62
127
  }
63
128
 
64
- var content = zip.generate()
129
+ if (fonts) {
130
+ var fontsFolder = zip.folder('fonts')
131
+ for (var fileName in fonts) {
132
+ fontsFolder.file(fileName, fonts[fileName])
133
+ }
134
+ }
65
135
 
66
- location.href = 'data:application/zip;base64,' + content
136
+ var content = zip.generate({type:"blob"})
67
137
 
68
- complete()
138
+ complete(content)
69
139
  }
70
140
 
71
141
  function generateCustomCSS(vars) {
@@ -78,6 +148,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
78
148
  return result + '\n\n'
79
149
  }
80
150
 
151
+ function generateFonts() {
152
+ var glyphicons = $('#less-section [value="glyphicons.less"]:checked')
153
+ if (glyphicons.length) {
154
+ return __fonts
155
+ }
156
+ }
157
+
81
158
  function generateCSS() {
82
159
  var $checked = $('#less-section input:checked')
83
160
 
@@ -95,6 +172,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
95
172
  css += __less['variables.less']
96
173
  if (vars) css += generateCustomCSS(vars)
97
174
  css += __less['mixins.less']
175
+ css += __less['normalize.less']
176
+ css += __less['scaffolding.less']
98
177
  css += $checked
99
178
  .map(function () { return __less[this.value] })
100
179
  .toArray()
@@ -108,15 +187,16 @@ window.onload = function () { // wait for load in a dumb way because B-0
108
187
  , optimization: 0
109
188
  , filename: 'bootstrap.css'
110
189
  }).parse(css, function (err, tree) {
111
- if (err) return alert(err)
112
-
190
+ if (err) {
191
+ return showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
192
+ }
113
193
  result = {
114
194
  'bootstrap.css' : cw + tree.toCSS(),
115
195
  'bootstrap.min.css' : cw + tree.toCSS({ compress: true })
116
196
  }
117
197
  })
118
198
  } catch (err) {
119
- return alert(err)
199
+ return showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
120
200
  }
121
201
 
122
202
  return result
@@ -137,17 +217,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
137
217
  }
138
218
  }
139
219
 
140
- var $downloadBtn = $('#btn-download').on('click', function (e) {
141
- e.preventDefault()
142
- $downloadBtn.addClass('loading')
143
- generateZip(generateCSS(), generateJavascript(), function () {
144
- $downloadBtn.removeClass('loading')
145
- setTimeout(function () {
146
- generateUrl()
147
- }, 1)
148
- })
149
- })
150
-
151
220
  var inputsComponent = $('#less-section input')
152
221
  var inputsPlugin = $('#plugin-section input')
153
222
  var inputsVariables = $('#less-variables-section input')
@@ -167,9 +236,55 @@ window.onload = function () { // wait for load in a dumb way because B-0
167
236
  inputsVariables.val('')
168
237
  })
169
238
 
170
- try {
171
- parseUrl()
172
- } catch (e) {
173
- // maybe alert user that we can't parse their url
239
+ $('[data-dependencies]').on('click', function () {
240
+ if (!$(this).is(':checked')) return
241
+ var dependencies = this.getAttribute('data-dependencies')
242
+ if (!dependencies) return
243
+ dependencies = dependencies.split(',')
244
+ for (var i = 0; i < dependencies.length; i++) {
245
+ var dependency = $('[value="' + dependencies[i] + '"]')
246
+ dependency && dependency.prop('checked', true)
247
+ }
248
+ })
249
+
250
+ $('[data-dependents]').on('click', function () {
251
+ if ($(this).is(':checked')) return
252
+ var dependents = this.getAttribute('data-dependents')
253
+ if (!dependents) return
254
+ dependents = dependents.split(',')
255
+ for (var i = 0; i < dependents.length; i++) {
256
+ var dependent = $('[value="' + dependents[i] + '"]')
257
+ dependent && dependent.prop('checked', false)
258
+ }
259
+ })
260
+
261
+ var $compileBtn = $('#btn-compile')
262
+ var $downloadBtn = $('#btn-download')
263
+
264
+ $compileBtn.on('click', function (e) {
265
+ e.preventDefault()
266
+
267
+ $compileBtn.attr('disabled', 'disabled')
268
+
269
+ generateZip(generateCSS(), generateJavascript(), generateFonts(), function (blob) {
270
+ $compileBtn.removeAttr('disabled')
271
+ saveAs(blob, "bootstrap.zip")
272
+ createGist(getCustomizerData())
273
+ })
274
+ })
275
+
276
+ // browser support alerts
277
+ if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
278
+ showCallout("Looks like you're using safari, which sadly doesn't have the best support\
279
+ for HTML5 blobs. Because of this your file will be downloaded with the name <code>\"untitled\"</code>.\
280
+ However, if you check your downloads folder, just rename this <code>\"untitled\"</code> file\
281
+ to <code>\"bootstrap.zip\"</code> and you should be good to go!")
282
+ } else if (!window.URL && !window.webkitURL) {
283
+ $('.bs-docs-section, .bs-sidebar').css('display', 'none')
284
+
285
+ showCallout("Looks like your current browser doesn't support the Bootstrap Customizer. Please take a second\
286
+ to <a href=\"https://www.google.com/intl/en/chrome/browser/\"> upgrade to a more modern browser</a>.", true)
174
287
  }
175
- }
288
+
289
+ parseUrl()
290
+ }
@@ -0,0 +1,169 @@
1
+ /* Blob.js
2
+ * A Blob implementation.
3
+ * 2013-06-20
4
+ *
5
+ * By Eli Grey, http://eligrey.com
6
+ * By Devin Samarin, https://github.com/eboyjr
7
+ * License: X11/MIT
8
+ * See LICENSE.md
9
+ */
10
+
11
+ /*global self, unescape */
12
+ /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
13
+ plusplus: true */
14
+
15
+ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
16
+
17
+ if (typeof Blob !== "function" || typeof URL === "undefined")
18
+ if (typeof Blob === "function" && typeof webkitURL !== "undefined") self.URL = webkitURL;
19
+ else var Blob = (function (view) {
20
+ "use strict";
21
+
22
+ var BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || view.MSBlobBuilder || (function(view) {
23
+ var
24
+ get_class = function(object) {
25
+ return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
26
+ }
27
+ , FakeBlobBuilder = function BlobBuilder() {
28
+ this.data = [];
29
+ }
30
+ , FakeBlob = function Blob(data, type, encoding) {
31
+ this.data = data;
32
+ this.size = data.length;
33
+ this.type = type;
34
+ this.encoding = encoding;
35
+ }
36
+ , FBB_proto = FakeBlobBuilder.prototype
37
+ , FB_proto = FakeBlob.prototype
38
+ , FileReaderSync = view.FileReaderSync
39
+ , FileException = function(type) {
40
+ this.code = this[this.name = type];
41
+ }
42
+ , file_ex_codes = (
43
+ "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
44
+ + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
45
+ ).split(" ")
46
+ , file_ex_code = file_ex_codes.length
47
+ , real_URL = view.URL || view.webkitURL || view
48
+ , real_create_object_URL = real_URL.createObjectURL
49
+ , real_revoke_object_URL = real_URL.revokeObjectURL
50
+ , URL = real_URL
51
+ , btoa = view.btoa
52
+ , atob = view.atob
53
+
54
+ , ArrayBuffer = view.ArrayBuffer
55
+ , Uint8Array = view.Uint8Array
56
+ ;
57
+ FakeBlob.fake = FB_proto.fake = true;
58
+ while (file_ex_code--) {
59
+ FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
60
+ }
61
+ if (!real_URL.createObjectURL) {
62
+ URL = view.URL = {};
63
+ }
64
+ URL.createObjectURL = function(blob) {
65
+ var
66
+ type = blob.type
67
+ , data_URI_header
68
+ ;
69
+ if (type === null) {
70
+ type = "application/octet-stream";
71
+ }
72
+ if (blob instanceof FakeBlob) {
73
+ data_URI_header = "data:" + type;
74
+ if (blob.encoding === "base64") {
75
+ return data_URI_header + ";base64," + blob.data;
76
+ } else if (blob.encoding === "URI") {
77
+ return data_URI_header + "," + decodeURIComponent(blob.data);
78
+ } if (btoa) {
79
+ return data_URI_header + ";base64," + btoa(blob.data);
80
+ } else {
81
+ return data_URI_header + "," + encodeURIComponent(blob.data);
82
+ }
83
+ } else if (real_create_object_URL) {
84
+ return real_create_object_URL.call(real_URL, blob);
85
+ }
86
+ };
87
+ URL.revokeObjectURL = function(object_URL) {
88
+ if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
89
+ real_revoke_object_URL.call(real_URL, object_URL);
90
+ }
91
+ };
92
+ FBB_proto.append = function(data/*, endings*/) {
93
+ var bb = this.data;
94
+ // decode data to a binary string
95
+ if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
96
+ var
97
+ str = ""
98
+ , buf = new Uint8Array(data)
99
+ , i = 0
100
+ , buf_len = buf.length
101
+ ;
102
+ for (; i < buf_len; i++) {
103
+ str += String.fromCharCode(buf[i]);
104
+ }
105
+ bb.push(str);
106
+ } else if (get_class(data) === "Blob" || get_class(data) === "File") {
107
+ if (FileReaderSync) {
108
+ var fr = new FileReaderSync;
109
+ bb.push(fr.readAsBinaryString(data));
110
+ } else {
111
+ // async FileReader won't work as BlobBuilder is sync
112
+ throw new FileException("NOT_READABLE_ERR");
113
+ }
114
+ } else if (data instanceof FakeBlob) {
115
+ if (data.encoding === "base64" && atob) {
116
+ bb.push(atob(data.data));
117
+ } else if (data.encoding === "URI") {
118
+ bb.push(decodeURIComponent(data.data));
119
+ } else if (data.encoding === "raw") {
120
+ bb.push(data.data);
121
+ }
122
+ } else {
123
+ if (typeof data !== "string") {
124
+ data += ""; // convert unsupported types to strings
125
+ }
126
+ // decode UTF-16 to binary string
127
+ bb.push(unescape(encodeURIComponent(data)));
128
+ }
129
+ };
130
+ FBB_proto.getBlob = function(type) {
131
+ if (!arguments.length) {
132
+ type = null;
133
+ }
134
+ return new FakeBlob(this.data.join(""), type, "raw");
135
+ };
136
+ FBB_proto.toString = function() {
137
+ return "[object BlobBuilder]";
138
+ };
139
+ FB_proto.slice = function(start, end, type) {
140
+ var args = arguments.length;
141
+ if (args < 3) {
142
+ type = null;
143
+ }
144
+ return new FakeBlob(
145
+ this.data.slice(start, args > 1 ? end : this.data.length)
146
+ , type
147
+ , this.encoding
148
+ );
149
+ };
150
+ FB_proto.toString = function() {
151
+ return "[object Blob]";
152
+ };
153
+ return FakeBlobBuilder;
154
+ }(view));
155
+
156
+ return function Blob(blobParts, options) {
157
+ var type = options ? (options.type || "") : "";
158
+ var builder = new BlobBuilder();
159
+ if (blobParts) {
160
+ for (var i = 0, len = blobParts.length; i < len; i++) {
161
+ builder.append(blobParts[i]);
162
+ }
163
+ }
164
+ return builder.getBlob(type);
165
+ };
166
+ }(self));
167
+
168
+ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
169
+ var saveAs=saveAs||(navigator.msSaveOrOpenBlob&&navigator.msSaveOrOpenBlob.bind(navigator))||(function(h){"use strict";var r=h.document,l=function(){return h.URL||h.webkitURL||h},e=h.URL||h.webkitURL||h,n=r.createElementNS("http://www.w3.org/1999/xhtml","a"),g=!h.externalHost&&"download" in n,j=function(t){var s=r.createEvent("MouseEvents");s.initMouseEvent("click",true,false,h,0,0,0,0,0,false,false,false,false,0,null);t.dispatchEvent(s)},o=h.webkitRequestFileSystem,p=h.requestFileSystem||o||h.mozRequestFileSystem,m=function(s){(h.setImmediate||h.setTimeout)(function(){throw s},0)},c="application/octet-stream",k=0,b=[],i=function(){var t=b.length;while(t--){var s=b[t];if(typeof s==="string"){e.revokeObjectURL(s)}else{s.remove()}}b.length=0},q=function(t,s,w){s=[].concat(s);var v=s.length;while(v--){var x=t["on"+s[v]];if(typeof x==="function"){try{x.call(t,w||t)}catch(u){m(u)}}}},f=function(t,u){var v=this,B=t.type,E=false,x,w,s=function(){var F=l().createObjectURL(t);b.push(F);return F},A=function(){q(v,"writestart progress write writeend".split(" "))},D=function(){if(E||!x){x=s(t)}if(w){w.location.href=x}else{window.open(x,"_blank")}v.readyState=v.DONE;A()},z=function(F){return function(){if(v.readyState!==v.DONE){return F.apply(this,arguments)}}},y={create:true,exclusive:false},C;v.readyState=v.INIT;if(!u){u="download"}if(g){x=s(t);n.href=x;n.download=u;j(n);v.readyState=v.DONE;A();return}if(h.chrome&&B&&B!==c){C=t.slice||t.webkitSlice;t=C.call(t,0,t.size,c);E=true}if(o&&u!=="download"){u+=".download"}if(B===c||o){w=h}if(!p){D();return}k+=t.size;p(h.TEMPORARY,k,z(function(F){F.root.getDirectory("saved",y,z(function(G){var H=function(){G.getFile(u,y,z(function(I){I.createWriter(z(function(J){J.onwriteend=function(K){w.location.href=I.toURL();b.push(I);v.readyState=v.DONE;q(v,"writeend",K)};J.onerror=function(){var K=J.error;if(K.code!==K.ABORT_ERR){D()}};"writestart progress write abort".split(" ").forEach(function(K){J["on"+K]=v["on"+K]});J.write(t);v.abort=function(){J.abort();v.readyState=v.DONE};v.readyState=v.WRITING}),D)}),D)};G.getFile(u,{create:false},z(function(I){I.remove();H()}),z(function(I){if(I.code===I.NOT_FOUND_ERR){H()}else{D()}}))}),D)}),D)},d=f.prototype,a=function(s,t){return new f(s,t)};d.abort=function(){var s=this;s.readyState=s.DONE;q(s,"abort")};d.readyState=d.INIT=0;d.WRITING=1;d.DONE=2;d.error=d.onwritestart=d.onprogress=d.onwrite=d.onabort=d.onerror=d.onwriteend=null;h.addEventListener("unload",i,false);return a}(self));