PageSourceSearch

https://osuweb.cathaysec.com.tw/cathay-ui/csp.js

js cathaysec.com.tw collected 2026-10-01 14:10:26 UTC 1,094 bytes, 34 lines download raw bytes

1
2const getCSPNonce = () => {
3  const meta = document.querySelector('meta[name="csp-nonce"]');
4  return meta ? meta.getAttribute('content') : '';
5};
6  const CSP_NONCE = getCSPNonce();
7  // 🔥 核心:监听所有 DOM 节点创建,只要是 style 立刻加 nonce
8  if (window.MutationObserver) {
9    const observer = new MutationObserver((mutations) => {
10      mutations.forEach(m => {
11        m.addedNodes.forEach(node => {
12          // 只要是 style 标签,强制加 nonce
13          if (node.tagName === 'STYLE') {
14            node.setAttribute('nonce', CSP_NONCE);
15          }
16        });
17      });
18    });
19
20    // 监听整个 document,捕获所有动态创建的 style
21    observer.observe(document.documentElement, {
22      subtree: true,
23      childList: true
24    });
25  }
26
27  // 兼容老浏览器 + 同步创建场景
28  document.createElement = (function(orig) {
29    return function(tag) {
30      const el = orig.call(this, tag);
31      if (tag === 'style') el.setAttribute('nonce', CSP_NONCE);
32      return el;
33    };
34  })(document.createElement);

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.