PageSourceSearch

https://www.thewirechina.com/wp-content/plugins/leaky-paywall-user-history/includes/js/script.js?ver=1.1.0

js thewirechina.com collected 2026-10-02 03:21:11 UTC 1,900 bytes, 71 lines download raw bytes

1(function () {
2  var COOKIE = 'lp_us_his';
3  var PATH   = '/';
4
5  function deleteCookie(name, path) {
6    document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=' + path + '; SameSite=Lax';
7  }
8
9  if (document.body.classList.contains('logged-in')) {
10    deleteCookie(COOKIE, PATH);
11    return;
12  }
13
14  var MAX  = parseInt(25, 10);
15  var DAYS = parseInt(30, 10);
16
17  function getCookie(name) {
18    var value = document.cookie.split('; ').find(function (row) { return row.startsWith(name + '='); });
19    if (!value) return null;
20    try {
21      return JSON.parse(decodeURIComponent(value.split('=')[1]));
22    } catch (e) {
23      return null;
24    }
25  }
26
27  function setCookie(name, data, days, path) {
28    var expires = '';
29    if (days) {
30      var d = new Date();
31      d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
32      expires = '; expires=' + d.toUTCString();
33    }
34    var serialized = encodeURIComponent(JSON.stringify(data));
35    document.cookie = name + '=' + serialized + expires + '; path=' + path + '; SameSite=Lax';
36  }
37
38  function normalizeUrl(u) {
39    try {
40      var url = new URL(u, window.location.origin);
41      return url.href;
42    } catch (e) {
43      return window.location.href;
44    }
45  }
46
47  function addCurrentPage() {
48    var existing = getCookie(COOKIE);
49    if (!Array.isArray(existing)) existing = [];
50
51    var entry = {
52      url: normalizeUrl(window.location.href),
53      title: (document.title || '').toString().slice(0, 300),
54      ts: Date.now()
55    };
56
57    existing = existing.filter(function (item) { return item && item.url !== entry.url; });
58    existing.unshift(entry);
59
60    if (existing.length > MAX) existing = existing.slice(0, MAX);
61
62    setCookie(COOKIE, existing, DAYS, PATH);
63  }
64
65  if (document.readyState === 'loading') {
66    document.addEventListener('DOMContentLoaded', addCurrentPage);
67  } else {
68    addCurrentPage();
69  }
70
71})();

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.