PageSourceSearch

https://kiwix.org/wp-content/plugins/kiwix-lang-redirect/assets/js/cookie-on-switch.js?ver=7.1.2

js kiwix.org collected 2026-09-24 08:28:01 UTC 873 bytes, 25 lines download raw bytes

1function setCookie(name, value, days) {
2    var d = new Date;
3	d.setTime(d.getTime() + 24*60*60*1000*days);
4	document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
5}
6
7String.prototype.rsplit = function (delimiter, limit) {
8  delimiter = this.split (delimiter || /s+/);
9  return limit ? delimiter.splice (-limit) : delimiter;
10}
11
12jQuery( document ).ready( function() {
13    jQuery('a.trp-language-item').on("click", function (e) {
14        let url = this.href;
15        let site_url = `${window.location.protocol}//${window.location.host}/`;
16        let path = url.replace(site_url, '');
17        if (path.indexOf('/') != 2) {
18            console.error("Could not find lang in", path);
19            return;
20        }
21        let lang = path.substring(0, 2);
22        setCookie('lang', lang, 90);
23        console.debug('set lang cookie to', lang);
24    });
25});

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.