From: XhmikosR Date: Wed, 19 Sep 2018 10:33:58 +0000 (+0300) Subject: customizer: remove gist creation. X-Git-Tag: v3.4.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7ab2fbd5b2368f4b3e93df0c2a39a4fed59bc6f;p=thirdparty%2Fbootstrap.git customizer: remove gist creation. GitHub removed anonymous gist creation a few months ago. https://blog.github.com/2018-02-18-deprecation-notice-removing-anonymous-gist-creation/ --- diff --git a/docs/assets/js/src/customizer.js b/docs/assets/js/src/customizer.js index 9f07da58b7..0909b85461 100644 --- a/docs/assets/js/src/customizer.js +++ b/docs/assets/js/src/customizer.js @@ -32,12 +32,6 @@ window.onload = function () { // wait for load in a dumb way because B-0 throw err } - function showSuccess(msg) { - $('
' + - '' + msg + - '
').insertAfter('.bs-customize-download') - } - function showAlert(type, msg, insertAfter) { $('
' + msg + '
') .insertAfter(insertAfter) @@ -49,42 +43,6 @@ window.onload = function () { // wait for load in a dumb way because B-0 return match && decodeURIComponent(match[1].replace(/\+/g, ' ')) } - function createGist(configJson, callback) { - var data = { - description: 'Bootstrap Customizer Config', - 'public': true, - files: { - 'config.json': { - content: configJson - } - } - } - $.ajax({ - url: 'https://api.github.com/gists', - type: 'POST', - contentType: 'application/json; charset=UTF-8', - dataType: 'json', - data: JSON.stringify(data) - }) - .success(function (result) { - var gistUrl = result.html_url; - var origin = window.location.protocol + '//' + window.location.host - var customizerUrl = origin + window.location.pathname + '?id=' + result.id - showSuccess('Success! Your configuration has been saved to ' + gistUrl + ' ' + - 'and can be revisited here at ' + customizerUrl + ' for further customization.') - history.replaceState(false, document.title, customizerUrl) - callback(gistUrl, customizerUrl) - }) - .error(function (err) { - try { - showError('Ruh roh! Could not save gist file, configuration not saved.', err) - } catch (sameErr) { - // deliberately ignore the error - } - callback('', '') - }) - } - function getCustomizerData() { var vars = {} @@ -252,8 +210,8 @@ window.onload = function () { // wait for load in a dumb way because B-0 return promise.reject(parseErr) } try { - intoResult[baseFilename + '.css'] = cw + tree.toCSS() - intoResult[baseFilename + '.min.css'] = cw + tree.toCSS({ compress: true }) + intoResult[baseFilename + '.css'] = tree.toCSS() + intoResult[baseFilename + '.min.css'] = tree.toCSS({ compress: true }) } catch (compileErr) { return promise.reject(compileErr) } @@ -335,7 +293,7 @@ window.onload = function () { // wait for load in a dumb way because B-0 .toArray() .join('\n') - preamble = cw + preamble + preamble = preamble + cw js = jqueryCheck + jqueryVersionCheck + js return { @@ -437,21 +395,19 @@ window.onload = function () { // wait for load in a dumb way because B-0 var $compileBtn = $('#btn-compile') $compileBtn.on('click', function (e) { - var configData = getCustomizerData() - var configJson = JSON.stringify(configData, null, 2) - e.preventDefault() $compileBtn.attr('disabled', 'disabled') - createGist(configJson, function (gistUrl, customizerUrl) { - configData.customizerUrl = customizerUrl - configJson = JSON.stringify(configData, null, 2) + function generate() { + var configData = getCustomizerData() + var configJson = JSON.stringify(configData, null, 2) + var origin = window.location.protocol + '//' + window.location.host + var customizerUrl = origin + window.location.pathname var preamble = '/*!\n' + ' * Generated using the Bootstrap Customizer (' + customizerUrl + ')\n' + - ' * Config saved to config.json and ' + gistUrl + '\n' + - ' */\n' + ' */\n\n' $.when( generateCSS(preamble), @@ -465,7 +421,9 @@ window.onload = function () { // wait for load in a dumb way because B-0 }, 0) }) }) - }) + } + + generate() }); parseUrl()