PageSourceSearch

https://gay45.eu/wp-content/plugins/text-to-audio/admin/js/tta-cors-detector.js?ver=2.3.16

js gay45.eu collected 2026-09-24 22:11:55 UTC 1,566 bytes, 40 lines download raw bytes

1/**
2 * TTS-240/249 (I3): CORS/CDN failure detector. Moved out of an inline <script>
3 * on wp_head into this enqueued file. Dynamic values (REST endpoint, site host)
4 * arrive via wp_localize_script as `ttaCorsDetector`.
5 *
6 * A script 'error' event for one of our plugin's scripts from a cross-origin
7 * host is strong proof of a CORS/CDN load failure; we beacon the server, which
8 * re-validates and rate-limits to 1 alert/hour.
9 */
10(function () {
11    if (typeof ttaCorsDetector === 'undefined') {
12        return;
13    }
14    var endpoint = ttaCorsDetector.endpoint;
15    var siteHost = ttaCorsDetector.siteHost;
16    var reported = false;
17
18    window.addEventListener('error', function (e) {
19        if (reported || !e || !e.target || e.target.tagName !== 'SCRIPT') return;
20        var src = e.target.src || '';
21        if (!/\/plugins\/text-to-(audio|speech)/.test(src)) return;
22        var host = '';
23        try { host = new URL(src).host; } catch (_) { return; }
24        if (!host || host === siteHost) return;
25
26        reported = true;
27        var payload = JSON.stringify({ url: src });
28        if (navigator.sendBeacon) {
29            var blob = new Blob([payload], { type: 'application/json' });
30            navigator.sendBeacon(endpoint, blob);
31        } else {
32            fetch(endpoint, {
33                method: 'POST',
34                headers: { 'Content-Type': 'application/json' },
35                body: payload,
36                keepalive: true
37            }).catch(function () {});
38        }
39    }, true);
40})();

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.