让layer.photos显示pdf文件

上次针对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("&#x6CA1;&#x6709;&#x56FE;&#x7247;")
            } 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值