|
|
@ -1511,26 +1511,38 @@ define([
|
|
|
|
var _mediasSources = getMediasSources();
|
|
|
|
var _mediasSources = getMediasSources();
|
|
|
|
var images = _obj.data || [];
|
|
|
|
var images = _obj.data || [];
|
|
|
|
if (!Array.isArray(images)) { return; }
|
|
|
|
if (!Array.isArray(images)) { return; }
|
|
|
|
var urls = images.map(function (name) {
|
|
|
|
var urls = [];
|
|
|
|
var data = _mediasSources[name];
|
|
|
|
nThen(function (waitFor) {
|
|
|
|
if (!data) { return; }
|
|
|
|
images.forEach(function (name) {
|
|
|
|
var media = mediasData[data.src];
|
|
|
|
if (/^data\:image/.test(name)) {
|
|
|
|
if (!media) { return; }
|
|
|
|
Util.fetch(name, waitFor(function (err, u8) {
|
|
|
|
return {
|
|
|
|
if (err) { return; }
|
|
|
|
path: name,
|
|
|
|
var b = new Blob([u8]);
|
|
|
|
url: media.blobUrl,
|
|
|
|
urls.push(URL.createObjectURL(b));
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
}).filter(Boolean);
|
|
|
|
return;
|
|
|
|
send({
|
|
|
|
}
|
|
|
|
type: "documentOpen",
|
|
|
|
var data = _mediasSources[name];
|
|
|
|
data: {
|
|
|
|
if (!data) { return; }
|
|
|
|
type: "imgurls",
|
|
|
|
var media = mediasData[data.src];
|
|
|
|
status: "ok",
|
|
|
|
if (!media) { return; }
|
|
|
|
|
|
|
|
urls.push({
|
|
|
|
|
|
|
|
path: name,
|
|
|
|
|
|
|
|
url: media.blobUrl,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}).nThen(function () {
|
|
|
|
|
|
|
|
send({
|
|
|
|
|
|
|
|
type: "documentOpen",
|
|
|
|
data: {
|
|
|
|
data: {
|
|
|
|
urls: urls,
|
|
|
|
type: "imgurls",
|
|
|
|
error: 0
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
urls: urls,
|
|
|
|
|
|
|
|
error: 0
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|