Skip to content
Permalink
Browse files

Fix sprite image uploading

  • Loading branch information...
SeinopSys committed May 7, 2019
1 parent 4cb9c00 commit eb597998237ed86554e6592dd20638e340ea006c
@@ -32,7 +32,7 @@
$input.prev().attr('href', response.path).children('img').fadeTo(200,0,function(){
let $image = $(this);
$this.addClass('loading');
$image.attr('src',response.path).on('load',function(){
$image.attr({ src: response.path, alt: '' }).on('load',function(){
$this.removeClass('loading');
$image.fadeTo(200,1);
});
@@ -63,7 +63,6 @@

let fd = new FormData();
fd.append(opt.requestKey, files[0]);
fd.append('CSRF_TOKEN', $.getCSRFToken());

let ajaxOpts = {
url: opt.target,
@@ -1875,11 +1875,12 @@
let title = 'Upload sprite image',
$uploadInput = $this.find('input[type="file"]');
$.Dialog.request(title,$SpriteUploadFormTemplate.clone(),'Download image', function($form){
let $image_url = $form.find('input[name=image_url]');
const $image_url = $form.find('input[name=image_url]');
$form.find('.upload-link').on('click', function(e){
e.preventDefault();
e.stopPropagation();

$.Dialog.close();
$uploadInput.trigger('click', [true]);
});
if (PersonalGuide)
@@ -391,6 +391,9 @@
r.push(`CSRF_TOKEN=${t}`);
event.data = r.join("&");
}
else if (event.data instanceof FormData) {
event.data.append('CSRF_TOKEN', t);
}
else event.data = { ...event.data, CSRF_TOKEN: t };
});
const simpleStatusHandler = xhr => {
@@ -1,4 +1,3 @@

.upload-wrap {
position: relative;
overflow: hidden;
@@ -11,6 +10,12 @@
&:before, &:after { opacity: 1 }
}

> a {
&, & > img {
display: block;
}
}

> input[type=file] {
position: absolute !important;
top: 0;

0 comments on commit eb59799

Please sign in to comment.
You can’t perform that action at this time.