PageSourceSearch

https://skyworthxr.com/assets/js/statiscs.js

js skyworthxr.com collected 2026-10-07 06:55:26 UTC 3,761 bytes, 122 lines download raw bytes

1/**
2 * [网页用户行为统计,根据url参数 index 判断当前属于第几步,默认第一步为初始化并且获取ID]
3 *
4 */
5let SetDataStatiscs = function () {
6    return new Promise((resolve, reject) => {
7        RouterListener()
8    })
9}
10let referrerListener = () => {
11    let referrer = document.referrer;
12    if (!(referrer.includes('pancakexr'))) {
13        return referrer
14    } else {
15        return ''
16    }
17}
18
19let GetPageRouter = function (str) {
20    const regex = /\/([^\/?#]+)$/; // 匹配最后一个斜杠后面的字符
21    const match = str.match(regex)
22    let fileName = ''
23    if (match) {
24        fileName = match[1]
25    }
26    return fileName
27}
28let setInitServerStatiscs = (pathName, refer, id, index) => { // 0
29    refer = refer == '' ? null : refer
30    if (refer == window.location.href) {
31        return false
32    }
33    console.log(refer)
34    if (refer && refer.includes('skyworthxr.com')) {
35        refer = null
36    }
37    let page = { 1: '1st', 2: "2nd", 3: "3rd" }
38    let params = {
39        id: id || null,
40        chn: 1,
41        source: refer || null
42    }
43    params[`page${page[index]}`] = pathName.replace('PANCAKEXR|', "")
44    params = Object.fromEntries(
45        Object.entries(params).filter(([key, value]) => value !== null)
46    )
47    api.siteBehave(params).then(res => {
48        if (res.code == 0) {
49            window.location.href = window.location.href + '?did=' + res.data.id + '&page=1'
50        }
51    })
52}
53let setServerStatiscs = (pathName, refer, id, index) => { // 0
54    refer = refer == '' ? null : refer
55    if (refer == window.location.href) {
56        return false
57    }
58    let page = { 1: '1st', 2: "2nd", 3: "3rd" }
59    let params = {
60        id: parseInt(id) || null,
61        chn: 1,
62    }
63    params[`page${page[index]}`] = pathName.replace('PANCAKEXR|', "")
64    params = Object.fromEntries(
65        Object.entries(params).filter(([key, value]) => value !== null)
66    )
67    api.siteBehave(params)
68}
69let RouterListener = async () => {
70    var queryString = window.location.search;
71    var params = new URLSearchParams(queryString);
72    let did = params.get('did')
73    let isUp = params.get('isUp');
74    let page = params.get('page');
75    let pageUrl = window.location.href;
76    let pathName = window.location.pathname;
77    let pageName = document.title;
78    let id = ''
79    let refer = referrerListener()
80    if (did == null && !isUp) {
81        setInitServerStatiscs(pageName, refer, null, 1)
82        return false
83    } else {
84        if (page != 1 && page < 4) {
85            setServerStatiscs(pageName, refer, did, parseInt(page))
86        }
87    }
88    $('body').on('click', 'a', function (e) {
89        e.preventDefault()
90        let isBlank = $(this).attr('target') == '_blank' ? true : false
91        let linkUrl = $(this).attr('href');
92        const match = linkUrl.match(/uid=\d+/); // 匹配 uid= 后跟数字的部分
93        const uidPart = match ? match[0] : null;
94        if(isBlank){
95            window.open(linkUrl)
96            return false
97        }
98        if (isUp) {
99            window.location.href = linkUrl + "?isUp=true"
100        } else {
101            if (GetPageRouter(linkUrl) == GetPageRouter(pathName)) {
102                windowHref(false, linkUrl)
103            } else {
104                windowHref(false, `${linkUrl.replace(/\?.*/, '')}?did=${did}&page=${parseInt(page) + 1}${uidPart ? '&' + uidPart : ''}`)
105            }
106        }
107    })
108}
109function windowHref(isBlank, url) {
110    isBlank ? window.open(url) : window.location.href = url
111}
112/**
113 * 网页访问统计,每次访问计算为一次统计,刷新/跳转/新标签进入都算
114 */
115const SetDataStatisSitePv = () => {
116    let params = {
117        chn: 1
118    }
119    api.sitePv(params)
120}
121SetDataStatiscs()
122SetDataStatisSitePv()

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.