PageSourceSearch

https://chamspy.net/js/Utils.js

js chamspy.net collected 2026-10-04 06:55:18 UTC 2,642 bytes, 91 lines download raw bytes

1const windowResize = function () {
2    var html = document.getElementsByTagName('html')[0];
3    var width = window.innerWidth < 980 ? window.innerWidth : 1200;
4    /* 640 100  320 50 */
5    var fontSize = width / 750 * 100;
6    if (window.innerWidth > 980) {
7      html.style.fontSize = 14 + 'px';
8    }else {
9      html.style.fontSize = fontSize + 'px';
10    }
11  
12    window.onresize = function () {
13      var html = document.getElementsByTagName('html')[0];
14      var width = window.innerWidth < 980 ? window.innerWidth : 980;
15      /* 640 100  320 50 */
16      var fontSize = width / 750 * 100;
17      if (window.innerWidth > 980) {
18        html.style.fontSize = 14 + 'px';
19      }else {
20        html.style.fontSize = fontSize + 'px';
21      }
22    }
23  };
24  windowResize();
25
26  function setSemParams() {
27    // sem
28    if (this.getQueryString('channel')) {
29      localStorage.setItem('channel', this.getQueryString('channel'))
30    }
31
32    // key words
33    if (this.getQueryString('utm_term')) {
34      localStorage.setItem('utm_term', this.getQueryString('utm_term'))
35    }
36
37    //  p method
38    if (this.getQueryString('methods')) {
39      localStorage.setItem('global_method', this.getQueryString('methods'))
40    }
41
42    // alliance
43    if (this.getQueryString('utm_medium')) {
44      localStorage.setItem('hmci', this.getQueryString('utm_medium'))
45    }
46    
47    // return uuid.join('');
48    this.uuid = localStorage.getItem('uuid')
49    if (!this.uuid) {
50      this.uuid = +new Date() + this.generateUUid(16, 16)
51      localStorage.setItem('uuid', this.uuid)
52    }
53
54    
55    if (this.getQueryString('gclid')) {
56      localStorage.setItem('gclid', this.getQueryString('gclid'))
57    }
58  }
59
60  setSemParams.prototype.getQueryString = function (name) {
61    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
62    const search = decodeURIComponent(window.location.search.substr(1))
63    const r = search.match(reg);
64    if (r != null)
65      return unescape(r[2]);
66    return null;
67  }
68
69  setSemParams.prototype.generateUUid = function (len, radix) {
70    let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
71    let uuid = [],
72      i;
73    radix = radix || chars.length;
74    if (len) {
75      for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
76    } else {
77      let r;
78      uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
79      uuid[14] = '4';
80      for (i = 0; i < 36; i++) {
81        if (!uuid[i]) {
82          r = 0 | Math.random() * 16;
83          uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
84        }
85      }
86    }
87    return uuid.join('');
88  }
89  
90
91  const sem = new setSemParams();

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.