上次针对layer.photos进行了小图显示不出的修正,现在需要进一步显示pdf文件
需配合pdfobject.js,该文件请自行网上查找
r.photos = function (t, n, a) {
function o(e, t, i) {
var tsrc=e;
var n = new Image;
return n.src = e,
n.complete ? t(n) : (n.onload = function () {
n.onload = null,
t(n)
}, void(n.onerror = function (e) {
//>>Add Mod by Shenjiujun 20220507
if(tsrc.substring(tsrc.lastIndexOf('.') + 1).toLowerCase() =="pdf")
{
t(n);
}
else
{
n.onerror = null,
i(e)
}
//<<Add Mod by Shenjiujun 20220507
}))
}
var l = {};
if (t = t || {}, t.photos) {
var s = t.photos.constructor === Object,
f = s ? t.photos : {},
d = f.data || [],
u = f.start || 0;
if (l.imgIndex = (0 | u) + 1, t.img = t.img || "img", s) {
if (0 === d.length)
return r.msg("没有图片")
} else {
var y = i(t.photos),
p = function () {
d = [],
y.find(t.img).each(function (e) {
var t = i(this);
t.attr("layer-index", e),
d.push({
alt: t.attr("alt"),
pid: t.attr("layer-pid"),
src: t.attr("layer-src") || t.attr("src"),
thumb: t.attr("src")
})
})
};
if (p(), 0 === d.length)
return;
if (n || y.