-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
I created a new js function on the elfinder.min.js file :
elFinder.prototype.commands.importimage = function () {
this.shortcuts = [{
pattern: ""
}], this.getstate = function (b) {
var c = this.fm;
return b = b || c.selected(), !this._disabled && b.length && a.map(b, function (a) {
var b = c.file(a);
return b && b.phash && !b.locked ? a : null
}).length == b.length ? 0 : -1
},
this.exec = function (b) {
// Grise le bouton pour empecher les clics multiples
$('div[title="Insertion"]').addClass("ui-state-disabled");
var c = this,
d = this.fm,
e = a.Deferred().fail(function (a) {
a && d.error(a)
}),
f = this.files(b),
g = f.length,
h = d.cwd().hash,
i = !1,
j = f[0].name;
return this._disabled ? e.reject() : (a.each(f, function (a, b) {
if (!b.phash) return !e.reject(["errImportJpeg", b.name, "errPerm"]);
if (b.locked) return !e.reject(["errLocked", b.name]);
b.hash == h && (i = d.root(b.hash))
}), e.isRejected() || (f = this.hashes(b), d.confirm({
title: d.i18n(c.title),
text: d.i18n(["confirmInsert", j, "confirm"]),
accept: {
label: "btnYes",
callback: function () {
d.lockfiles({
files: f
}), d.request({
data: {
cmd: "importimage ",
targets: f,
current: h
},
notify: {
type: "mkfile",
cnt: g
},
preventFail: !0
}).fail(function (a) {
if(a == "ERREUR_CONCURRENCE") {
alert("error");
window.location.href = document.getElementById('navAccueil').href;
} else {
e.reject(a);
}
}).done(function (a) {
alert(a);
elFinderDone(a, 'importimage ');
}).always(function () {
d.unlockfiles({
files: f
})
})
}
},
cancel: {
label: "btnNo",
callback: function () {
e.reject()
}
}
})), e)
}
}
I need to get the data in the response to display them in a popup. The following code :
.done(function (a) {
alert(a);
elFinderDone(a, 'importimage ');
})
returns the following error " Syntax Error: Invalid character" when parsing the "a" argument of "elFinderDone(a, 'importimage ');" :
var obj = JSON.parse(a);
So my question is : how to get the json data correctly ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels