1
|
/**
|
2
|
* Myext stored item types "enum"
|
3
|
*
|
4
|
* Copyright (C) 2021 Wojtek Kosior
|
5
|
*
|
6
|
* This code is dual-licensed under:
|
7
|
* - Asshole license 1.0,
|
8
|
* - GPLv3 or (at your option) any later version
|
9
|
*
|
10
|
* "dual-licensed" means you can choose the license you prefer.
|
11
|
*
|
12
|
* This code is released under a permissive license because I disapprove of
|
13
|
* copyright and wouldn't be willing to sue a violator. Despite not putting
|
14
|
* this code under copyleft (which is also kind of copyright), I do not want
|
15
|
* it to be made proprietary. Hence, the permissive alternative to GPL is the
|
16
|
* Asshole license 1.0 that allows me to call you an asshole if you use it.
|
17
|
* This means you're legally ok regardless of how you utilize this code but if
|
18
|
* you make it into something nonfree, you're an asshole.
|
19
|
*
|
20
|
* You should have received a copy of both GPLv3 and Asshole license 1.0
|
21
|
* together with this code. If not, please see:
|
22
|
* - https://www.gnu.org/licenses/gpl-3.0.en.html
|
23
|
* - https://koszko.org/asshole-license.Copyright
|
24
|
*/
|
25
|
|
26
|
/*
|
27
|
* Key for item that is stored in quantity (script, page) is constructed by
|
28
|
* prepending its name with first letter of its list name. However, we also
|
29
|
* need to store some items that don't belong to any list. Let's call them
|
30
|
* persisted variables. In such case item's key is its "name" prepended with
|
31
|
* an underscore.
|
32
|
*/
|
33
|
|
34
|
"use strict";
|
35
|
|
36
|
(() => {
|
37
|
const TYPE_PREFIX = {
|
38
|
PAGE : "p",
|
39
|
BAG : "b",
|
40
|
SCRIPT : "s",
|
41
|
VAR : "_"
|
42
|
};
|
43
|
|
44
|
const TYPE_NAME = {
|
45
|
[TYPE_PREFIX.PAGE] : "page",
|
46
|
[TYPE_PREFIX.BAG] : "bag",
|
47
|
[TYPE_PREFIX.SCRIPT] : "script"
|
48
|
}
|
49
|
|
50
|
const list_prefixes = [
|
51
|
TYPE_PREFIX.PAGE,
|
52
|
TYPE_PREFIX.BAG,
|
53
|
TYPE_PREFIX.SCRIPT
|
54
|
];
|
55
|
|
56
|
window.TYPE_PREFIX = TYPE_PREFIX;
|
57
|
window.TYPE_NAME = TYPE_NAME;
|
58
|
window.list_prefixes = list_prefixes;
|
59
|
})();
|