@@ -32,12 +32,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
32
32
throw err
33
33
}
34
34
35
- function showSuccess ( msg ) {
36
- $ ( '<div class="bs-callout bs-callout-info">' +
37
- '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + msg +
38
- '</div>' ) . insertAfter ( '.bs-customize-download' )
39
- }
40
-
41
35
function showAlert ( type , msg , insertAfter ) {
42
36
$ ( '<div class="alert alert-' + type + '">' + msg + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>' )
43
37
. insertAfter ( insertAfter )
@@ -49,42 +43,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
49
43
return match && decodeURIComponent ( match [ 1 ] . replace ( / \+ / g, ' ' ) )
50
44
}
51
45
52
- function createGist ( configJson , callback ) {
53
- var data = {
54
- description : 'Bootstrap Customizer Config' ,
55
- 'public' : true ,
56
- files : {
57
- 'config.json' : {
58
- content : configJson
59
- }
60
- }
61
- }
62
- $ . ajax ( {
63
- url : 'https://api.github.com/gists' ,
64
- type : 'POST' ,
65
- contentType : 'application/json; charset=UTF-8' ,
66
- dataType : 'json' ,
67
- data : JSON . stringify ( data )
68
- } )
69
- . success ( function ( result ) {
70
- var gistUrl = result . html_url ;
71
- var origin = window . location . protocol + '//' + window . location . host
72
- var customizerUrl = origin + window . location . pathname + '?id=' + result . id
73
- showSuccess ( '<strong>Success!</strong> Your configuration has been saved to <a href="' + gistUrl + '">' + gistUrl + '</a> ' +
74
- 'and can be revisited here at <a href="' + customizerUrl + '">' + customizerUrl + '</a> for further customization.' )
75
- history . replaceState ( false , document . title , customizerUrl )
76
- callback ( gistUrl , customizerUrl )
77
- } )
78
- . error ( function ( err ) {
79
- try {
80
- showError ( '<strong>Ruh roh!</strong> Could not save gist file, configuration not saved.' , err )
81
- } catch ( sameErr ) {
82
- // deliberately ignore the error
83
- }
84
- callback ( '<none>' , '<none>' )
85
- } )
86
- }
87
-
88
46
function getCustomizerData ( ) {
89
47
var vars = { }
90
48
@@ -252,8 +210,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
252
210
return promise . reject ( parseErr )
253
211
}
254
212
try {
255
- intoResult [ baseFilename + '.css' ] = cw + tree . toCSS ( )
256
- intoResult [ baseFilename + '.min.css' ] = cw + tree . toCSS ( { compress : true } )
213
+ intoResult [ baseFilename + '.css' ] = tree . toCSS ( )
214
+ intoResult [ baseFilename + '.min.css' ] = tree . toCSS ( { compress : true } )
257
215
} catch ( compileErr ) {
258
216
return promise . reject ( compileErr )
259
217
}
@@ -335,7 +293,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
335
293
. toArray ( )
336
294
. join ( '\n' )
337
295
338
- preamble = cw + preamble
296
+ preamble = preamble + cw
339
297
js = jqueryCheck + jqueryVersionCheck + js
340
298
341
299
return {
@@ -437,21 +395,19 @@ window.onload = function () { // wait for load in a dumb way because B-0
437
395
var $compileBtn = $ ( '#btn-compile' )
438
396
439
397
$compileBtn . on ( 'click' , function ( e ) {
440
- var configData = getCustomizerData ( )
441
- var configJson = JSON . stringify ( configData , null , 2 )
442
-
443
398
e . preventDefault ( )
444
399
445
400
$compileBtn . attr ( 'disabled' , 'disabled' )
446
401
447
- createGist ( configJson , function ( gistUrl , customizerUrl ) {
448
- configData . customizerUrl = customizerUrl
449
- configJson = JSON . stringify ( configData , null , 2 )
402
+ function generate ( ) {
403
+ var configData = getCustomizerData ( )
404
+ var configJson = JSON . stringify ( configData , null , 2 )
405
+ var origin = window . location . protocol + '//' + window . location . host
406
+ var customizerUrl = origin + window . location . pathname
450
407
451
408
var preamble = '/*!\n' +
452
409
' * Generated using the Bootstrap Customizer (' + customizerUrl + ')\n' +
453
- ' * Config saved to config.json and ' + gistUrl + '\n' +
454
- ' */\n'
410
+ ' */\n\n'
455
411
456
412
$ . when (
457
413
generateCSS ( preamble ) ,
@@ -465,7 +421,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
465
421
} , 0 )
466
422
} )
467
423
} )
468
- } )
424
+ }
425
+
426
+ generate ( )
469
427
} ) ;
470
428
471
429
parseUrl ( )
0 commit comments