textbrowser 0.40.2 → 0.41.2

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/.editorconfig CHANGED
@@ -17,3 +17,6 @@ trim_trailing_whitespace = true
17
17
 
18
18
  [*.md]
19
19
  indent_size = 4
20
+
21
+ [*.{json,jsonschema}]
22
+ indent_size = 4
package/.eslintrc.js CHANGED
@@ -15,6 +15,7 @@ module.exports = {
15
15
  'document.dir',
16
16
  'document.querySelector',
17
17
  'document.querySelectorAll',
18
+ 'document.title',
18
19
  'DOMParser',
19
20
  'Error',
20
21
  'fetch',
package/.ncurc.js ADDED
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ reject: [
5
+ // Wait until making this package ESM and ESM-only
6
+ 'node-fetch'
7
+ ]
8
+ };
package/CHANGES.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # textbrowser CHANGES
2
2
 
3
+ ## 0.41.2
4
+
5
+ - fix: fix dialog polyfill CSS link
6
+
7
+ ## 0.41.1
8
+
9
+ - fix: fix dialog polyfill CSS link
10
+ - refactor: make array-of-arrays schema more precise
11
+ - refactor: make table.jsonschema more precise
12
+ - refactor: drop redundant locale file listing in sample service worker
13
+ - chore: update `.editorconfig`, devDeps. and deps. (babel-related,
14
+ `command-line-args`)
15
+
16
+ ## 0.41.0
17
+
18
+ - feat: factor out undocumented Bahá'í Writings-specific bookmark generator
19
+ to new generic `preferencesPlugin` option
20
+
21
+ ## 0.40.3
22
+
23
+ ### User-facing
24
+
25
+ - fix: clear out extra query string, e.g., from Facebook when querying for
26
+ metadata file
27
+ - chore: update deps.
28
+
29
+ ### Dev-facing
30
+
31
+ - chore: lint and add ncurc.js
32
+ - chore: update devDeps.
33
+
3
34
  ## 0.40.2
4
35
 
5
36
  - Fix: Add ESM `dist` versions for `activateCallback` and `WorkInfo`
package/README.md CHANGED
@@ -509,8 +509,8 @@ Plugin file designated within `files.json` may have any of the following
509
509
  exports. See the subsection below for details on arguments shared by multiple
510
510
  methods.
511
511
 
512
- - `getCellData({tr, tableData, i, j, applicableField, fieldInfo, applicableFieldIdx, applicableFieldText, fieldLang, getLangDir, meta, metaApplicableField, $p, thisObj})` -
513
- Used to build the plugin field's cell contents. The return value will
512
+ - `getCellData({tr, tableData, i, j, applicableField, fieldInfo, applicableFieldIdx, applicableFieldText, fieldLang, getLangDir, meta, metaApplicableField, $p, thisObj})`
513
+ - Used to build the plugin field's cell contents. The return value will
514
514
  set `tr[j]` unless the return is falsy in which case `applicableFieldText`
515
515
  will be used. Invoked for each cell of the data. To return HTML, must use
516
516
  in conjunction with `escapeColumn: false`. Besides properties shared with
@@ -680,6 +680,11 @@ as a `npm` dependency).
680
680
  This section might be changed to a plugin in the future in which case
681
681
  you'd just avoid designating it within `files.json`.
682
682
 
683
+ - `preferencesPlugin` - A function to be passed the following arguments
684
+ and to return a Jamilih array: `$`, `l`, `jml`, `paramsSetter`,
685
+ `getDataForSerializingParamsAsURL`, `work`, `replaceHash`,
686
+ `getFieldAliasOrNames`
687
+
683
688
  - `interlinearSeparator` - HTML code to be injected between each
684
689
  interlinear entry; this is not exposed to the user for
685
690
  security reasons (preventing [cross-site scripting](https://en.wikipedia.org/wiki/Cross-site_scripting)
@@ -736,7 +741,10 @@ it supports the following arguments:
736
741
 
737
742
  ## To-dos (Highest priority)
738
743
 
739
- 0. Progressive web app? / Electron?
744
+ 1. Document and add **screen-casts** along with one for developers showing
745
+ JSON format, metadata, and schemas); also use with shortcuts (including
746
+ Bahá'í Library Online ones)
747
+ 1. Progressive web app? / Electron?
740
748
  1. Adapt approach of <https://suttacentral.net/offline> in providing form for
741
749
  choice of items to offline (also add to individual work pages).
742
750
  1. Mention idea that it works offline
@@ -751,12 +759,10 @@ it supports the following arguments:
751
759
  1. Ensure works with `pnpm` in all environments (didn't work when deployed,
752
760
  but would need to recall the problem and resolve)
753
761
  1. Simplify `languages.json` by using `Intl.DisplayNames` (`type: 'language'`)
754
- to localize language names (and can avoid direction if [intl-locale-info proposal](https://github.com/tc39/proposal-intl-locale-info) is
755
- implemented); consider using with plugins so can, e.g., show language
762
+ to localize language names (and can avoid direction if
763
+ [intl-locale-info proposal](https://github.com/tc39/proposal-intl-locale-info)
764
+ is implemented); consider using with plugins so can, e.g., show language
756
765
  visibly into which a targeted content language field was translated
757
- 1. Document and add screen-casts along with one for developers showing
758
- JSON format, metadata, and schemas); also use with shortcuts (including
759
- Bahá'í Library Online ones)
760
766
  1. For plugins, allow export of `stylesheets` array to add to
761
767
  `loadStylesheets`, so they don't have to do the importing and executing.
762
768
  1. **Progress meter** with hidden console to avoid intimidating loading
@@ -777,7 +783,7 @@ it supports the following arguments:
777
783
  1. Fix limitation that 0's don't change to 1's if
778
784
  not present as a minimum (e.g., if no 0 for Chapter
779
785
  number, then won't show anything).
780
- 1. Avoid need for separate `startEnd` for browse set;
786
+ 1. Avoid need for separate `<work name>-startEnd` for browse set;
781
787
  e.g., parse Rodwell or Sale?
782
788
  1. Ideally work across even book
783
789
  1. Support anchor portion (e.g., `1:2:3-1:2:5#1:2:4`)
@@ -785,6 +791,7 @@ it supports the following arguments:
785
791
  `activateCallback.js`
786
792
  1. Have **IndexedDB handle all pages** language select, work select, and
787
793
  work display be part of too?
794
+ 1. `indexedDB` for JSON data
788
795
  1. **Node.js** (or PHP?)
789
796
  1. Delivery of HTML content by same URL so third parties can
790
797
  consume without JavaScript and optimized when not offline
@@ -910,7 +917,9 @@ it supports the following arguments:
910
917
  and/or syntax (generic to *TextBrowser* and/or canonical, ideally
911
918
  human-readable based on JSON-supplied information; e.g., for the
912
919
  Bible, `Matt. 5:10-12`); use with `postMessage` to-do to supply
913
- syntax back to another site
920
+ syntax back to another site; see
921
+ [Scroll To Text fragment](https://wicg.github.io/ScrollToTextFragment/);
922
+ [Stack answer](https://stackoverflow.com/a/62162093/271577)
914
923
  1. Correct any field easily by links within TB to editing interface
915
924
  1. Add an "overlay" column like interlinear, but which overlays by
916
925
  tooltip if any data is present; can also use metadata if the
@@ -966,11 +975,13 @@ it supports the following arguments:
966
975
  <https://github.com/json-schema-org/json-schema-spec/issues/587#issuecomment-389726603>
967
976
  by using initial `$`?
968
977
  1. Find way to avoid need for `!important` in column CSS
969
- 1. Offer more border styling tuning controls (including right/left/top/bottom,
978
+ 1. Redirect automatically by accepted language, though have a link or
979
+ preference to change the default
980
+ 1. Offer more **border styling** tuning controls (including right/left/top/bottom,
970
981
  color, etc.); then offer this along with other styles if we replace CSS
971
982
  input box with pop-up styling form (like Advanced Formatting, but for columns)
972
- 1. Refactoring: Try to use `deserialize` of `form-serialization` fork for initial population
973
- or hash change?
983
+ 1. Refactoring: Try to use `deserialize` of `form-serialization` fork for
984
+ initial population or hash change? (if not `FormData`)
974
985
  1. We should try to allow `onByDefault` and `placement` for non-plugin
975
986
  fields also
976
987
  1. [ES6 Modules in browser](https://jakearchibald.com/2017/es-modules-in-browsers/):
@@ -1035,6 +1046,8 @@ it supports the following arguments:
1035
1046
 
1036
1047
  ## To-dos (Medium Priority)
1037
1048
 
1049
+ 1. Build "Preferred language(s)" to use awareness of content languages rather
1050
+ than locales.
1038
1051
  1. Remove need for separate metadata
1039
1052
  files per
1040
1053
  <https://github.com/json-schema-org/json-schema-spec/issues/587#issuecomment-389726603>
@@ -1044,8 +1057,8 @@ it supports the following arguments:
1044
1057
  with multiselect
1045
1058
  1. Preview styling changes (or move all controls to results page for
1046
1059
  immediate real feedback)
1047
- 1. Separate formatting within Jamilih code to CSS; unit test and performance
1048
- by being able to use a natively stringifying version of Jamilih
1060
+ 1. Separate **formatting within Jamilih code** to CSS; unit test and
1061
+ performance by being able to use a natively stringifying version of Jamilih
1049
1062
  (once complete)
1050
1063
  1. Utilize meta-data properties, `primary_text_field`, `orig_lang_field`,
1051
1064
  `orig_langs`, e.g., to allow for user to display main language and
@@ -1105,7 +1118,7 @@ it supports the following arguments:
1105
1118
 
1106
1119
  1. Waiting: Avoid superagent warning:
1107
1120
  <https://github.com/whitlockjc/path-loader/issues/17>
1108
- 1. Remember columns enabled, etc. since last visit, and/or saved as
1121
+ 1. **Remember columns enabled**, etc. since last visit, and/or saved as
1109
1122
  preferences.
1110
1123
  1. Allow copy-pasting a search as a custom web protocol (make
1111
1124
  site-configurable), e.g., to support `web+bahaiwritings:` links per
@@ -1124,8 +1137,6 @@ it supports the following arguments:
1124
1137
  1. Preference to remember enabled checkboxes and formatting
1125
1138
  1. Change to utilize history.pushState?
1126
1139
  <https://developer.mozilla.org/en-US/docs/Web/API/History_API>
1127
- 1. Use ES6 modules (babel)
1128
- 1. dynamic or hierarchical loading of CSS too?
1129
1140
  1. Sort file selection listing per locale?
1130
1141
  1. Node.js synchronization of locale files?
1131
1142
  1. Could allow Node to built schemas, optionally allowing or disallowing
@@ -1142,7 +1153,6 @@ it supports the following arguments:
1142
1153
  the i18n of "lang"?).
1143
1154
  1. `window.postMessage` API (since CORS is only for Ajax and
1144
1155
  `document.domain` is only for subdomains).
1145
- 1. `indexedDB` for JSON data
1146
1156
  1. Restore `tabindex` usage
1147
1157
  1. Restore option from work page to have a checkbox on whether to go to
1148
1158
  "Advanced mode", opening the styling options by default or not.
@@ -4229,9 +4229,14 @@ const getMetaProp = function getMetaProp (lang, metadataObj, properties, allowOb
4229
4229
  // file.anyOf.splice(1, 1, {$ref: schemaFile});
4230
4230
  // Todo: Allow use of dbs and fileGroup together in base directories?
4231
4231
  const getMetadata = async (file, property, basePath) => {
4232
+ const url = new URL(basePath || getCurrDir());
4233
+ url.search = ''; // Clear out query string, e.g., `?fbclid` from Facebook
4234
+ url.pathname = file;
4235
+ url.hash = property ? '#/' + property : '';
4236
+
4232
4237
  return (await JsonRefs
4233
4238
  .resolveRefsAt(
4234
- (basePath || getCurrDir()) + file + (property ? '#/' + property : ''),
4239
+ url.toString(),
4235
4240
  {
4236
4241
  loaderOptions: {
4237
4242
  processContent (res, callback) {
@@ -155,4 +155,4 @@ async function activateCallback ({
155
155
  });
156
156
  }
157
157
 
158
- export default activateCallback;
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
- if (enumerableOnly) {
8
- symbols = symbols.filter(function (sym) {
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] != null ? arguments[i] : {};
22
-
23
- if (i % 2) {
24
- ownKeys(Object(source), true).forEach(function (key) {
25
- _defineProperty(target, key, source[key]);
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
- result.minimumSignificantDigits = g1.length;
1489
- } // .### case
1490
- else if (g1[0] === '#') {
1491
- result.maximumSignificantDigits = g1.length;
1492
- } // .@@## or .@@@ case
1493
- else {
1494
- result.minimumSignificantDigits = g1.length;
1495
- result.maximumSignificantDigits = g1.length + (typeof g2 === 'string' ? g2.length : 0);
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
- result.maximumFractionDigits = g3.length;
1737
- } // .00## case
1738
- else if (g4 && g5) {
1739
- result.minimumFractionDigits = g4.length;
1740
- result.maximumFractionDigits = g4.length + g5.length;
1741
- } else {
1742
- result.minimumFractionDigits = g1.length;
1743
- result.maximumFractionDigits = g1.length;
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
- var result = this.parseArgument(nestingLevel, expectingCloseTag);
1957
+ var result = this.parseArgument(nestingLevel, expectingCloseTag);
1970
1958
 
1971
- if (result.err) {
1972
- return result;
1973
- }
1959
+ if (result.err) {
1960
+ return result;
1961
+ }
1974
1962
 
1975
- elements.push(result.val);
1976
- } else if (char === 125
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
- if (expectingCloseTag) {
1994
- break;
1995
- } else {
1996
- return this.error(error.ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));
1997
- }
1998
- } else if (char === 60
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
- return null;
2184
- } // Parse escaped char following the apostrophe, or early return if there is no escaped char.
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
- if (this.peek() === 39
2229
- /* `'` */
2230
- ) {
2231
- codePoints.push(39); // Bump one more time because we need to skip 2 characters.
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
- this.bump();
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
- this.bump();
2286
- return this.error(error.ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));
2287
- } // argument name
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
- return this.error(error.ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
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
- hasDigits = true;
2778
- decimal = decimal * 10 + (ch - 48);
2779
- this.bump();
2780
- } else {
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
- this.position.line += 1;
2865
- this.position.column = 1;
2866
- this.position.offset += 1;
2867
- } else {
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
- return (await JsonRefs.resolveRefsAt((basePath || getCurrDir()) + file + (property ? '#/' + property : ''), {
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
- })]]], ['div', [['button', {
16675
- title: l('bookmark_generation_tooltip'),
16676
- $on: {
16677
- async click() {
16678
- // Todo: Give option to edit (keywords and work URLs)
16679
- const date = Date.now();
16680
- const ADD_DATE = date;
16681
- const LAST_MODIFIED = date;
16682
- const blob = new Blob([new XMLSerializer().serializeToString(jml({
16683
- $document: {
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; // eslint-disable-next-line unicorn/prefer-prototype-methods -- Convenient
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
- breakout = true;
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 radar/no-duplicated-branches
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 TextBrowser;
19851
+ export { TextBrowser as default };