Project

General

Profile

Download (2.45 KB) Statistics
| Branch: | Tag: | Revision:

haketilo / MOZILLA_exports_init.js @ 6106c789

1
// SPDX-License-Identifier: GPL-3.0-or-later
2

    
3
/**
4
 * This file is part of Haketilo.
5
 *
6
 * Function: Data structure to query items by URL patterns.
7
 *
8
 * Copyright (C) 2021 Wojtek Kosior
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * As additional permission under GNU GPL version 3 section 7, you
21
 * may distribute forms of that code without the copy of the GNU
22
 * GPL normally required by section 4, provided you include this
23
 * license notice and, in case of non-source distribution, a URL
24
 * through which recipients can access the Corresponding Source.
25
 * If you modify file(s) with this exception, you may extend this
26
 * exception to your version of the file(s), but you are not
27
 * obligated to do so. If you do not wish to do so, delete this
28
 * exception statement from your version.
29
 *
30
 * As a special exception to the GPL, any HTML file which merely
31
 * makes function calls to this code, and for that purpose
32
 * includes it by reference shall be deemed a separate work for
33
 * copyright law purposes. If you modify this code, you may extend
34
 * this exception to your version of the code, but you are not
35
 * obligated to do so. If you do not wish to do so, delete this
36
 * exception statement from your version.
37
 *
38
 * You should have received a copy of the GNU General Public License
39
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
40
 *
41
 * I, Wojtek Kosior, thereby promise not to sue for violation of this file's
42
 * license. Although I request that you do not make use this code in a
43
 * proprietary program, I am not going to enforce this in court.
44
 */
45

    
46
/* Polyfill for IceCat 60. */
47
String.prototype.matchAll = String.prototype.matchAll || function(regex) {
48
    if (regex.flags.search("g") === -1)
49
        throw new TypeError("String.prototype.matchAll called with a non-global RegExp argument");
50

    
51
    for (const matches = [];;) {
52
        if (matches[matches.push(regex.exec(this)) - 1] === null)
53
	    return matches.splice(0, matches.length - 1);
54
    }
55
}
56

    
57
window.killtheweb={is_mozilla: true, browser: this.browser};
(2-2/16)