unicode-input-toolconverter 0.2.0 → 0.2.3
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/.nyc_output/out.json +8980 -1849
- package/CHANGES.md +15 -1
- package/README.md +6 -11
- package/_locales/en-US/messages.json +153 -6
- package/_locales/hu-HU/messages.json +153 -6
- package/_locales/pt-BR/messages.json +153 -6
- package/_locales/sv-SE/messages.json +153 -6
- package/babel.config.json +0 -1
- package/browser_action/characterSelection.js +18 -11
- package/browser_action/charrefConverters.js +286 -79
- package/browser_action/chartBuild.js +97 -27
- package/browser_action/encodingBehaviors.js +10 -7
- package/browser_action/entityBehaviors.js +42 -16
- package/browser_action/index-es.html +13 -1
- package/browser_action/index-instrumented.html +13 -1
- package/browser_action/index-pages.html +13 -1
- package/browser_action/index.html +13 -1
- package/browser_action/index.iife.min.js +9 -1
- package/browser_action/index.iife.min.js.map +1 -1
- package/browser_action/index.instrumented.iife.min.js +1 -1
- package/browser_action/index.instrumented.iife.min.js.map +1 -1
- package/browser_action/index.js +5 -5
- package/browser_action/preferences/prefDefaults.js +12 -3
- package/browser_action/service-worker/sw-activateCallback.js +1 -2
- package/browser_action/service-worker/sw-resources.json +6 -4
- package/browser_action/templateUtils/elements.js +12 -1
- package/browser_action/templateUtils/fill.js +6 -0
- package/browser_action/templateUtils/validation.js +4 -1
- package/browser_action/templates/chartBuild.js +167 -102
- package/browser_action/templates/index.js +227 -53
- package/browser_action/templatesElementCustomization/widgets.js +40 -15
- package/browser_action/unicode/UnicodeConverter.js +99 -73
- package/browser_action/unicode/charrefunicodeDb.js +100 -50
- package/browser_action/unicode/getScriptInfoForCodePoint.js +13 -4
- package/browser_action/unicode/hangul.js +27 -20
- package/browser_action/unicode/lastScriptNames.json +1 -1
- package/browser_action/unicode/parseUnihanFromTextFileStrings.js +44 -25
- package/browser_action/unicode/unicodeFieldInfo.js +112 -90
- package/browser_action/unicode/unicodeScripts.js +409 -35
- package/browser_action/unicode/unihan.js +4 -3
- package/browser_action/unicode/unihanDbPopulate.js +7 -2
- package/browser_action/unicode/unihanFields.js +34 -0
- package/browser_action/unicodecharref.js +353 -190
- package/browser_action/utils/DOMUtils.js +95 -34
- package/browser_action/utils/FetchUtils.js +7 -6
- package/browser_action/utils/TextUtils.js +4 -4
- package/browser_action/utils/TypedArrayUtils.js +9 -5
- package/browser_action/utils/semicolonSeparatedToArray.js +3 -3
- package/browser_action/utils/setupServiceWorker.js +2 -2
- package/eslint.config.js +11 -0
- package/icons/openWindow16.png +0 -0
- package/icons/openWindow24.png +0 -0
- package/lib/background.html +7 -0
- package/lib/background.js +2 -2
- package/package.json +80 -70
- package/pnpm-workspace.yaml +8 -0
- package/server.js +66 -51
- package/sw.js +97 -56
- package/tools/entities-import.js +4 -1
- package/tools/findEsResources.js +33 -10
- package/tools/fix-sw-resources-vendor-paths.js +60 -0
- package/tools/list-locales.js +2 -2
- package/tools/parseUnicodeCharts.js +126 -60
- package/tools/ucd-import.js +1 -10
- package/tools/unicode-charts.html +49 -20
- package/tools/unihan-import.js +45 -15
- package/tools/write-sw-version.js +16 -0
- package/tsconfig.json +23 -0
- package/typings/__coverage__.d.ts +5 -0
- package/typings/apple-system-profiler.d.ts +17 -0
- package/typings/commands.d.ts +19 -0
- package/typings/json-6.d.ts +4 -0
- package/typings/rollup-plugin-istanbul.d.ts +3 -0
- package/vendor/camelcase/index.d.ts +154 -0
- package/vendor/camelcase/index.js +137 -23
- package/vendor/fflate/esm/browser.d.ts +1539 -0
- package/vendor/fflate/esm/browser.js +82 -55
- package/vendor/intl-dom/dist/Formatter.d.ts +120 -0
- package/vendor/intl-dom/dist/Formatter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/collation.d.ts +42 -0
- package/vendor/intl-dom/dist/collation.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts +52 -0
- package/vendor/intl-dom/dist/defaultAllSubstitutions.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts +96 -0
- package/vendor/intl-dom/dist/defaultInsertNodes.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts +17 -0
- package/vendor/intl-dom/dist/defaultKeyCheckerConverter.d.ts.map +1 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts +285 -0
- package/vendor/intl-dom/dist/defaultLocaleResolver.d.ts.map +1 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts +88 -0
- package/vendor/intl-dom/dist/findLocaleStrings.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts +67 -0
- package/vendor/intl-dom/dist/getDOMForLocaleString.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts +73 -0
- package/vendor/intl-dom/dist/getMessageForKeyByStyle.d.ts.map +1 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts +26 -0
- package/vendor/intl-dom/dist/getStringFromMessageAndDefaults.d.ts.map +1 -0
- package/vendor/intl-dom/dist/i18n.d.ts +113 -0
- package/vendor/intl-dom/dist/i18n.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.d.ts +92 -0
- package/vendor/intl-dom/dist/index.d.ts.map +1 -0
- package/vendor/intl-dom/dist/index.esm.d.ts +34 -0
- package/vendor/intl-dom/dist/index.esm.js +854 -896
- package/vendor/intl-dom/dist/index.esm.min.js +4 -0
- package/vendor/intl-dom/dist/index.esm.min.js.map +1 -0
- package/vendor/intl-dom/dist/index.umd.js +2953 -0
- package/vendor/intl-dom/dist/index.umd.min.js +4 -0
- package/vendor/intl-dom/dist/index.umd.min.js.map +1 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts +34 -0
- package/vendor/intl-dom/dist/promiseChainForValues.d.ts.map +1 -0
- package/vendor/intl-dom/dist/shared.d.ts +20 -0
- package/vendor/intl-dom/dist/shared.d.ts.map +1 -0
- package/vendor/intl-dom/dist/utils.d.ts +53 -0
- package/vendor/intl-dom/dist/utils.d.ts.map +1 -0
- package/vendor/jamilih/dist/jml.d.mts +468 -0
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +1489 -343
- package/vendor/jquery/dist/jquery.js +1677 -2713
- package/vendor/json-6/dist/index.mjs +2 -0
- package/vendor/miller-columns/CHANGES.md +185 -0
- package/vendor/miller-columns/LICENSE-MIT.txt +21 -0
- package/vendor/miller-columns/README.md +249 -0
- package/vendor/miller-columns/demos/index.html +69 -0
- package/vendor/miller-columns/demos/index.js +72 -0
- package/vendor/miller-columns/dist/index-es.js +748 -0
- package/vendor/miller-columns/dist/index-es.min.d.ts +25 -0
- package/vendor/miller-columns/dist/index-es.min.js +7 -1
- package/vendor/miller-columns/dist/index-umd.js +757 -0
- package/vendor/miller-columns/dist/index-umd.min.js +7 -0
- package/vendor/miller-columns/dist/index.d.ts +25 -0
- package/vendor/miller-columns/dist/millerColumns.d.ts +10 -0
- package/vendor/miller-columns/eslint.config.js +46 -0
- package/vendor/miller-columns/fix-declarations.js +18 -0
- package/vendor/miller-columns/miller-columns.css +24 -1
- package/vendor/miller-columns/package.json +73 -0
- package/vendor/miller-columns/pnpm-workspace.yaml +2 -0
- package/vendor/miller-columns/src/index.js +642 -0
- package/vendor/miller-columns/src/millerColumns.ts +12 -0
- package/vendor/miller-columns/tsconfig-prod.json +23 -0
- package/vendor/miller-columns/tsconfig.json +21 -0
- package/vendor/simple-prefs/dist/index.esm.d.ts +1 -0
- package/vendor/simple-prefs/dist/index.esm.js +164 -216
- package/vendor/simple-prefs/dist/simple-prefs.d.ts +117 -0
- package/lgtm.yml +0 -5
|
@@ -1,13 +1,59 @@
|
|
|
1
|
-
import {jml} from '
|
|
1
|
+
import {jml} from 'jamilih/dist/jml.js';
|
|
2
2
|
import {getUnicodeDefaults} from './preferences/prefDefaults.js';
|
|
3
3
|
import chartBuildTemplate from './templates/chartBuild.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {{
|
|
7
|
+
* decyes: (k: number) => string,
|
|
8
|
+
* hexyes: (k: number) => string,
|
|
9
|
+
* unicodeyes: (k: number) => string,
|
|
10
|
+
* }} DisplayTypes
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {(info: {
|
|
15
|
+
* textReceptacle: HTMLTextAreaElement|HTMLInputElement,
|
|
16
|
+
* value: string
|
|
17
|
+
* }) => void} InsertText
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {InstanceType<ReturnType<
|
|
22
|
+
* typeof import('./unicode/UnicodeConverter.js').getUnicodeConverter
|
|
23
|
+
* >>} CharrefUnicodeConverter
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** @type {HTMLElement} */
|
|
27
|
+
let chartContainer;
|
|
28
|
+
|
|
29
|
+
/** @type {InsertText} */
|
|
30
|
+
let insertText;
|
|
31
|
+
|
|
32
|
+
/** @type {CharrefUnicodeConverter} */
|
|
33
|
+
let charrefunicodeConverter;
|
|
34
|
+
|
|
35
|
+
/** @type {import('intl-dom').I18NCallback<string>} */
|
|
36
|
+
let _;
|
|
37
|
+
|
|
38
|
+
/** @type {HTMLTextAreaElement|HTMLInputElement} */
|
|
39
|
+
let textReceptacle;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {{
|
|
43
|
+
* _: import('intl-dom').I18NCallback<string>,
|
|
44
|
+
* charrefunicodeConverter: CharrefUnicodeConverter,
|
|
45
|
+
* textReceptacle: HTMLTextAreaElement|HTMLInputElement,
|
|
46
|
+
* chartContainer: HTMLElement,
|
|
47
|
+
* descripts?: boolean,
|
|
48
|
+
* insertText: InsertText
|
|
49
|
+
* }} cfg
|
|
50
|
+
*/
|
|
7
51
|
const getChartBuild = async function ({
|
|
8
52
|
_: i18n,
|
|
9
53
|
descripts,
|
|
10
|
-
insertText: it,
|
|
54
|
+
insertText: it,
|
|
55
|
+
textReceptacle: tr,
|
|
56
|
+
chartContainer: cc,
|
|
11
57
|
charrefunicodeConverter: uc
|
|
12
58
|
}) {
|
|
13
59
|
textReceptacle = tr;
|
|
@@ -18,31 +64,44 @@ const getChartBuild = async function ({
|
|
|
18
64
|
return await chartBuild({descripts});
|
|
19
65
|
};
|
|
20
66
|
|
|
21
|
-
|
|
67
|
+
/** @type {number} */
|
|
22
68
|
export let lastStartCharCode;
|
|
23
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @param {{
|
|
72
|
+
* descripts?: boolean
|
|
73
|
+
* }} [cfg]
|
|
74
|
+
*/
|
|
24
75
|
const chartBuild = async function chartBuild ({descripts} = {}) {
|
|
25
76
|
const {getPref, setPref} = getUnicodeDefaults();
|
|
26
77
|
const [
|
|
27
78
|
startCharInMiddleOfChart,
|
|
28
|
-
cols,
|
|
79
|
+
cols,
|
|
80
|
+
onlyentsyes,
|
|
29
81
|
entyes, buttonyes, decyes, hexyes, unicodeyes,
|
|
30
82
|
hexLettersUpper,
|
|
31
83
|
font, lang,
|
|
32
84
|
tblrowsset, currentStartCharCodeInitial
|
|
33
85
|
] = await Promise.all([
|
|
34
|
-
'startCharInMiddleOfChart',
|
|
35
|
-
'tblcolsset',
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
'
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
86
|
+
getPref('startCharInMiddleOfChart'),
|
|
87
|
+
/** @type {Promise<number>} */ (getPref('tblcolsset')),
|
|
88
|
+
/** @type {Promise<boolean>} */ (getPref('onlyentsyes')),
|
|
89
|
+
/** @type {Promise<boolean>} */ (getPref('entyes')),
|
|
90
|
+
/** @type {Promise<boolean>} */ (getPref('buttonyes')),
|
|
91
|
+
getPref('decyes'),
|
|
92
|
+
getPref('hexyes'),
|
|
93
|
+
getPref('unicodeyes'),
|
|
94
|
+
getPref('hexLettersUpper'),
|
|
95
|
+
/** @type {Promise<string>} */ (getPref('font')),
|
|
96
|
+
/** @type {Promise<string>} */ (getPref('lang')),
|
|
97
|
+
getPref('tblrowsset'),
|
|
98
|
+
getPref('currentStartCharCode')
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
const current = {
|
|
102
|
+
startCharCode: /** @type {number} */ (currentStartCharCodeInitial)
|
|
103
|
+
};
|
|
104
|
+
let rows = /** @type {number} */ (tblrowsset);
|
|
46
105
|
|
|
47
106
|
lastStartCharCode = current.startCharCode;
|
|
48
107
|
|
|
@@ -63,9 +122,15 @@ const chartBuild = async function chartBuild ({descripts} = {}) {
|
|
|
63
122
|
}
|
|
64
123
|
resetCurrentStartCharCodeIfOutOfBounds();
|
|
65
124
|
|
|
66
|
-
// Todo: Document (or better name) what's going on here
|
|
67
|
-
|
|
68
|
-
|
|
125
|
+
// Todo: Document (or better name) what's going on here with these
|
|
126
|
+
/** @type {number|undefined} */
|
|
127
|
+
let q;
|
|
128
|
+
/** @type {number} */
|
|
129
|
+
let prev;
|
|
130
|
+
/** @type {number[]|undefined} */
|
|
131
|
+
let arr;
|
|
132
|
+
let remainder, rowceil, colsOverRemainder;
|
|
133
|
+
const descriptsOrOnlyEnts = onlyentsyes || Boolean(descripts);
|
|
69
134
|
if (descriptsOrOnlyEnts) {
|
|
70
135
|
arr = descripts
|
|
71
136
|
? charrefunicodeConverter.descripts
|
|
@@ -105,9 +170,11 @@ const chartBuild = async function chartBuild ({descripts} = {}) {
|
|
|
105
170
|
chartContainer.textContent = '';
|
|
106
171
|
|
|
107
172
|
const types = {hexyes, decyes, unicodeyes, entyes};
|
|
108
|
-
const appliedFormats = [
|
|
173
|
+
const appliedFormats = /** @type {const} */ ([
|
|
109
174
|
'decyes', 'hexyes', 'unicodeyes'
|
|
110
|
-
].filter((t) => types[t]);
|
|
175
|
+
]).filter((t) => types[t]);
|
|
176
|
+
|
|
177
|
+
/** @type {DisplayTypes} */
|
|
111
178
|
const displayTypes = {
|
|
112
179
|
decyes (k) {
|
|
113
180
|
return `&#${k};`;
|
|
@@ -123,24 +190,27 @@ const chartBuild = async function chartBuild ({descripts} = {}) {
|
|
|
123
190
|
}
|
|
124
191
|
};
|
|
125
192
|
|
|
193
|
+
/** @type {string[]} */
|
|
126
194
|
const captioncntnt = [];
|
|
127
195
|
['unicode', 'hex', 'dec', 'ent'].forEach((type) => {
|
|
128
|
-
if (
|
|
196
|
+
if (Object.hasOwn(
|
|
197
|
+
types, /** @type {keyof typeof types} */ (type + 'yes')
|
|
198
|
+
)) {
|
|
129
199
|
captioncntnt.push(_(type + '_noun'));
|
|
130
200
|
}
|
|
131
201
|
});
|
|
132
202
|
|
|
133
203
|
const captionContent = _.list([
|
|
134
204
|
// Make first letter of first word upper case
|
|
135
|
-
captioncntnt[0].replace(/^./
|
|
136
|
-
_.
|
|
205
|
+
captioncntnt[0].replace(/^./v, (s) => s.toLocaleUpperCase(
|
|
206
|
+
_.resolvedLocale
|
|
137
207
|
)),
|
|
138
208
|
...captioncntnt.slice(1)
|
|
139
209
|
]);
|
|
140
210
|
|
|
141
211
|
chartBuildTemplate({
|
|
142
212
|
_, rows, cols, charrefunicodeConverter, current,
|
|
143
|
-
resetCurrentStartCharCodeIfOutOfBounds, descriptsOrOnlyEnts,
|
|
213
|
+
resetCurrentStartCharCodeIfOutOfBounds, // descriptsOrOnlyEnts,
|
|
144
214
|
q, arr, textReceptacle, entyes, chartBuild, descripts,
|
|
145
215
|
chartContainer,
|
|
146
216
|
setPref, insertText, buttonyes, font, lang, prev,
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {$} from 'jamilih/dist/jml.js';
|
|
2
3
|
|
|
3
4
|
import {classChange as charrefClassChange} from './charrefConverters.js';
|
|
4
5
|
|
|
5
6
|
// UI Bridges
|
|
7
|
+
|
|
6
8
|
export const convertEncoding = (out) => {
|
|
7
9
|
const from = $('#encoding_from').value,
|
|
8
|
-
to = $('#encoding_to').value
|
|
9
|
-
toconvert = out;
|
|
10
|
+
to = $('#encoding_to').value;
|
|
10
11
|
|
|
11
12
|
if (!from || !to) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
const toconvert = out;
|
|
17
|
+
|
|
15
18
|
const Components = 'todo';
|
|
16
19
|
const Cc = Components.classes,
|
|
17
20
|
Ci = Components.interfaces;
|
|
@@ -48,10 +51,10 @@ export const convertEncoding = (out) => {
|
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
* @param {
|
|
52
|
-
* @param {import('intl-dom').I18NCallback} cfg._
|
|
53
|
-
* @returns {void}
|
|
54
|
-
*/
|
|
54
|
+
* @param {object} cfg
|
|
55
|
+
* @param {import('intl-dom').I18NCallback} cfg._
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
55
58
|
function setupEncodingEvents ({_}) {
|
|
56
59
|
/**
|
|
57
60
|
* @returns {void}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import {$} from '
|
|
1
|
+
import {$} from 'jamilih/dist/jml.js';
|
|
2
2
|
import {getUnicodeDefaults} from './preferences/prefDefaults.js';
|
|
3
3
|
import unicodecharref from './unicodecharref.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @type {InstanceType<ReturnType<
|
|
7
|
+
* typeof import('./unicode/UnicodeConverter.js').getUnicodeConverter
|
|
8
|
+
* >>}
|
|
9
|
+
*/
|
|
10
|
+
let charrefunicodeConverter;
|
|
11
|
+
|
|
12
|
+
/** @type {ReturnType<typeof getUnicodeDefaults>['getPref']} */
|
|
13
|
+
let getPref;
|
|
14
|
+
/** @type {ReturnType<typeof getUnicodeDefaults>['setPref']} */
|
|
15
|
+
let setPref;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {{
|
|
19
|
+
* charrefunicodeConverter: InstanceType<ReturnType<
|
|
20
|
+
* typeof import('./unicode/UnicodeConverter.js').getUnicodeConverter
|
|
21
|
+
* >>
|
|
22
|
+
* }} cfg
|
|
23
|
+
* @returns {void}
|
|
24
|
+
*/
|
|
6
25
|
export const shareVars = ({charrefunicodeConverter: _uc}) => {
|
|
7
26
|
charrefunicodeConverter = _uc;
|
|
8
27
|
({getPref, setPref} = getUnicodeDefaults());
|
|
@@ -14,22 +33,24 @@ export const shareVars = ({charrefunicodeConverter: _uc}) => {
|
|
|
14
33
|
*/
|
|
15
34
|
async function insertEntityFile (e) {
|
|
16
35
|
const entFile = await fetch(
|
|
17
|
-
'../download/entities/' +
|
|
36
|
+
'../download/entities/' + /** @type {HTMLSelectElement} */ (
|
|
37
|
+
e.target
|
|
38
|
+
).value + '.ent'
|
|
18
39
|
);
|
|
19
40
|
const data = await entFile.text();
|
|
20
41
|
|
|
21
|
-
$('#DTDtextbox').value += '\n' + data;
|
|
42
|
+
/** @type {HTMLTextAreaElement} */ ($('#DTDtextbox')).value += '\n' + data;
|
|
22
43
|
await registerDTD();
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
/**
|
|
26
|
-
* @returns {Promise<
|
|
47
|
+
* @returns {Promise<void>}
|
|
27
48
|
*/
|
|
28
49
|
async function registerDTD () {
|
|
29
50
|
// Cannot use back-reference inside char. class, so need to do twice
|
|
30
|
-
const pattern = /<!ENTITY\s+([^'"\s]*)\s+(["'])(.*)\2\s*>/
|
|
51
|
+
const pattern = /<!ENTITY\s+([^'"\s]*)\s+(["'])(.*)\2\s*>/gv;
|
|
31
52
|
|
|
32
|
-
const text = $('#DTDtextbox').value;
|
|
53
|
+
const text = /** @type {HTMLTextAreaElement} */ ($('#DTDtextbox')).value;
|
|
33
54
|
await setPref('DTDtextbox', text);
|
|
34
55
|
|
|
35
56
|
let result;
|
|
@@ -51,16 +72,17 @@ async function registerDTD () {
|
|
|
51
72
|
// Start off blank in case items erased
|
|
52
73
|
charrefunicodeConverter.newcharrefs = [...unicodecharref.orignewcharrefs];
|
|
53
74
|
|
|
54
|
-
const decreg = /^(?:&#|#)?(\d\d+);?$/
|
|
55
|
-
// const decreg2 = /^(&#|#)([0-9]);?$/
|
|
56
|
-
const hexreg = /^(?:&#|#|0|U|u)?(?:[xX+])([\da-fA-F]+);?$/
|
|
75
|
+
const decreg = /^(?:&#|#)?(\d\d+);?$/v;
|
|
76
|
+
// const decreg2 = /^(&#|#)([0-9]);?$/v;
|
|
77
|
+
const hexreg = /^(?:&#|#|0|U|u)?(?:[xX+])([\da-fA-F]+);?$/v;
|
|
57
78
|
|
|
58
79
|
while ((result = pattern.exec(text)) !== null) {
|
|
80
|
+
/** @type {number|string} */
|
|
59
81
|
let m = result[3];
|
|
60
82
|
let addreg = true;
|
|
61
83
|
if (decreg.test(m)) { // Dec
|
|
62
84
|
m = m.replace(decreg, '$1');
|
|
63
|
-
m = Number.parseInt(m);
|
|
85
|
+
m = Number.parseInt(m, 10);
|
|
64
86
|
} else if (hexreg.test(m)) { // Hex
|
|
65
87
|
m = m.replace(hexreg, '$1');
|
|
66
88
|
m = Number.parseInt(m, 16);
|
|
@@ -70,12 +92,15 @@ async function registerDTD () {
|
|
|
70
92
|
} else if (m.length > 1) {
|
|
71
93
|
addreg = false;
|
|
72
94
|
} else {
|
|
73
|
-
m = m.charCodeAt();
|
|
95
|
+
m = m.charCodeAt(0);
|
|
74
96
|
}
|
|
75
97
|
if (addreg) {
|
|
76
98
|
// Used to ensure apos or amp is detected in same position
|
|
77
99
|
charrefunicodeConverter.entities.unshift(result[1]);
|
|
78
|
-
charrefunicodeConverter.numericCharacterReferences.unshift(
|
|
100
|
+
charrefunicodeConverter.numericCharacterReferences.unshift(
|
|
101
|
+
/** @type {number} */
|
|
102
|
+
(m)
|
|
103
|
+
);
|
|
79
104
|
// For translating entities into two-char+ Unicode, or hex or dec
|
|
80
105
|
} else {
|
|
81
106
|
charrefunicodeConverter.newents.push(result[1]);
|
|
@@ -85,10 +110,11 @@ async function registerDTD () {
|
|
|
85
110
|
}
|
|
86
111
|
|
|
87
112
|
/**
|
|
88
|
-
* @returns {void}
|
|
89
|
-
*/
|
|
113
|
+
* @returns {void}
|
|
114
|
+
*/
|
|
90
115
|
function setupEntityEvents () {
|
|
91
|
-
|
|
116
|
+
/** @type {HTMLSelectElement} */
|
|
117
|
+
($('#insertEntityFile')).addEventListener('change', async function (e) {
|
|
92
118
|
await insertEntityFile(e);
|
|
93
119
|
});
|
|
94
120
|
}
|
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
<title>-</title>
|
|
6
6
|
<!-- Temporary favicon no-op -->
|
|
7
7
|
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
|
8
|
-
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"jamilih/dist/jml.js": "../vendor/jamilih/dist/jml.mjs",
|
|
12
|
+
"miller-columns": "../vendor/miller-columns/dist/index-es.min.js",
|
|
13
|
+
"camelcase": "../../vendor/camelcase/index.js",
|
|
14
|
+
"intl-dom": "../vendor/intl-dom/dist/index.esm.js",
|
|
15
|
+
"simple-prefs": "../../vendor/simple-prefs/dist/index.esm.js",
|
|
16
|
+
"fflate": "../vendor/fflate/esm/browser.js",
|
|
17
|
+
"json-6": "../vendor/json-6/dist/index.mjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
9
21
|
<script src="/vendor/jquery/dist/jquery.js"></script>
|
|
10
22
|
<!-- <script src="/polyfills/browser-polyfill.min.js"></script> -->
|
|
11
23
|
<script type="module" src="/browser_action/index.js"></script>
|
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
<title>-</title>
|
|
6
6
|
<!-- Temporary favicon no-op -->
|
|
7
7
|
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
|
8
|
-
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"jamilih/dist/jml.js": "../vendor/jamilih/dist/jml.mjs",
|
|
12
|
+
"miller-columns": "../vendor/miller-columns/dist/index-es.min.js",
|
|
13
|
+
"camelcase": "../../vendor/camelcase/index.js",
|
|
14
|
+
"intl-dom": "../vendor/intl-dom/dist/index.esm.js",
|
|
15
|
+
"simple-prefs": "../../vendor/simple-prefs/dist/index.esm.js",
|
|
16
|
+
"fflate": "../vendor/fflate/esm/browser.js",
|
|
17
|
+
"json-6": "../vendor/json-6/dist/index.mjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
9
21
|
<script src="/vendor/jquery/dist/jquery.js"></script>
|
|
10
22
|
<!-- <script src="/polyfills/browser-polyfill.min.js"></script> -->
|
|
11
23
|
<!-- <script type="module" src="/browser_action/index.js"></script> -->
|
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
<title>-</title>
|
|
6
6
|
<!-- Temporary favicon no-op -->
|
|
7
7
|
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
|
8
|
-
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"jamilih/dist/jml.js": "../vendor/jamilih/dist/jml.mjs",
|
|
12
|
+
"miller-columns": "../vendor/miller-columns/dist/index-es.min.js",
|
|
13
|
+
"camelcase": "../../vendor/camelcase/index.js",
|
|
14
|
+
"intl-dom": "../vendor/intl-dom/dist/index.esm.js",
|
|
15
|
+
"simple-prefs": "../../vendor/simple-prefs/dist/index.esm.js",
|
|
16
|
+
"fflate": "../vendor/fflate/esm/browser.js",
|
|
17
|
+
"json-6": "../vendor/json-6/dist/index.mjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
9
21
|
<script src="../vendor/jquery/dist/jquery.js"></script>
|
|
10
22
|
<!-- <script src="/polyfills/browser-polyfill.min.js"></script> -->
|
|
11
23
|
<!-- <script type="module" src="/browser_action/index.js"></script> -->
|
|
@@ -5,7 +5,19 @@
|
|
|
5
5
|
<title>-</title>
|
|
6
6
|
<!-- Temporary favicon no-op -->
|
|
7
7
|
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
|
8
|
-
|
|
8
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"jamilih/dist/jml.js": "../vendor/jamilih/dist/jml.mjs",
|
|
12
|
+
"miller-columns": "../vendor/miller-columns/dist/index-es.min.js",
|
|
13
|
+
"camelcase": "../../vendor/camelcase/index.js",
|
|
14
|
+
"intl-dom": "../vendor/intl-dom/dist/index.esm.js",
|
|
15
|
+
"simple-prefs": "../../vendor/simple-prefs/dist/index.esm.js",
|
|
16
|
+
"fflate": "../vendor/fflate/esm/browser.js",
|
|
17
|
+
"json-6": "../vendor/json-6/dist/index.mjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
9
21
|
<script src="/vendor/jquery/dist/jquery.js"></script>
|
|
10
22
|
<!-- <script src="/polyfills/browser-polyfill.min.js"></script> -->
|
|
11
23
|
<!-- <script type="module" src="/browser_action/index.js"></script> -->
|