PageSourceSearch

https://www.dingcheng.gov.cn/content/_common/base/js/power.pdfpreview.js

js dingcheng.gov.cn collected 2026-10-02 17:07:28 UTC 2,510 bytes, 61 lines download raw bytes

1// PDF 预览
2$(function () {
3    function isIEBrowser() {
4        if (!!window.ActiveXObject || "ActiveXObject" in window) {
5            return true;
6        } else {
7            var isIEBrowser = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
8            if (isIEBrowser) {
9                return true;
10            }
11        }
12        return false;
13    }
14
15    var siteId = window.top.siteId || '1';
16    var disallowSavePdf = window.sessionStorage['disallowSavePdf_' + siteId] === 'true';
17
18    function canUseObjectTag() {
19        // 禁用PDF保存功能的时候,始终返回false
20        if (disallowSavePdf || isIEBrowser()) {
21            return false;
22        }
23
24        var ua = navigator.userAgent;
25        // 排除微信浏览器
26        if (/WindowsWechat/i.test(ua) || /MicroMessenger/i.test(ua)) {
27            return false;
28        }
29        return !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);
30    }
31    //遍历所有pdf类型标签
32    // HTML5 方式
33    if (canUseObjectTag()) {
34        $("[data-uitype ='pdf']")
35            .each(function () {
36                var url = $(this).attr("data-powerurl").toLowerCase(); //获取当前pdf文件路径
37                var pdfElement = document.createElement('object');
38                pdfElement.setAttribute('type', 'application/pdf');
39                var height = window.innerHeight > 750 ? '750px' : '100%';
40                pdfElement.setAttribute('style', 'width:100%;height:' + height + ';min-height:600px;margin-top:15px;margin-left:0px;');
41                pdfElement.setAttribute('internalinstanceid', '11');
42                pdfElement.setAttribute('data', url);
43                var p = $(this).parent();
44                p.append(pdfElement);
45                $(this).remove();
46            });
47        return;
48    }
49
50    // IE、移动端,pdfjs
51    $("[data-uitype ='pdf']")
52        .each(function () {
53            var url = $(this).attr("data-powerurl"); //获取当前pdf文件路径
54            var ran = Math.floor(Math.random() * 100); //生成随机数
55            $(this).removeAttr("src");
56            var height = window.innerHeight > 750 ? '750' : '100%';
57            var frame = '<iframe src="/content/_common/base/pdfjs/web/viewer.html?file=' + url + '" frameborder="0" width="100%" height="' + height + '" style="min-height:600px;margin-top:15px;margin-left:0px;"></iframe>';
58            $(this)[0].insertAdjacentHTML("afterEnd", frame);
59            $(this).remove();
60        });
61});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.