mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-19 11:52:21 +01:00
port #15031 over again
This commit is contained in:
parent
19ca6389e2
commit
79d0cdbef4
2
assets/js/customize.min.js
vendored
2
assets/js/customize.min.js
vendored
File diff suppressed because one or more lines are too long
@ -359,20 +359,15 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
||||
|
||||
var file = (e.originalEvent.hasOwnProperty('dataTransfer')) ? e.originalEvent.dataTransfer.files[0] : e.originalEvent.target.files[0]
|
||||
|
||||
if (!file.type.match('application/json')) {
|
||||
return showAlert('danger', '<strong>Ruh roh.</strong> We can only read <code>.json</code> files. Please try again.', importDropTarget)
|
||||
}
|
||||
|
||||
var reader = new FileReader()
|
||||
|
||||
reader.onload = (function () {
|
||||
return function (e) {
|
||||
reader.onload = function (e) {
|
||||
var text = e.target.result
|
||||
|
||||
try {
|
||||
var json = JSON.parse(text)
|
||||
|
||||
if (typeof json != 'object') {
|
||||
if (!$.isPlainObject(json)) {
|
||||
throw new Error('JSON data from config file is not an object.')
|
||||
}
|
||||
|
||||
@ -382,9 +377,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
|
||||
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', importDropTarget)
|
||||
}
|
||||
}
|
||||
})(file)
|
||||
|
||||
reader.readAsText(file)
|
||||
reader.readAsText(file, 'utf-8')
|
||||
}
|
||||
|
||||
function handleConfigDragOver(e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user