PageSourceSearch

https://www.erfgoud.be/assets/js/voice.js?68

js erfgoud.be collected 2026-10-01 23:59:09 UTC 3,132 bytes, 73 lines download raw bytes

1"use strict";
2var crowlss = !1;
3var VoiceRSS = {
4    speech: function (e) {
5        this._validate(e), this._request(e);
6        return(this );
7    },
8    _validate: function (e) {
9        if (!e) throw "The settings are undefined";
10        if (!e.key) throw "The API key is undefined";
11        if (!e.src) throw "The text is undefined";
12        if (!e.hl) throw "The language is undefined";
13        if (e.c && "auto" != e.c.toLowerCase()) {
14            //var a = !1;
15            switch (e.c.toLowerCase()) {
16                case "mp3":
17                    crowlss = (new Audio).canPlayType("audio/mpeg").replace("no", "");
18                    break;
19                case "wav":
20                    crowlss = (new Audio).canPlayType("audio/wav").replace("no", "");
21                    break;
22                case "aac":
23                    crowlss = (new Audio).canPlayType("audio/aac").replace("no", "");
24                    break;
25                case "ogg":
26                    crowlss = (new Audio).canPlayType("audio/ogg").replace("no", "");
27                    break;
28                case "caf":
29                    crowlss = (new Audio).canPlayType("audio/x-caf").replace("no", "")
30            }
31            if (!crowlss) throw "The browser does not support the audio codec " + e.c
32        }
33    },
34    _request: function (e) {
35        var a = this._buildRequest(e),
36            t = this._getXHR();
37        t.onreadystatechange = function () {
38            if (4 == t.readyState && 200 == t.status) {
39                if (0 == t.responseText.indexOf("ERROR")) throw t.responseText;
40                new Audio(t.responseText).play()
41            }
42        }, t.open("POST", "https://api.voicerss.org/", !0), t.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"), t.send(a)
43    },
44    _buildRequest: function (e) {
45        var a = e.c && "auto" != e.c.toLowerCase() ? e.c : this._detectCodec();
46        return "key=" + (e.key || "") + "&src=" + (e.src || "") + "&hl=" + (e.hl || "") + "&r=" + (e.r || "") + "&c=" + (a || "") + "&f=" + (e.f || "") + "&ssml=" + (e.ssml || "") + "&b64=true"
47    },
48    _detectCodec: function () {
49        var e = new Audio;
50        return e.canPlayType("audio/mpeg").replace("no", "") ? "mp3" : e.canPlayType("audio/wav").replace("no", "") ? "wav" : e.canPlayType("audio/aac").replace("no", "") ? "aac" : e.canPlayType("audio/ogg").replace("no", "") ? "ogg" : e.canPlayType("audio/x-caf").replace("no", "") ? "caf" : ""
51    },
52    _getXHR: function () {
53        try {
54            return new XMLHttpRequest
55        } catch (e) {}
56        try {
57            return new ActiveXObject("Msxml3.XMLHTTP")
58        } catch (e) {}
59        try {
60            return new ActiveXObject("Msxml2.XMLHTTP.6.0")
61        } catch (e) {}
62        try {
63            return new ActiveXObject("Msxml2.XMLHTTP.3.0")
64        } catch (e) {}
65        try {
66            return new ActiveXObject("Msxml2.XMLHTTP")
67        } catch (e) {}
68        try {
69            return new ActiveXObject("Microsoft.XMLHTTP")
70        } catch (e) {}
71        throw "The browser does not support HTTP request"
72    }
73};

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.