textbrowser 0.40.3 → 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/CHANGES.md +5 -0
- package/README.md +6 -3
- package/dist/index-es.js +24 -72
- package/dist/index-es.min.js +2 -2
- package/dist/index-umd.js +24 -72
- package/dist/index-umd.min.js +2 -2
- package/package.json +14 -15
- package/resources/index.js +4 -1
- package/resources/templates/workDisplay.js +7 -82
- package/resources/workDisplay.js +3 -1
- package/server/main-cjs.js +16 -70
package/CHANGES.md
CHANGED
package/README.md
CHANGED
|
@@ -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)
|
|
@@ -739,9 +744,7 @@ it supports the following arguments:
|
|
|
739
744
|
1. Document and add **screen-casts** along with one for developers showing
|
|
740
745
|
JSON format, metadata, and schemas); also use with shortcuts (including
|
|
741
746
|
Bahá'í Library Online ones)
|
|
742
|
-
1.
|
|
743
|
-
from Facebook.
|
|
744
|
-
0. Progressive web app? / Electron?
|
|
747
|
+
1. Progressive web app? / Electron?
|
|
745
748
|
1. Adapt approach of <https://suttacentral.net/offline> in providing form for
|
|
746
749
|
choice of items to offline (also add to individual work pages).
|
|
747
750
|
1. Mention idea that it works offline
|
package/dist/index-es.js
CHANGED
|
@@ -16597,7 +16597,8 @@ var workDisplay$1 = {
|
|
|
16597
16597
|
localizeParamNames,
|
|
16598
16598
|
namespace,
|
|
16599
16599
|
hideFormattingSection,
|
|
16600
|
-
groups
|
|
16600
|
+
groups,
|
|
16601
|
+
preferencesPlugin
|
|
16601
16602
|
}) => ['div', {
|
|
16602
16603
|
style: {
|
|
16603
16604
|
textAlign: 'left'
|
|
@@ -16664,73 +16665,16 @@ var workDisplay$1 = {
|
|
|
16664
16665
|
}
|
|
16665
16666
|
|
|
16666
16667
|
return ['option', atts, [imfl(['languages', lan.code])]];
|
|
16667
|
-
})]]],
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
$DOCTYPE: {
|
|
16678
|
-
name: 'NETSCAPE-Bookmark-file-1'
|
|
16679
|
-
},
|
|
16680
|
-
title: l('Bookmarks'),
|
|
16681
|
-
body: [['h1', [l('Bookmarks_Menu')]], ...(await getFieldAliasOrNames()).flatMap(({
|
|
16682
|
-
groupName,
|
|
16683
|
-
worksToFields
|
|
16684
|
-
}) => {
|
|
16685
|
-
return [['dt', [['h3', {
|
|
16686
|
-
ADD_DATE,
|
|
16687
|
-
LAST_MODIFIED
|
|
16688
|
-
}, [groupName]]]], ['dl', [['p'], ...worksToFields.map(({
|
|
16689
|
-
fieldAliasOrNames,
|
|
16690
|
-
workName,
|
|
16691
|
-
shortcut: SHORTCUTURL
|
|
16692
|
-
}) => {
|
|
16693
|
-
// Todo (low): Add anchor, etc. (until handled by `work-startEnd`); &aqdas-anchor1-1=2&anchorfield1=Paragraph
|
|
16694
|
-
// Todo: option for additional browse field groups (startEnd2, etc.)
|
|
16695
|
-
// Todo: For link text, use `heading` or `alias` from metadata files in place of workName (requires loading all metadata files though)
|
|
16696
|
-
// 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/
|
|
16697
|
-
const paramsCopy = paramsSetter(_objectSpread2(_objectSpread2({}, getDataForSerializingParamsAsURL()), {}, {
|
|
16698
|
-
fieldAliasOrNames,
|
|
16699
|
-
workName: work,
|
|
16700
|
-
// Delete work of current page
|
|
16701
|
-
type: 'shortcutResult'
|
|
16702
|
-
}));
|
|
16703
|
-
const url = replaceHash(paramsCopy) + `&work=${workName}&${workName}-startEnd1=%s`; // %s will be escaped if set as param; also add changeable workName here
|
|
16704
|
-
|
|
16705
|
-
return ['dt', [['a', {
|
|
16706
|
-
href: url,
|
|
16707
|
-
ADD_DATE,
|
|
16708
|
-
LAST_MODIFIED,
|
|
16709
|
-
SHORTCUTURL
|
|
16710
|
-
}, [workName]]]];
|
|
16711
|
-
})]]];
|
|
16712
|
-
})]
|
|
16713
|
-
}
|
|
16714
|
-
})).replace( // Chrome has a quirk that requires this (and not
|
|
16715
|
-
// just any whitespace)
|
|
16716
|
-
// We're not getting the keywords with Chrome,
|
|
16717
|
-
// but at least usable for bookmarks (though
|
|
16718
|
-
// not the groups apparently)
|
|
16719
|
-
/<dt>/g, '\n<dt>')], {
|
|
16720
|
-
type: 'text/html'
|
|
16721
|
-
});
|
|
16722
|
-
const url = window.URL.createObjectURL(blob);
|
|
16723
|
-
const a = jml('a', {
|
|
16724
|
-
hidden: true,
|
|
16725
|
-
download: 'bookmarks.html',
|
|
16726
|
-
href: url
|
|
16727
|
-
}, $$1('#main'));
|
|
16728
|
-
a.click();
|
|
16729
|
-
URL.revokeObjectURL(url);
|
|
16730
|
-
}
|
|
16731
|
-
|
|
16732
|
-
}
|
|
16733
|
-
}, [l('Generate_bookmarks')]]]]]],
|
|
16668
|
+
})]]], preferencesPlugin ? preferencesPlugin({
|
|
16669
|
+
$: $$1,
|
|
16670
|
+
l,
|
|
16671
|
+
jml,
|
|
16672
|
+
paramsSetter,
|
|
16673
|
+
getDataForSerializingParamsAsURL,
|
|
16674
|
+
work,
|
|
16675
|
+
replaceHash,
|
|
16676
|
+
getFieldAliasOrNames
|
|
16677
|
+
}) : '']],
|
|
16734
16678
|
|
|
16735
16679
|
addBrowseFields({
|
|
16736
16680
|
browseFields,
|
|
@@ -16882,7 +16826,8 @@ var workDisplay$1 = {
|
|
|
16882
16826
|
preferredLocale,
|
|
16883
16827
|
schemaItems,
|
|
16884
16828
|
content,
|
|
16885
|
-
groups
|
|
16829
|
+
groups,
|
|
16830
|
+
preferencesPlugin
|
|
16886
16831
|
}) {
|
|
16887
16832
|
const work = $p.get('work');
|
|
16888
16833
|
|
|
@@ -16933,7 +16878,8 @@ var workDisplay$1 = {
|
|
|
16933
16878
|
localizeParamNames,
|
|
16934
16879
|
namespace,
|
|
16935
16880
|
groups,
|
|
16936
|
-
hideFormattingSection
|
|
16881
|
+
hideFormattingSection,
|
|
16882
|
+
preferencesPlugin
|
|
16937
16883
|
})]], ['h2', [heading]], ['br'], ['form', {
|
|
16938
16884
|
id: 'browse',
|
|
16939
16885
|
$custom: {
|
|
@@ -17940,6 +17886,9 @@ async function workDisplay({
|
|
|
17940
17886
|
fallbackLanguages,
|
|
17941
17887
|
$p
|
|
17942
17888
|
}) {
|
|
17889
|
+
const {
|
|
17890
|
+
preferencesPlugin
|
|
17891
|
+
} = this;
|
|
17943
17892
|
const langs = this.langData.languages;
|
|
17944
17893
|
const fallbackDirection = this.getDirectionForLanguageCode(fallbackLanguages[0]);
|
|
17945
17894
|
const prefI18n = localStorage.getItem(this.namespace + '-localizeParamNames');
|
|
@@ -18106,7 +18055,8 @@ async function workDisplay({
|
|
|
18106
18055
|
fieldMatchesLocale,
|
|
18107
18056
|
preferredLocale,
|
|
18108
18057
|
schemaItems,
|
|
18109
|
-
content
|
|
18058
|
+
content,
|
|
18059
|
+
preferencesPlugin
|
|
18110
18060
|
});
|
|
18111
18061
|
}
|
|
18112
18062
|
|
|
@@ -19488,6 +19438,7 @@ class TextBrowser {
|
|
|
19488
19438
|
this.requestPersistentStorage = options.requestPersistentStorage;
|
|
19489
19439
|
this.localizeParamNames = options.localizeParamNames === undefined ? true : options.localizeParamNames;
|
|
19490
19440
|
this.hideFormattingSection = Boolean(options.hideFormattingSection);
|
|
19441
|
+
this.preferencesPlugin = options.preferencesPlugin;
|
|
19491
19442
|
this.interlinearSeparator = options.interlinearSeparator; // Todo: Make these user facing options
|
|
19492
19443
|
|
|
19493
19444
|
this.showEmptyInterlinear = options.showEmptyInterlinear;
|
|
@@ -19859,7 +19810,8 @@ class TextBrowser {
|
|
|
19859
19810
|
fallbackLanguages,
|
|
19860
19811
|
languageParam,
|
|
19861
19812
|
$p,
|
|
19862
|
-
languages
|
|
19813
|
+
languages,
|
|
19814
|
+
preferencesPlugin: this.preferencesPlugin
|
|
19863
19815
|
});
|
|
19864
19816
|
return true;
|
|
19865
19817
|
}
|