textbrowser 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -0
- package/.ncurc.js +8 -0
- package/CHANGES.md +26 -0
- package/README.md +25 -17
- package/dist/WorkInfo-es.js +4659 -0
- package/dist/activateCallback-es.js +158 -0
- package/dist/index-es.js +104 -156
- package/dist/index-es.min.js +2 -2
- package/dist/index-umd.js +105 -157
- package/dist/index-umd.min.js +2 -2
- package/package.json +30 -30
- package/resources/index.js +5 -2
- package/resources/templates/workDisplay.js +7 -82
- package/resources/utils/Metadata.js +6 -1
- package/resources/workDisplay.js +3 -2
- package/server/main-cjs.js +31 -92
- package/sw-sample.js +12 -9
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/* eslint-env worker */
|
|
2
|
+
|
|
3
|
+
const {ceil} = Math;
|
|
4
|
+
const arrayChunk = (arr, size) => {
|
|
5
|
+
return [...Array.from({length: ceil(arr.length / size)})].map((_, i) => {
|
|
6
|
+
const offset = i * size;
|
|
7
|
+
return arr.slice(offset, offset + size);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Todo: If fetching fails here (or in install), e.g., because activate event
|
|
12
|
+
// never completed
|
|
13
|
+
// to cache, de-register and re-register (?); how to detect if all
|
|
14
|
+
// files in cache?
|
|
15
|
+
// Todo: Check `oldVersion` and run this first if still too old
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @callback Logger
|
|
19
|
+
* @param {...any} args
|
|
20
|
+
* @returns {void}
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {PlainObject} cfg
|
|
25
|
+
* @param {string} cfg.namespace
|
|
26
|
+
* @param {string[]} cfg.files
|
|
27
|
+
* @param {Logger} cfg.log
|
|
28
|
+
* @param {string} [cfg.basePath=""]
|
|
29
|
+
* @returns {Promise<void>}
|
|
30
|
+
*/
|
|
31
|
+
async function activateCallback ({
|
|
32
|
+
namespace, files, log, basePath = ''
|
|
33
|
+
}) {
|
|
34
|
+
// Now we know we have the files cached, we can postpone
|
|
35
|
+
// the `indexedDB` processing (which will work offline
|
|
36
|
+
// anyways); also important to avoid conflicts with
|
|
37
|
+
// already-running versions upon future sw updates
|
|
38
|
+
log('Activate: Callback called');
|
|
39
|
+
const r = await fetch(files);
|
|
40
|
+
const {groups} = await r.json();
|
|
41
|
+
|
|
42
|
+
const addJSONFetch = (arr, path) => {
|
|
43
|
+
arr.push(
|
|
44
|
+
(async () => (await fetch(basePath + path)).json())()
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const dataFileNames = [];
|
|
49
|
+
const dataFiles = [];
|
|
50
|
+
const schemaFiles = [];
|
|
51
|
+
const metadataFiles = [];
|
|
52
|
+
groups.forEach(
|
|
53
|
+
({files: fileObjs, metadataBaseDirectory, schemaBaseDirectory}) => {
|
|
54
|
+
fileObjs.forEach(({file: {$ref: filePath}, metadataFile, schemaFile, name}) => {
|
|
55
|
+
// We don't i18nize the name here
|
|
56
|
+
dataFileNames.push(name);
|
|
57
|
+
addJSONFetch(dataFiles, filePath);
|
|
58
|
+
addJSONFetch(metadataFiles, metadataBaseDirectory + '/' + metadataFile);
|
|
59
|
+
addJSONFetch(schemaFiles, schemaBaseDirectory + '/' + schemaFile);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
const promises = await Promise.all([
|
|
64
|
+
...dataFiles, ...schemaFiles, ...metadataFiles
|
|
65
|
+
]);
|
|
66
|
+
const chunked = arrayChunk(promises, dataFiles.length);
|
|
67
|
+
const [
|
|
68
|
+
dataFileResponses, schemaFileResponses, metadataFileResponses
|
|
69
|
+
] = chunked;
|
|
70
|
+
|
|
71
|
+
log('Activate: Files fetched');
|
|
72
|
+
const dbName = namespace + '-textbrowser-cache-data';
|
|
73
|
+
indexedDB.deleteDatabase(dbName);
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const req = indexedDB.open(dbName);
|
|
76
|
+
req.addEventListener('upgradeneeded', ({target: {result: db}}) => {
|
|
77
|
+
db.onversionchange = () => {
|
|
78
|
+
db.close();
|
|
79
|
+
const err = new Error('versionchange');
|
|
80
|
+
err.type = 'versionchange';
|
|
81
|
+
reject(err);
|
|
82
|
+
};
|
|
83
|
+
dataFileResponses.forEach(({data: tableRows}, i) => {
|
|
84
|
+
const dataFileName = dataFileNames[i];
|
|
85
|
+
const store = db.createObjectStore('files-to-cache-' + dataFileName);
|
|
86
|
+
|
|
87
|
+
const schemaFileResponse = schemaFileResponses[i];
|
|
88
|
+
const metadataFileResponse = metadataFileResponses[i];
|
|
89
|
+
const fieldItems = schemaFileResponse.items.items;
|
|
90
|
+
|
|
91
|
+
let browseFields = metadataFileResponse.table.browse_fields;
|
|
92
|
+
browseFields = Array.isArray(browseFields) ? browseFields : [browseFields];
|
|
93
|
+
|
|
94
|
+
const columnIndexes = [];
|
|
95
|
+
browseFields.forEach((browseFieldSetObj) => {
|
|
96
|
+
if (typeof browseFieldSetObj === 'string') {
|
|
97
|
+
browseFieldSetObj = {set: [browseFieldSetObj]};
|
|
98
|
+
}
|
|
99
|
+
if (!browseFieldSetObj.name) {
|
|
100
|
+
browseFieldSetObj.name = browseFieldSetObj.set.join(',');
|
|
101
|
+
}
|
|
102
|
+
const browseFieldSetName = browseFieldSetObj.name;
|
|
103
|
+
const browseFieldSetIndexes = browseFieldSetObj.set.map((browseField) => {
|
|
104
|
+
// Need to convert to columns for numbers
|
|
105
|
+
// to become valid key paths
|
|
106
|
+
return 'c' + (
|
|
107
|
+
fieldItems.findIndex((item) => item.title === browseField)
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
columnIndexes.push(...browseFieldSetIndexes);
|
|
111
|
+
|
|
112
|
+
log(
|
|
113
|
+
'Activate: Creating index:',
|
|
114
|
+
dataFileName,
|
|
115
|
+
'browseFields-' + browseFieldSetName,
|
|
116
|
+
browseFieldSetIndexes
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// No need for using `presort` as our index will sort anyways
|
|
120
|
+
store.createIndex(
|
|
121
|
+
'browseFields-' + browseFieldSetName,
|
|
122
|
+
browseFieldSetIndexes
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const uniqueColumnIndexes = [...new Set(columnIndexes)];
|
|
127
|
+
|
|
128
|
+
tableRows.forEach((tableRow, j) => {
|
|
129
|
+
// Todo: Optionally send notice when complete
|
|
130
|
+
// To take advantage of indexes on our arrays, we
|
|
131
|
+
// need to transform them to objects! See https://github.com/w3c/IndexedDB/issues/209
|
|
132
|
+
const objRow = {
|
|
133
|
+
value: tableRow
|
|
134
|
+
};
|
|
135
|
+
uniqueColumnIndexes.forEach((colIdx) => {
|
|
136
|
+
objRow[colIdx] = tableRow[colIdx.slice(1)];
|
|
137
|
+
});
|
|
138
|
+
// log('objRow', objRow);
|
|
139
|
+
store.put(objRow, j);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
req.addEventListener('success', ({target: {result: db}}) => {
|
|
144
|
+
log('Activate: Database set-up complete', db);
|
|
145
|
+
// Todo: Replace this with `ready()` check
|
|
146
|
+
// in calling code?
|
|
147
|
+
resolve();
|
|
148
|
+
});
|
|
149
|
+
const onerr = ({error = new Error('dbError')}) => {
|
|
150
|
+
error.type = 'dbError';
|
|
151
|
+
reject(error);
|
|
152
|
+
};
|
|
153
|
+
req.addEventListener('blocked', onerr);
|
|
154
|
+
req.addEventListener('error', onerr);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { activateCallback as default };
|
package/dist/index-es.js
CHANGED
|
@@ -3,14 +3,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
3
3
|
|
|
4
4
|
if (Object.getOwnPropertySymbols) {
|
|
5
5
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
keys.push.apply(keys, symbols);
|
|
6
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
7
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
8
|
+
})), keys.push.apply(keys, symbols);
|
|
14
9
|
}
|
|
15
10
|
|
|
16
11
|
return keys;
|
|
@@ -18,19 +13,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
18
13
|
|
|
19
14
|
function _objectSpread2(target) {
|
|
20
15
|
for (var i = 1; i < arguments.length; i++) {
|
|
21
|
-
var source = arguments[i]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
28
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
29
|
-
} else {
|
|
30
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
31
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
32
|
-
});
|
|
33
|
-
}
|
|
16
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
18
|
+
_defineProperty(target, key, source[key]);
|
|
19
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
20
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
21
|
+
});
|
|
34
22
|
}
|
|
35
23
|
|
|
36
24
|
return target;
|
|
@@ -1485,15 +1473,15 @@ var number = createCommonjsModule(function (module, exports) {
|
|
|
1485
1473
|
result.maximumSignificantDigits = g1.length;
|
|
1486
1474
|
} // @@@+ case
|
|
1487
1475
|
else if (g2 === '+') {
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1476
|
+
result.minimumSignificantDigits = g1.length;
|
|
1477
|
+
} // .### case
|
|
1478
|
+
else if (g1[0] === '#') {
|
|
1479
|
+
result.maximumSignificantDigits = g1.length;
|
|
1480
|
+
} // .@@## or .@@@ case
|
|
1481
|
+
else {
|
|
1482
|
+
result.minimumSignificantDigits = g1.length;
|
|
1483
|
+
result.maximumSignificantDigits = g1.length + (typeof g2 === 'string' ? g2.length : 0);
|
|
1484
|
+
}
|
|
1497
1485
|
|
|
1498
1486
|
return '';
|
|
1499
1487
|
});
|
|
@@ -1733,15 +1721,15 @@ var number = createCommonjsModule(function (module, exports) {
|
|
|
1733
1721
|
result.minimumFractionDigits = g1.length;
|
|
1734
1722
|
} // .### case
|
|
1735
1723
|
else if (g3 && g3[0] === '#') {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1724
|
+
result.maximumFractionDigits = g3.length;
|
|
1725
|
+
} // .00## case
|
|
1726
|
+
else if (g4 && g5) {
|
|
1727
|
+
result.minimumFractionDigits = g4.length;
|
|
1728
|
+
result.maximumFractionDigits = g4.length + g5.length;
|
|
1729
|
+
} else {
|
|
1730
|
+
result.minimumFractionDigits = g1.length;
|
|
1731
|
+
result.maximumFractionDigits = g1.length;
|
|
1732
|
+
}
|
|
1745
1733
|
|
|
1746
1734
|
return '';
|
|
1747
1735
|
});
|
|
@@ -1966,14 +1954,14 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
1966
1954
|
if (char === 123
|
|
1967
1955
|
/* `{` */
|
|
1968
1956
|
) {
|
|
1969
|
-
|
|
1957
|
+
var result = this.parseArgument(nestingLevel, expectingCloseTag);
|
|
1970
1958
|
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1959
|
+
if (result.err) {
|
|
1960
|
+
return result;
|
|
1961
|
+
}
|
|
1974
1962
|
|
|
1975
|
-
|
|
1976
|
-
|
|
1963
|
+
elements.push(result.val);
|
|
1964
|
+
} else if (char === 125
|
|
1977
1965
|
/* `}` */
|
|
1978
1966
|
&& nestingLevel > 0) {
|
|
1979
1967
|
break;
|
|
@@ -1990,12 +1978,12 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
1990
1978
|
/* `<` */
|
|
1991
1979
|
&& !this.ignoreTag && this.peek() === 47 // char code for '/'
|
|
1992
1980
|
) {
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1981
|
+
if (expectingCloseTag) {
|
|
1982
|
+
break;
|
|
1983
|
+
} else {
|
|
1984
|
+
return this.error(error.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1985
|
+
}
|
|
1986
|
+
} else if (char === 60
|
|
1999
1987
|
/* `<` */
|
|
2000
1988
|
&& !this.ignoreTag && _isAlpha(this.peek() || 0)) {
|
|
2001
1989
|
var result = this.parseTag(nestingLevel, parentArgType);
|
|
@@ -2180,8 +2168,8 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2180
2168
|
if (this.isEOF() || this.char() !== 39
|
|
2181
2169
|
/* `'` */
|
|
2182
2170
|
) {
|
|
2183
|
-
|
|
2184
|
-
|
|
2171
|
+
return null;
|
|
2172
|
+
} // Parse escaped char following the apostrophe, or early return if there is no escaped char.
|
|
2185
2173
|
// Check if is valid escaped character
|
|
2186
2174
|
|
|
2187
2175
|
|
|
@@ -2225,18 +2213,18 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2225
2213
|
if (ch === 39
|
|
2226
2214
|
/* `'` */
|
|
2227
2215
|
) {
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2216
|
+
if (this.peek() === 39
|
|
2217
|
+
/* `'` */
|
|
2218
|
+
) {
|
|
2219
|
+
codePoints.push(39); // Bump one more time because we need to skip 2 characters.
|
|
2232
2220
|
|
|
2233
|
-
|
|
2234
|
-
} else {
|
|
2235
|
-
// Optional closing apostrophe.
|
|
2236
|
-
this.bump();
|
|
2237
|
-
break;
|
|
2238
|
-
}
|
|
2221
|
+
this.bump();
|
|
2239
2222
|
} else {
|
|
2223
|
+
// Optional closing apostrophe.
|
|
2224
|
+
this.bump();
|
|
2225
|
+
break;
|
|
2226
|
+
}
|
|
2227
|
+
} else {
|
|
2240
2228
|
codePoints.push(ch);
|
|
2241
2229
|
}
|
|
2242
2230
|
|
|
@@ -2282,9 +2270,9 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2282
2270
|
if (this.char() === 125
|
|
2283
2271
|
/* `}` */
|
|
2284
2272
|
) {
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2273
|
+
this.bump();
|
|
2274
|
+
return this.error(error.ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
|
|
2275
|
+
} // argument name
|
|
2288
2276
|
|
|
2289
2277
|
|
|
2290
2278
|
var value = this.parseIdentifierIfPossible().value;
|
|
@@ -2563,8 +2551,8 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2563
2551
|
if (this.isEOF() || this.char() !== 125
|
|
2564
2552
|
/* `}` */
|
|
2565
2553
|
) {
|
|
2566
|
-
|
|
2567
|
-
|
|
2554
|
+
return this.error(error.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
2555
|
+
}
|
|
2568
2556
|
|
|
2569
2557
|
this.bump(); // `}`
|
|
2570
2558
|
|
|
@@ -2774,10 +2762,10 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2774
2762
|
&& ch <= 57
|
|
2775
2763
|
/* `9` */
|
|
2776
2764
|
) {
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2765
|
+
hasDigits = true;
|
|
2766
|
+
decimal = decimal * 10 + (ch - 48);
|
|
2767
|
+
this.bump();
|
|
2768
|
+
} else {
|
|
2781
2769
|
break;
|
|
2782
2770
|
}
|
|
2783
2771
|
}
|
|
@@ -2861,10 +2849,10 @@ var parser = createCommonjsModule(function (module, exports) {
|
|
|
2861
2849
|
if (code === 10
|
|
2862
2850
|
/* '\n' */
|
|
2863
2851
|
) {
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2852
|
+
this.position.line += 1;
|
|
2853
|
+
this.position.column = 1;
|
|
2854
|
+
this.position.offset += 1;
|
|
2855
|
+
} else {
|
|
2868
2856
|
this.position.column += 1; // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.
|
|
2869
2857
|
|
|
2870
2858
|
this.position.offset += code < 0x10000 ? 1 : 2;
|
|
@@ -15179,7 +15167,12 @@ const getMetaProp = function getMetaProp(lang, metadataObj, properties, allowObj
|
|
|
15179
15167
|
// Todo: Allow use of dbs and fileGroup together in base directories?
|
|
15180
15168
|
|
|
15181
15169
|
const getMetadata = async (file, property, basePath) => {
|
|
15182
|
-
|
|
15170
|
+
const url = new URL(basePath || getCurrDir());
|
|
15171
|
+
url.search = ''; // Clear out query string, e.g., `?fbclid` from Facebook
|
|
15172
|
+
|
|
15173
|
+
url.pathname = file;
|
|
15174
|
+
url.hash = property ? '#/' + property : '';
|
|
15175
|
+
return (await JsonRefs.resolveRefsAt(url.toString(), {
|
|
15183
15176
|
loaderOptions: {
|
|
15184
15177
|
processContent(res, callback) {
|
|
15185
15178
|
callback(undefined, JSON.parse(res.text || // `.metadata` not a recognized extension, so
|
|
@@ -16604,7 +16597,8 @@ var workDisplay$1 = {
|
|
|
16604
16597
|
localizeParamNames,
|
|
16605
16598
|
namespace,
|
|
16606
16599
|
hideFormattingSection,
|
|
16607
|
-
groups
|
|
16600
|
+
groups,
|
|
16601
|
+
preferencesPlugin
|
|
16608
16602
|
}) => ['div', {
|
|
16609
16603
|
style: {
|
|
16610
16604
|
textAlign: 'left'
|
|
@@ -16671,73 +16665,16 @@ var workDisplay$1 = {
|
|
|
16671
16665
|
}
|
|
16672
16666
|
|
|
16673
16667
|
return ['option', atts, [imfl(['languages', lan.code])]];
|
|
16674
|
-
})]]],
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
$DOCTYPE: {
|
|
16685
|
-
name: 'NETSCAPE-Bookmark-file-1'
|
|
16686
|
-
},
|
|
16687
|
-
title: l('Bookmarks'),
|
|
16688
|
-
body: [['h1', [l('Bookmarks_Menu')]], ...(await getFieldAliasOrNames()).flatMap(({
|
|
16689
|
-
groupName,
|
|
16690
|
-
worksToFields
|
|
16691
|
-
}) => {
|
|
16692
|
-
return [['dt', [['h3', {
|
|
16693
|
-
ADD_DATE,
|
|
16694
|
-
LAST_MODIFIED
|
|
16695
|
-
}, [groupName]]]], ['dl', [['p'], ...worksToFields.map(({
|
|
16696
|
-
fieldAliasOrNames,
|
|
16697
|
-
workName,
|
|
16698
|
-
shortcut: SHORTCUTURL
|
|
16699
|
-
}) => {
|
|
16700
|
-
// Todo (low): Add anchor, etc. (until handled by `work-startEnd`); &aqdas-anchor1-1=2&anchorfield1=Paragraph
|
|
16701
|
-
// Todo: option for additional browse field groups (startEnd2, etc.)
|
|
16702
|
-
// Todo: For link text, use `heading` or `alias` from metadata files in place of workName (requires loading all metadata files though)
|
|
16703
|
-
// Todo: Make Chrome NativeExt add-on to manipulate its search engines (to read a bookmarks file from Firefox properly, i.e., including keywords) https://www.makeuseof.com/answers/export-google-chrome-search-engines-address-bar/
|
|
16704
|
-
const paramsCopy = paramsSetter(_objectSpread2(_objectSpread2({}, getDataForSerializingParamsAsURL()), {}, {
|
|
16705
|
-
fieldAliasOrNames,
|
|
16706
|
-
workName: work,
|
|
16707
|
-
// Delete work of current page
|
|
16708
|
-
type: 'shortcutResult'
|
|
16709
|
-
}));
|
|
16710
|
-
const url = replaceHash(paramsCopy) + `&work=${workName}&${workName}-startEnd1=%s`; // %s will be escaped if set as param; also add changeable workName here
|
|
16711
|
-
|
|
16712
|
-
return ['dt', [['a', {
|
|
16713
|
-
href: url,
|
|
16714
|
-
ADD_DATE,
|
|
16715
|
-
LAST_MODIFIED,
|
|
16716
|
-
SHORTCUTURL
|
|
16717
|
-
}, [workName]]]];
|
|
16718
|
-
})]]];
|
|
16719
|
-
})]
|
|
16720
|
-
}
|
|
16721
|
-
})).replace( // Chrome has a quirk that requires this (and not
|
|
16722
|
-
// just any whitespace)
|
|
16723
|
-
// We're not getting the keywords with Chrome,
|
|
16724
|
-
// but at least usable for bookmarks (though
|
|
16725
|
-
// not the groups apparently)
|
|
16726
|
-
/<dt>/g, '\n<dt>')], {
|
|
16727
|
-
type: 'text/html'
|
|
16728
|
-
});
|
|
16729
|
-
const url = window.URL.createObjectURL(blob);
|
|
16730
|
-
const a = jml('a', {
|
|
16731
|
-
hidden: true,
|
|
16732
|
-
download: 'bookmarks.html',
|
|
16733
|
-
href: url
|
|
16734
|
-
}, $$1('#main'));
|
|
16735
|
-
a.click();
|
|
16736
|
-
URL.revokeObjectURL(url);
|
|
16737
|
-
}
|
|
16738
|
-
|
|
16739
|
-
}
|
|
16740
|
-
}, [l('Generate_bookmarks')]]]]]],
|
|
16668
|
+
})]]], preferencesPlugin ? preferencesPlugin({
|
|
16669
|
+
$: $$1,
|
|
16670
|
+
l,
|
|
16671
|
+
jml,
|
|
16672
|
+
paramsSetter,
|
|
16673
|
+
getDataForSerializingParamsAsURL,
|
|
16674
|
+
work,
|
|
16675
|
+
replaceHash,
|
|
16676
|
+
getFieldAliasOrNames
|
|
16677
|
+
}) : '']],
|
|
16741
16678
|
|
|
16742
16679
|
addBrowseFields({
|
|
16743
16680
|
browseFields,
|
|
@@ -16889,7 +16826,8 @@ var workDisplay$1 = {
|
|
|
16889
16826
|
preferredLocale,
|
|
16890
16827
|
schemaItems,
|
|
16891
16828
|
content,
|
|
16892
|
-
groups
|
|
16829
|
+
groups,
|
|
16830
|
+
preferencesPlugin
|
|
16893
16831
|
}) {
|
|
16894
16832
|
const work = $p.get('work');
|
|
16895
16833
|
|
|
@@ -16940,7 +16878,8 @@ var workDisplay$1 = {
|
|
|
16940
16878
|
localizeParamNames,
|
|
16941
16879
|
namespace,
|
|
16942
16880
|
groups,
|
|
16943
|
-
hideFormattingSection
|
|
16881
|
+
hideFormattingSection,
|
|
16882
|
+
preferencesPlugin
|
|
16944
16883
|
})]], ['h2', [heading]], ['br'], ['form', {
|
|
16945
16884
|
id: 'browse',
|
|
16946
16885
|
$custom: {
|
|
@@ -17947,6 +17886,9 @@ async function workDisplay({
|
|
|
17947
17886
|
fallbackLanguages,
|
|
17948
17887
|
$p
|
|
17949
17888
|
}) {
|
|
17889
|
+
const {
|
|
17890
|
+
preferencesPlugin
|
|
17891
|
+
} = this;
|
|
17950
17892
|
const langs = this.langData.languages;
|
|
17951
17893
|
const fallbackDirection = this.getDirectionForLanguageCode(fallbackLanguages[0]);
|
|
17952
17894
|
const prefI18n = localStorage.getItem(this.namespace + '-localizeParamNames');
|
|
@@ -17966,8 +17908,7 @@ async function workDisplay({
|
|
|
17966
17908
|
groupsToWorks
|
|
17967
17909
|
}) {
|
|
17968
17910
|
const il = localizeParamNames ? key => l(['params', key]) : key => key;
|
|
17969
|
-
const iil = localizeParamNames ? key => l(['params', 'indexed', key]) : key => key;
|
|
17970
|
-
|
|
17911
|
+
const iil = localizeParamNames ? key => l(['params', 'indexed', key]) : key => key;
|
|
17971
17912
|
const localeFromLangData = languages.localeFromLangData.bind(languages);
|
|
17972
17913
|
const imfLang = IMF({
|
|
17973
17914
|
locales: lang.map(localeFromLangData),
|
|
@@ -18114,7 +18055,8 @@ async function workDisplay({
|
|
|
18114
18055
|
fieldMatchesLocale,
|
|
18115
18056
|
preferredLocale,
|
|
18116
18057
|
schemaItems,
|
|
18117
|
-
content
|
|
18058
|
+
content,
|
|
18059
|
+
preferencesPlugin
|
|
18118
18060
|
});
|
|
18119
18061
|
}
|
|
18120
18062
|
|
|
@@ -18307,6 +18249,8 @@ Object.defineProperty(self$1, '_BIDI_RTL_LANGS', {
|
|
|
18307
18249
|
/* 'فارسی', Persian */
|
|
18308
18250
|
'glk',
|
|
18309
18251
|
/* 'گیلکی', Gilaki */
|
|
18252
|
+
'he',
|
|
18253
|
+
/* 'עברית', Hebrew */
|
|
18310
18254
|
'ku',
|
|
18311
18255
|
/* 'Kurdî / كوردی', Kurdish */
|
|
18312
18256
|
'mzn',
|
|
@@ -18321,8 +18265,10 @@ Object.defineProperty(self$1, '_BIDI_RTL_LANGS', {
|
|
|
18321
18265
|
/* 'سنڌي', Sindhi */
|
|
18322
18266
|
'ug',
|
|
18323
18267
|
/* 'Uyghurche / ئۇيغۇرچە', Uyghur */
|
|
18324
|
-
'ur'
|
|
18268
|
+
'ur',
|
|
18325
18269
|
/* 'اردو', Urdu */
|
|
18270
|
+
'yi'
|
|
18271
|
+
/* 'ייִדיש', Yiddish */
|
|
18326
18272
|
],
|
|
18327
18273
|
writable: false,
|
|
18328
18274
|
enumerable: true,
|
|
@@ -18384,8 +18330,8 @@ const setAnchor = ({
|
|
|
18384
18330
|
if (i === max || // No more field sets to check
|
|
18385
18331
|
anchors.length // Already had anchors found
|
|
18386
18332
|
) {
|
|
18387
|
-
|
|
18388
|
-
|
|
18333
|
+
breakout = true;
|
|
18334
|
+
}
|
|
18389
18335
|
|
|
18390
18336
|
break;
|
|
18391
18337
|
}
|
|
@@ -19436,7 +19382,7 @@ async function requestPermissions(langs, l) {
|
|
|
19436
19382
|
// rememberRefusal();
|
|
19437
19383
|
resolve();
|
|
19438
19384
|
return;
|
|
19439
|
-
// eslint-disable-next-line
|
|
19385
|
+
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
|
19440
19386
|
|
|
19441
19387
|
case 'default':
|
|
19442
19388
|
resolve();
|
|
@@ -19492,6 +19438,7 @@ class TextBrowser {
|
|
|
19492
19438
|
this.requestPersistentStorage = options.requestPersistentStorage;
|
|
19493
19439
|
this.localizeParamNames = options.localizeParamNames === undefined ? true : options.localizeParamNames;
|
|
19494
19440
|
this.hideFormattingSection = Boolean(options.hideFormattingSection);
|
|
19441
|
+
this.preferencesPlugin = options.preferencesPlugin;
|
|
19495
19442
|
this.interlinearSeparator = options.interlinearSeparator; // Todo: Make these user facing options
|
|
19496
19443
|
|
|
19497
19444
|
this.showEmptyInterlinear = options.showEmptyInterlinear;
|
|
@@ -19863,7 +19810,8 @@ class TextBrowser {
|
|
|
19863
19810
|
fallbackLanguages,
|
|
19864
19811
|
languageParam,
|
|
19865
19812
|
$p,
|
|
19866
|
-
languages
|
|
19813
|
+
languages,
|
|
19814
|
+
preferencesPlugin: this.preferencesPlugin
|
|
19867
19815
|
});
|
|
19868
19816
|
return true;
|
|
19869
19817
|
}
|
|
@@ -19900,4 +19848,4 @@ TextBrowser.prototype.workDisplay = workDisplay;
|
|
|
19900
19848
|
TextBrowser.prototype.resultsDisplayClient = resultsDisplayClient;
|
|
19901
19849
|
TextBrowser.prototype.getWorkFiles = getWorkFiles;
|
|
19902
19850
|
|
|
19903
|
-
export default
|
|
19851
|
+
export { TextBrowser as default };
|