fix game data upload button :|

add padding to bottom of sections properly
This commit is contained in:
synth-ruiner 2018-03-03 14:40:57 +00:00
parent fa86712137
commit a278c99316
2 changed files with 26 additions and 8 deletions

View File

@ -217,21 +217,26 @@ $(document).ready(function() {
$('input[name="id"][value="' + palette.id + '"]').siblings(':radio').trigger('click'); $('input[name="id"][value="' + palette.id + '"]').siblings(':radio').trigger('click');
} }
function readFile(input) { function readFile(input, callback) {
if (input.files && input.files[0]) { if (input.files && input.files[0]) {
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function (e) { reader.onload = callback;
$croppie.croppie('bind', {
url: e.target.result,
zoom: 0
});
};
reader.readAsDataURL(input.files[0]); reader.readAsDataURL(input.files[0]);
} }
} }
function readTextFile(input, callback) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = callback;
reader.readAsText(input.files[0]);
}
}
function render() { function render() {
$croppie.croppie('result', { $croppie.croppie('result', {
type: 'rawcanvas', type: 'rawcanvas',
@ -424,7 +429,19 @@ $(document).ready(function() {
handleBitsyGameData(); handleBitsyGameData();
$('#imageUpload').on('change', function () { $('#imageUpload').on('change', function () {
readFile(this); readFile(this, function (e) {
$croppie.croppie('bind', {
url: e.target.result,
zoom: 0
});
});
});
$('input.game-data').on('change', function() {
readTextFile(this, function (e) {
$bitsyData.val(e.target.result);
handleBitsyGameData();
});
}); });
// these inputs get added and removed from the DOM so the event handler needs to be on the document // these inputs get added and removed from the DOM so the event handler needs to be on the document

View File

@ -84,6 +84,7 @@ input {
background-color: #d3cbd0; background-color: #d3cbd0;
color: #594a54; color: #594a54;
width: 256px; width: 256px;
padding-bottom: 1em;
} }
#brightness { #brightness {
width: 256px; width: 256px;