PageSourceSearch

https://www.southwesternrailway.com/buy-train-tickets/assets/js/reciteme-accessibility-tool.js

js southwesternrailway.com collected 2026-09-24 09:06:52 UTC 13,628 bytes, 306 lines download raw bytes

1$(document).ready(function () {
2 
3    loadReciteMe();
4});
5var TranslateContent;
6function loadReciteMe() {
7    let originURL = window.origin;
8    if (originURL == undefined) {
9        originURL = window.location.protocol + "//" + window.location.hostname;
10    }
11 
12    // ReciteMe Tool
13    //use this for UAT
14    const serviceUrl = "//api.reciteme.com/asset/js?key=";
15    const serviceKey = "ee9f819c8369789293c12a61e39328c54429e9b0";
16 
17    // Use this for local testing.    
18    //  var serviceUrl = "//hotsub.reciteme.com/asset/js?key=";
19    //  var serviceKey = "83c2229999559bfb694c9f12c30a3d7d9f529dc2";
20     
21    const options = {
22        Language: { Translate: { disallowedTags: ['SCRIPT', 'STYLE', 'NOSCRIPT'] } }
23        , TextMode: {
24            hideElements: ['img']
25            , disableInlineStyles: (true)
26            , disableStylesheets: (true)
27        }
28    };
29    // Options can be added as needed
30    const autoLoad = false;
31    const enableFragment = "#reciteEnable";
32    const loaded = [];
33    let frag = !1;
34     window.location.hash === enableFragment && (frag = !0);
35      function loadScript(c, b) {
36        var a = document.createElement("script"); a.type = "text/javascript"; a.readyState ? a.onreadystatechange = function () { if ("loaded" == a.readyState || "complete" == a.readyState) a.onreadystatechange = null, void 0 != b && b() } : void 0 != b && (a.onload = function () { b() }); a.src = c; document.getElementsByTagName("head")[0].appendChild(a) } function _rc(c) { c += "="; for (var b = document.cookie.split(";"), a = 0; a < b.length; a++) { for (var d = b[a]; " " == d.charAt(0);)d = d.substring(1, d.length); if (0 == d.indexOf(c)) return d.substring(c.length, d.length) } return null } function loadService(c) { for (var b = serviceUrl + serviceKey, a = 0; a < loaded.length; a++)if (loaded[a] == b) return; loaded.push(b); loadScript(serviceUrl + serviceKey, function () { "function" === typeof _reciteLoaded && _reciteLoaded(); "function" == typeof c && c(); Recite.load(options); Recite.Event.subscribe("Recite:load", function () { Recite.enable() }) }) } "true" == _rc("Recite.Persist") && loadService(); if (autoLoad && "false" != _rc("Recite.Persist") || frag) document.addEventListener ? document.addEventListener("DOMContentLoaded", function (c) { loadService() }) : loadService();
37 
38    loadScript(serviceUrl + serviceKey, function () {
39        _reciteLoaded();
40    });
41 
42    //just add a link with a class 'reciteme'
43    $(document).on("click", ".reciteme", function () {
44        loadService();
45        return false;
46    });
47 
48 
49    function _handleLanguageClick(lang) {
50 
51        if (typeof (Recite) != "undefined") {
52            SkipElements();
53            Recite.Language.Translate.translate($("body")[0], lang);
54            localStorage.setItem('user_lang', lang);
55        }
56    }
57    function _reciteLoaded() {
58        setTimeout(function (){  setUserlang(); }, 1000);
59        TranslateContent();
60        Recite.load(options);
61        //attach the translation listner
62        $(document).on("click", ".lang", function () {
63            _handleLanguageClick($(this).data("lang"));
64            setUserlang();
65        });
66    }
67    const setUserlang = function () {
68        let userLang = localStorage.getItem('user_lang');
69        $('body').attr("class", "english-Lang mat-typography");
70        if (userLang != "undefined" && userLang != null) {
71            if (userLang == "en") {
72                $('body').attr("class", "english-Lang mat-typography");
73                $("#Id_en").text("English");
74                $('#selectedFlag').attr("class", "englishFlag en");
75 
76            }
77            else if (userLang == "zh") {
78                $('body').attr("class", "chinese-Lang mat-typography");
79                $("#Id_en").text("中国简化");
80                $('#selectedFlag').attr("class", "englishFlag zh");
81            }
82            else if (userLang == "fr") {
83                $('body').attr("class", "francais-Lang mat-typography");
84                $("#Id_en").text("Français ");
85                $('#selectedFlag').attr("class", "englishFlag fr");
86            }
87            else if (userLang == "nl") {
88                $('body').attr("class", "nederlands-Lang mat-typography");
89                $("#Id_en").text("Nederlands");
90                $('#selectedFlag').attr("class", "englishFlag nl");
91            }
92            else if (userLang == "de") {
93                $('body').attr("class", "deutsch-Lang mat-typography");
94                $("#Id_en").text("Deutsch");
95                $('#selectedFlag').attr("class", "englishFlag de");
96            }
97            else if (userLang == "it") {
98                $('body').attr("class", "italiano-Lang mat-typography");
99                $("#Id_en").text("Italiano");
100                $('#selectedFlag').attr("class", "englishFlag it");
101 
102            }
103            else if (userLang == "es") {
104                $('body').attr("class", "espanol-Lang mat-typography");
105                $("#Id_en").text("Español");
106                $('#selectedFlag').attr("class", "englishFlag es");
107 
108            }
109            else if (userLang == "pl") {
110                $('body').attr("class", "polski-Lang mat-typography");
111                $("#Id_en").text("Polski");
112                $('#selectedFlag').attr("class", "englishFlag pl");
113 
114            }
115            else if (userLang == "pt") {
116                $('body').attr("class", "portguis-Lang mat-typography");
117                $("#Id_en").text("Português");
118                $('#selectedFlag').attr("class", "englishFlag pt");
119            }
120        }
121 
122 
123 
124    }
125    TranslateContent = function () {
126        let userLang = localStorage.getItem('user_lang');
127 
128        //Use this for UAT
129        if (userLang != "undefined" && userLang != null && originURL.indexOf("southwesternrailway") != null && originURL.indexOf("southwesternrailway") > 0) {
130            SkipElements();
131            Recite.Language.Translate.translate($("body")[0], userLang);
132        }
133 
134        // Use this for local testing.
135        // if (userLang != "undefined" && userLang != null) {
136        //     SkipElements();
137        //     Recite.Language.Translate.translate($("body")[0], userLang);
138        // }
139 
140    }
141 
142    function SkipElements()
143    {
144        const elementsToSkip = document.querySelectorAll(".mat-cell, .finalPrice, .wlcm-name, .user-name,.stationNameArrival,.stationNameDepart, .search-control");
145        for (const i in elementsToSkip) {
146            if (typeof elementsToSkip[i].setAttribute == "function") {
147                elementsToSkip[i].setAttribute("data-recite-translate-skip", true);
148            }
149        }
150    }
151 
152}
153 
154$(document).ready(function () {
155 
156    loadReciteMe();
157});
158var TranslateContent;
159function loadReciteMe() {
160    let originURL = window.origin;
161    if (originURL == undefined) {
162        originURL = window.location.protocol + "//" + window.location.hostname;
163    }
164 
165    // ReciteMe Tool
166    //use this for UAT
167    const serviceUrl = "//api.reciteme.com/asset/js?key=";
168    const serviceKey = "ee9f819c8369789293c12a61e39328c54429e9b0";
169 
170    // Use this for local testing.    
171    //  var serviceUrl = "//hotsub.reciteme.com/asset/js?key=";
172    //  var serviceKey = "83c2229999559bfb694c9f12c30a3d7d9f529dc2";
173     
174    const options = {
175        Language: { Translate: { disallowedTags: ['SCRIPT', 'STYLE', 'NOSCRIPT'] } }
176        , TextMode: {
177            hideElements: ['img']
178            , disableInlineStyles: (true)
179            , disableStylesheets: (true)
180        }
181    };
182    // Options can be added as needed
183    const autoLoad = false;
184    const enableFragment = "#reciteEnable";
185    const loaded = [];
186    let frag = !1;
187     window.location.hash === enableFragment && (frag = !0);
188      function loadScript(c, b) {
189        var a = document.createElement("script"); a.type = "text/javascript"; a.readyState ? a.onreadystatechange = function () { if ("loaded" == a.readyState || "complete" == a.readyState) a.onreadystatechange = null, void 0 != b && b() } : void 0 != b && (a.onload = function () { b() }); a.src = c; document.getElementsByTagName("head")[0].appendChild(a) } function _rc(c) { c += "="; for (var b = document.cookie.split(";"), a = 0; a < b.length; a++) { for (var d = b[a]; " " == d.charAt(0);)d = d.substring(1, d.length); if (0 == d.indexOf(c)) return d.substring(c.length, d.length) } return null } function loadService(c) { for (var b = serviceUrl + serviceKey, a = 0; a < loaded.length; a++)if (loaded[a] == b) return; loaded.push(b); loadScript(serviceUrl + serviceKey, function () { "function" === typeof _reciteLoaded && _reciteLoaded(); "function" == typeof c && c(); Recite.load(options); Recite.Event.subscribe("Recite:load", function () { Recite.enable() }) }) } "true" == _rc("Recite.Persist") && loadService(); if (autoLoad && "false" != _rc("Recite.Persist") || frag) document.addEventListener ? document.addEventListener("DOMContentLoaded", function (c) { loadService() }) : loadService();
190 
191    loadScript(serviceUrl + serviceKey, function () {
192        _reciteLoaded();
193    });
194 
195    //just add a link with a class 'reciteme'
196    $(document).on("click", ".reciteme", function () {
197        loadService();
198        return false;
199    });
200 
201 
202    function _handleLanguageClick(lang) {
203 
204        if (typeof (Recite) != "undefined") {
205            SkipElements();
206            Recite.Language.Translate.translate($("body")[0], lang);
207            localStorage.setItem('user_lang', lang);
208        }
209    }
210    function _reciteLoaded() {
211        setTimeout(function (){  setUserlang(); }, 1000);
212        TranslateContent();
213        Recite.load(options);
214        //attach the translation listner
215        $(document).on("click", ".lang", function () {
216            _handleLanguageClick($(this).data("lang"));
217            setUserlang();
218        });
219    }
220    const setUserlang = function () {
221        let userLang = localStorage.getItem('user_lang');
222        $('body').attr("class", "english-Lang mat-typography");
223        if (userLang != "undefined" && userLang != null) {
224            if (userLang == "en") {
225                $('body').attr("class", "english-Lang mat-typography");
226                $("#Id_en").text("English");
227                $('#selectedFlag').attr("class", "englishFlag en");
228 
229            }
230            else if (userLang == "zh") {
231                $('body').attr("class", "chinese-Lang mat-typography");
232                $("#Id_en").text("中国简化");
233                $('#selectedFlag').attr("class", "englishFlag zh");
234            }
235            else if (userLang == "fr") {
236                $('body').attr("class", "francais-Lang mat-typography");
237                $("#Id_en").text("Français ");
238                $('#selectedFlag').attr("class", "englishFlag fr");
239            }
240            else if (userLang == "nl") {
241                $('body').attr("class", "nederlands-Lang mat-typography");
242                $("#Id_en").text("Nederlands");
243                $('#selectedFlag').attr("class", "englishFlag nl");
244            }
245            else if (userLang == "de") {
246                $('body').attr("class", "deutsch-Lang mat-typography");
247                $("#Id_en").text("Deutsch");
248                $('#selectedFlag').attr("class", "englishFlag de");
249            }
250            else if (userLang == "it") {
251                $('body').attr("class", "italiano-Lang mat-typography");
252                $("#Id_en").text("Italiano");
253                $('#selectedFlag').attr("class", "englishFlag it");
254 
255            }
256            else if (userLang == "es") {
257                $('body').attr("class", "espanol-Lang mat-typography");
258                $("#Id_en").text("Español");
259                $('#selectedFlag').attr("class", "englishFlag es");
260 
261            }
262            else if (userLang == "pl") {
263                $('body').attr("class", "polski-Lang mat-typography");
264                $("#Id_en").text("Polski");
265                $('#selectedFlag').attr("class", "englishFlag pl");
266 
267            }
268            else if (userLang == "pt") {
269                $('body').attr("class", "portguis-Lang mat-typography");
270                $("#Id_en").text("Português");
271                $('#selectedFlag').attr("class", "englishFlag pt");
272            }
273        }
274 
275 
276 
277    }
278    TranslateContent = function () {
279        let userLang = localStorage.getItem('user_lang');
280 
281        //Use this for UAT
282        if (userLang != "undefined" && userLang != null && originURL.indexOf("southwesternrailway") != null && originURL.indexOf("southwesternrailway") > 0) {
283            SkipElements();
284            Recite.Language.Translate.translate($("body")[0], userLang);
285        }
286 
287        // Use this for local testing.
288        // if (userLang != "undefined" && userLang != null) {
289        //     SkipElements();
290        //     Recite.Language.Translate.translate($("body")[0], userLang);
291        // }
292 
293    }
294 
295    function SkipElements()
296    {
297        const elementsToSkip = document.querySelectorAll(".mat-cell, .finalPrice, .wlcm-name, .user-name,.stationNameArrival,.stationNameDepart, .search-control");
298        for (const i in elementsToSkip) {
299            if (typeof elementsToSkip[i].setAttribute == "function") {
300                elementsToSkip[i].setAttribute("data-recite-translate-skip", true);
301            }
302        }
303    }
304 
305}
306 

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.