@@ -145,25 +145,13 @@ export default {
this.$nextTick(function() {
Promise.all(allPromises).then(() => {
-
-
-
- let hyphenopoly = document.createElement('script'),
- hyph = document.createElement('script');
- hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
- hyph.setAttribute('src', 'lib/hyph.js')
- document.head.appendChild(hyph)
- document.head.appendChild(hyphenopoly)
- hyph.onload = () => {
- Hyphenopoly.handleEvent = {
- hyphenopolyEnd: (e) => {
- let previewer = new Previewer();
- previewer.preview();
- }
- };
-
- };
-
+ let previewer = new Previewer();
+ previewer.preview().then((flow)=>{
+ let layouts = Array.from(document.querySelectorAll(".layout"));
+ layouts.forEach(l=>{
+ l.classList.add("full-layout");
+ });
+ });
});
});
diff --git a/static/lib/Hyphenopoly-master/.eslintrc b/static/lib/Hyphenopoly-master/.eslintrc
deleted file mode 100644
index 08787f7..0000000
--- a/static/lib/Hyphenopoly-master/.eslintrc
+++ /dev/null
@@ -1,117 +0,0 @@
-{
- "parserOptions": {
- "ecmaVersion": 2018
- },
- "env": {
- "browser": true,
- "es6": true
- },
- "plugins": [
- "security"
- ],
- "extends": [
- "eslint:all",
- "plugin:security/recommended"
- ],
- "rules": {
- "no-undef": "error",
- "complexity": [
- "error",
- 6
- ],
- "require-unicode-regexp": 0,
- "require-jsdoc": [
- "error",
- {
- "require": {
- "FunctionDeclaration": true,
- "MethodDefinition": true,
- "ClassDeclaration": true,
- "ArrowFunctionExpression": true,
- "FunctionExpression": true
- }
- }
- ],
- "no-template-curly-in-string": 2,
- "prefer-template": 0,
- "wrap-iife": 1,
- "max-lines": 0,
- "max-lines-per-function": 0,
- "max-len": [
- 1,
- {
- "ignoreStrings": true,
- "ignoreTemplateLiterals": true
- }
- ],
- "max-statements": 0,
- "space-before-function-paren": [
- 1,
- {
- "anonymous": "always",
- "named": "never",
- "asyncArrow": "never"
- }
- ],
- "padded-blocks": [
- 1,
- "never"
- ],
- "id-length": [
- 1,
- {
- "min": 1
- }
- ],
- "one-var": 0,
- "func-names": [
- 1,
- "as-needed"
- ],
- "func-style": [
- 1,
- "declaration"
- ],
- "object-shorthand": 0,
- "prefer-arrow-callback": 0,
- "no-param-reassign": 0,
- "no-extra-parens": 0,
- "array-element-newline": [
- 1,
- {
- "multiline": true,
- "minItems": 12
- }
- ],
- "no-magic-numbers": 0,
- "function-paren-newline": [
- 1,
- "consistent"
- ],
- "function-call-argument-newline": [
- 1,
- "consistent"
- ],
- "no-ternary": 0,
- "no-nested-ternary": 0,
- "prefer-destructuring": 0,
- "max-params": [
- 1,
- 5
- ],
- "lines-around-comment": [
- 1,
- {
- "allowBlockStart": true
- }
- ],
- "sort-keys": [
- 1,
- "asc",
- {
- "caseSensitive": false
- }
- ]
- },
- "reportUnusedDisableDirectives": true
-}
\ No newline at end of file
diff --git a/static/lib/Hyphenopoly-master/.travis.yml b/static/lib/Hyphenopoly-master/.travis.yml
deleted file mode 100644
index 386b3ee..0000000
--- a/static/lib/Hyphenopoly-master/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: node_js
-cache: bundler
-node_js:
- - "10"
-notifications:
- email: false
\ No newline at end of file
diff --git a/static/lib/Hyphenopoly-master/CHANGELOG.md b/static/lib/Hyphenopoly-master/CHANGELOG.md
deleted file mode 100644
index 8200cd5..0000000
--- a/static/lib/Hyphenopoly-master/CHANGELOG.md
+++ /dev/null
@@ -1,153 +0,0 @@
-# Version History
-
-## Version 3.4.0 (2019-12-26)
-### Added
-* Option to disable mixed cased words (issue #91)
-
-### Fixed
-* Refactor encloseHyphenateFunction and enclHyphenate
-* bump devDependencies
-
-## Version 3.3.0 (2019-10-14)
-### Added
-* Add configuration option `keepAlive` (issue #69)
-* Add documentation for issue #89
-
-### Fixed
-* Fixed issue where babelized Loader didn't work in iOS9 (issue #88)
-* bump dev Dependencies (removed some unused eslint directives)
-
-## Version 3.2.1 (2019-08-29)
-Bugfix release, because I had to unpublish from npm
-
-## Version 3.2.0 (2019-08-29)
-### Fixed
-* Fixed issue with SSL Certificates and FireFox 60.x ESR (issue #85)
-* Fixed "a potential security vulnerability" in github-pages dependencies
-* Fixed issue with Firefox 68, where feature detection in Hyphenopoly_Loader fails
-* bump devDependencies
-
-### Changed
-* OnCopy-eventHandler now also includes content with type "text/html" (besides "text/plain") (issue #87)
-
-## Version 3.1.2 (2019-07-24)
-### Fixed
-* Fixed "Critical dependency: the request of a dependency is an expression" in webpack (issue #70)
-* bump devDependencies
-
-## Version 3.1.1 (2019-06-28)
-### Fixed
-* bump devDependencies
-
-### Changed
-* doc: uild github page from docs folder
-* tools: move eslint config from package.json to .eslintrc
-* tools: remove manual replacement of mutable globals when compiling to wasm
-
-## Version 3.1.0 (2019-05-28)
-### Fixed
-* Correctly reject hyphenator promises (issue #77)
-* performance: reduce file size of Hyphenopoly_Loader.js
-* update devDependencies
-
-### Added
-* feature: get maindir and patterndir from currentScript
-
-## Version 3.0.2 (2019-04-28)
-### Security
-* refactor(Loader): don't use innerHTML
-### Fixed
-* performance: slightly improved hyphenEngine
-* bump devDependencies
-
-## Version 3.0.1 (2019-04-04)
-### Fixed
-* Improve the way how `registerOnCopy` builds a closure. This prevents a memory leak.
-* Removed "use strict" from RunKit example.
-* Adapt the initial sizes of wasm-memory in some special cases
-
-## Version 3.0.0 (2019-03-29)
-### Changed
-* BREAKING CHANGE: implement new hyphenation pattern binary (.hpb) format (issue #61)
- * update patterns to new format and include left-/rightmin according to source
- * update hyphenEngine.asm/.wasm to consume new pattern format
- * implement .hpb-version-check in Hyphenopoly.js and hyphenopoly.module.js
- * fix issue #65
-
-### Added
-* feat: tearDown event (issue #67)
-* feat: loadError event (issue #59)
-* feat: hyphenopoly.module is now browserifyable. Added new config option "loader"
-
-### Removed
-* BREAKING CHANGE: remove `Hyphenopoly.setup.classnames` – use [selectors](https://github.com/mnater/Hyphenopoly/wiki/Global-Hyphenopoly-Object#new-with-version-260-selectors) instead
-
-## Version 2.8.0 (Feb 28, 2019)
-* the error event now accepts a `lvl` field ("info"/"warn"/"error") and logs accordingly (issue #56)
-* add list of supported languages in hyphenopoly.module.js (issue #57)
-* improve loading of ressources (issue #58)
-
-## Version 2.7.0 (Feb 01, 2019)
-* implement sync mode for node module (issue #43)
-* implement sync mode for hyphenopoly.module.js (issue #47)
-* fixed issue with Hyphenopoly.config sometimes not resolving (issue #52)
-* enable viewport dependent hyphenation (issue #53)
-* implement `Hyphenopoly.unhyphenate()` (needed for issue #53)
-* get good grades in codacy.com
-
-## Version 2.6.1 (Jan 09, 2018)
-* dontHyphenateClass is configurable (issue #48)
-* fixed issue with StringDecoder in older node versions (issue #45)
-* small refactorings for smaller codesize
-* fixed a StateError in IE 11
-
-## Version 2.6.0 (Dec 01, 2018)
-* improve hiding of elements while hyphenating (issue #40)
-* fix several issues with lang-fallbacks (issue #41 and #44)
-* new feature: use selectors instead of classnames (issue #42)
-* updated german patterns (issue #45)
-
-## Version 2.5.1 (Nov 04, 2018)
-* remove "Church Slavonic" patterns (see #38)
-* fix issue #39
-
-## Version 2.5.0 (Oct 02, 2018)
-* fix issues with very long word (#33 and #34)
-* Hyphenopoly exposes [Hyphenators](https://github.com/mnater/Hyphenopoly/wiki/Hyphenators)
-* fix issues with very long word (#33 and #34)
-* hyphenopoly.module.js is now [easy to use with browserify](https://github.com/mnater/Hyphenopoly/wiki/browserify)
-
-## Version 2.4.0 (Sept 01, 2018)
-* Implement fallback mechanism for language subtags where no patterns are available (e.g. en-au -> en-gb) [#29](https://github.com/mnater/Hyphenopoly/issues/29)
-* updated patterns for Thai [#25](https://github.com/hyphenation/tex-hyphen/pull/25)
-
-## Version 2.3.0 (Juli 26, 2018)
-* Don't use template strings [#28](https://github.com/mnater/Hyphenopoly/issues/28)
-* run feature test for wasm support only if necessary
-* define node >=8.3.0 as requirement (for util.TextDecoder)
-* small refactorings
-
-## Version 2.2.0 (June 26, 2018)
-* provide example.js for RunKit
-* use tap instead of mocha
-* [6f9e539](https://github.com/mnater/Hyphenopoly/commit/6f9e539a5dab2d1eff5bdeb0c7857c6fda9eb41e)
-* bugfix: [#24](https://github.com/mnater/Hyphenopoly/issues/24): [aeefe6e](https://github.com/mnater/Hyphenopoly/commit/aeefe6e3a59e8356abc99ca490acabf6c3374d7b)
-
-## Version 2.1.0 (Mai 27, 2018)
-* Configure Travis-CI
-* bugfixes
-
-## Version 2.0.0 (Mai 27, 2018)
-* Provide [node module](https://github.com/mnater/Hyphenopoly/wiki/Node-Module)
-* default file locations better reflect usual installations [#19](https://github.com/mnater/Hyphenopoly/issues/19)
-* Add ability to store results of feature tests (optional) [#22](https://github.com/mnater/Hyphenopoly/issues/22)
-* better error handling (f4bbaa7759eed24208e5cd7c744f1131262abb20, 1c7b0b67666b507d6f6b02eea38460562a5835e4)
-* correct implementation of e.preventDefault (df988788db6fb7120fc0c8a1cff1c91aac5a3998)
-* fix string normalization (a3229f730f79ccdd3054cbac257b2345f5c8e11a)
-* Better tooling: minify, eslint, testing (mocha), compiling [devDependencies](https://github.com/mnater/Hyphenopoly/wiki/Usage-of-devDependencies)
-
-## Version 1.0.1 (Mai 13, 2018)
-Prevent browsers to force layout on feature test in some cases.
-
-## Version 1.0.0 (Mai 12, 2018)
-First release
diff --git a/static/lib/Hyphenopoly-master/Hyphenopoly.js b/static/lib/Hyphenopoly-master/Hyphenopoly.js
deleted file mode 100644
index 702f39d..0000000
--- a/static/lib/Hyphenopoly-master/Hyphenopoly.js
+++ /dev/null
@@ -1,1196 +0,0 @@
-/**
- * @license Hyphenopoly 3.4.0 - client side hyphenation for webbrowsers
- * ©2019 Mathias Nater, Zürich (mathiasnater at gmail dot com)
- * https://github.com/mnater/Hyphenopoly
- *
- * Released under the MIT license
- * http://mnater.github.io/Hyphenopoly/LICENSE
- */
-
-/* globals asmHyphenEngine:readonly, Hyphenopoly:readonly */
-
-(function mainWrapper(w) {
- "use strict";
- const SOFTHYPHEN = String.fromCharCode(173);
-
- /**
- * Create Object without standard Object-prototype
- * @returns {Object} empty object
- */
- function empty() {
- return Object.create(null);
- }
-
- /**
- * Polyfill Math.imul
- * @param {number} a LHS
- * @param {number} b RHS
- * @returns {number} empty object
- */
- /* eslint-disable no-bitwise */
- Math.imul = Math.imul || function imul(a, b) {
- const aHi = (a >>> 16) & 0xffff;
- const aLo = a & 0xffff;
- const bHi = (b >>> 16) & 0xffff;
- const bLo = b & 0xffff;
-
- /*
- * The shift by 0 fixes the sign on the high part.
- * The final |0 converts the unsigned value into a signed value
- */
- return ((aLo * bLo) + ((((aHi * bLo) + (aLo * bHi)) << 16) >>> 0) | 0);
- };
- /* eslint-enable no-bitwise */
-
- /**
- * Set value and properties of object member
- * Argument
is a bit pattern:
- * 1. bit: configurable
- * 2. bit: enumerable
- * 3. bit writable
- * e.g. 011(2) = 3(10) => configurable: f, enumerable: t, writable: t
- * or 010(2) = 2(10) => configurable: f, enumerable: t, writable: f
- * @param {any} val The value
- * @param {number} props bitfield
- * @returns {Object} Property object
- */
- function setProp(val, props) {
- /* eslint-disable no-bitwise, sort-keys */
- return {
- "configurable": (props & 4) > 0,
- "enumerable": (props & 2) > 0,
- "writable": (props & 1) > 0,
- "value": val
- };
- /* eslint-enable no-bitwise, sort-keys */
- }
-
- /**
- * Register copy event on element
- * @param {Object} el The element
- * @returns {undefined}
- */
- function registerOnCopy(el) {
- el.addEventListener(
- "copy",
- function oncopy(e) {
- e.preventDefault();
- const sel = w.getSelection();
- const docFrag = sel.getRangeAt(0).cloneContents();
- const div = document.createElement("div");
- div.appendChild(docFrag);
- const selectedHTML = div.innerHTML;
- const selectedText = sel.toString();
- /* eslint-disable security/detect-non-literal-regexp */
- e.clipboardData.setData("text/plain", selectedText.replace(new RegExp(SOFTHYPHEN, "g"), ""));
- e.clipboardData.setData("text/html", selectedHTML.replace(new RegExp(SOFTHYPHEN, "g"), ""));
- /* eslint-enable security/detect-non-literal-regexp */
- },
- true
- );
- }
-
- (function configurationFactory(H) {
- const generalDefaults = Object.create(null, {
- "defaultLanguage": setProp("en-us", 2),
- "dontHyphenate": setProp((function createList() {
- const r = empty();
- const list = "abbr,acronym,audio,br,button,code,img,input,kbd,label,math,option,pre,samp,script,style,sub,sup,svg,textarea,var,video";
- list.split(",").forEach(function add(value) {
- /* eslint-disable security/detect-object-injection */
- r[value] = true;
- /* eslint-enable security/detect-object-injection */
- });
- return r;
- }()), 2),
- "dontHyphenateClass": setProp("donthyphenate", 2),
- "exceptions": setProp(empty(), 2),
- "keepAlive": setProp(true, 2),
- "normalize": setProp(false, 2),
- "safeCopy": setProp(true, 2),
- "timeout": setProp(1000, 2)
- });
-
- const settings = Object.create(generalDefaults);
-
- const perClassDefaults = Object.create(null, {
- "compound": setProp("hyphen", 2),
- "hyphen": setProp(SOFTHYPHEN, 2),
- "leftmin": setProp(0, 2),
- "leftminPerLang": setProp(0, 2),
- "minWordLength": setProp(6, 2),
- "mixedCase": setProp(true, 2),
- "orphanControl": setProp(1, 2),
- "rightmin": setProp(0, 2),
- "rightminPerLang": setProp(0, 2)
- });
-
- Object.keys(H.setup).forEach(function copySettings(key) {
- if (key === "selectors") {
- const selectors = Object.keys(H.setup.selectors);
- Object.defineProperty(
- settings,
- "selectors",
- setProp(selectors, 2)
- );
- selectors.forEach(function copySelectors(sel) {
- const tmp = empty();
- /* eslint-disable security/detect-object-injection */
- Object.keys(H.setup.selectors[sel]).forEach(
- function copySelectorSettings(k) {
- tmp[k] = setProp(H.setup.selectors[sel][k], 2);
- }
- );
- /* eslint-enable security/detect-object-injection */
- Object.defineProperty(
- settings,
- sel,
- setProp(Object.create(perClassDefaults, tmp), 2)
- );
- });
- } else if (key === "dontHyphenate") {
- const tmp = empty();
- Object.keys(H.setup.dontHyphenate).forEach(
- function copyTagNames(k) {
- /* eslint-disable security/detect-object-injection */
- tmp[k] = setProp(H.setup.dontHyphenate[k], 2);
- /* eslint-enable security/detect-object-injection */
- }
- );
- Object.defineProperty(
- settings,
- key,
- setProp(
- Object.create(generalDefaults.dontHyphenate, tmp), 3
- )
- );
- } else {
- /* eslint-disable security/detect-object-injection */
- Object.defineProperty(
- settings,
- key,
- setProp(H.setup[key], 3)
- );
- /* eslint-enable security/detect-object-injection */
- }
- });
- H.c = settings;
- }(Hyphenopoly));
-
- (function H9Y(H) {
- const C = H.c;
- let mainLanguage = null;
- let elements = null;
-
- /**
- * Factory for elements
- * @returns {Object} elements-object
- */
- function makeElementCollection() {
- const list = new Map();
-
- /*
- * Counter counts the elements to be hyphenated.
- * Needs to be an object (Pass by reference)
- */
- const counter = [0];
-
- /**
- * Add element to elements
- * @param {object} el The element
- * @param {string} lang The language of the element
- * @param {string} sel The selector of the element
- * @returns {Object} An element-object
- */
- function add(el, lang, sel) {
- const elo = {
- "element": el,
- "selector": sel
- };
- if (!list.has(lang)) {
- list.set(lang, []);
- }
- list.get(lang).push(elo);
- counter[0] += 1;
- return elo;
- }
-
- /**
- * Removes elements from the list and updates the counter
- * @param {string} lang - The lang of the elements to remove
- */
- function rem(lang) {
- let langCount = 0;
- if (list.has(lang)) {
- langCount = list.get(lang).length;
- list.delete(lang);
- counter[0] -= langCount;
- if (counter[0] === 0) {
- H.events.dispatch("hyphenopolyEnd");
- }
- }
- }
-
- /**
- * Execute fn for each element
- * @param {function} fn The function to execute
- * @returns {undefined}
- */
- function each(fn) {
- list.forEach(function eachElement(val, key) {
- fn(key, val);
- });
- }
-
- return {
- "add": add,
- "counter": counter,
- "each": each,
- "list": list,
- "rem": rem
- };
- }
-
- /**
- * Get language of element by searching its parents or fallback
- * @param {Object} el The element
- * @param {boolean} fallback Will falback to mainlanguage
- * @returns {string|null} The language or null
- */
- function getLang(el, fallback) {
- try {
- return (el.getAttribute("lang"))
- ? el.getAttribute("lang").toLowerCase()
- : el.tagName.toLowerCase() === "html"
- ? fallback
- ? mainLanguage
- : null
- : getLang(el.parentNode, fallback);
- } catch (ignore) {
- return null;
- }
- }
-
- /**
- * Set mainLanguage
- * @returns {undefined}
- */
- function autoSetMainLanguage() {
- const el = w.document.getElementsByTagName("html")[0];
- mainLanguage = getLang(el, false);
- if (!mainLanguage && C.defaultLanguage !== "") {
- mainLanguage = C.defaultLanguage;
- }
- }
-
- /**
- * Check if node is matched by a given selector
- * @param {Node} n The Node to check
- * @param {String} sel Selector(s)
- * @returns {Boolean} true if matched, false if not matched
- */
- function nodeMatchedBy(n, sel) {
- if (!n.matches) {
- n.matches = n.msMatchesSelector || n.webkitMatchesSelector;
- }
- return n.matches(sel);
- }
-
- /**
- * Collect elements that have a selector defined in C.selectors
- * and add them to elements.
- * @returns {undefined}
- */
- function collectElements() {
- elements = makeElementCollection();
-
- const dontHyphenateSelector = (function createSel() {
- let s = "." + H.c.dontHyphenateClass;
- let k = null;
- for (k in C.dontHyphenate) {
- /* eslint-disable security/detect-object-injection */
- if (C.dontHyphenate[k]) {
- s += ", " + k;
- }
- /* eslint-enable security/detect-object-injection */
- }
- return s;
- }());
- const matchingSelectors = C.selectors.join(", ") + ", " + dontHyphenateSelector;
-
- /**
- * Get Language of Element or of one of its ancestors.
- * @param {Object} el The element to scan
- * @param {string} pLang The language of the parent element
- * @returns {string} the language
- */
- function getElementLanguage(el, pLang) {
- if (el.lang && typeof el.lang === "string") {
- return el.lang.toLowerCase();
- } else if (pLang && pLang !== "") {
- return pLang.toLowerCase();
- }
- return getLang(el, true);
- }
-
- /**
- * Recursively walk all elements in el, lending lang and selName
- * add them to elements if necessary.
- * @param {Object} el The element to scan
- * @param {string} pLang The language of the oarent element
- * @param {string} sel The selector of the parent element
- * @param {boolean} isChild If el is a child element
- * @returns {undefined}
- */
- function processElements(el, pLang, sel, isChild) {
- isChild = isChild || false;
- const eLang = getElementLanguage(el, pLang);
- /* eslint-disable security/detect-object-injection */
- if (H.cf.langs[eLang] === "H9Y") {
- elements.add(el, eLang, sel);
- if (!isChild && C.safeCopy) {
- registerOnCopy(el);
- }
- } else if (!H.cf.langs[eLang]) {
- H.events.dispatch("error", {
- "lvl": "warn",
- "msg": "Element with '" + eLang + "' found, but '" + eLang + ".hpb' not loaded. Check language tags!"
- });
- }
- /* eslint-enable security/detect-object-injection */
- const cn = el.childNodes;
- Array.prototype.forEach.call(cn, function eachChildNode(n) {
- if (n.nodeType === 1 &&
- !nodeMatchedBy(n, matchingSelectors)) {
- processElements(n, eLang, sel, true);
- }
- });
- }
- C.selectors.forEach(function eachSelector(sel) {
- const nl = w.document.querySelectorAll(sel);
- Array.prototype.forEach.call(nl, function eachNode(n) {
- processElements(n, getLang(n, true), sel, false);
- });
- });
- H.elementsReady = true;
- }
-
- const wordHyphenatorPool = new Map();
-
- /**
- * Factory for hyphenatorFunctions for a specific language and class
- * @param {Object} lo Language-Object
- * @param {string} lang The language
- * @param {string} sel The selector
- * @returns {function} The hyphenate function
- */
- function createWordHyphenator(lo, lang, sel) {
- /* eslint-disable-next-line security/detect-object-injection */
- const classSettings = C[sel];
- const hyphen = classSettings.hyphen;
- lo.cache.set(sel, new Map());
-
- /**
- * HyphenateFunction for compound words
- * @param {string} word The word
- * @returns {string} The hyphenated compound word
- */
- function hyphenateCompound(word) {
- const zeroWidthSpace = String.fromCharCode(8203);
- let parts = null;
- let wordHyphenator = null;
- if (classSettings.compound === "auto" ||
- classSettings.compound === "all") {
- wordHyphenator = createWordHyphenator(lo, lang, sel);
- parts = word.split("-").map(function h7eParts(p) {
- if (p.length >= classSettings.minWordLength) {
- return wordHyphenator(p);
- }
- return p;
- });
- if (classSettings.compound === "auto") {
- word = parts.join("-");
- } else {
- word = parts.join("-" + zeroWidthSpace);
- }
- } else {
- word = word.replace("-", "-" + zeroWidthSpace);
- }
- return word;
- }
-
- /**
- * Checks if a string is mixed case
- * @param {string} s The string
- * @returns {boolean} true if s is mixed case
- */
- function isMixedCase(s) {
- return Array.prototype.map.call(s, function mapper(c) {
- return (c === c.toLowerCase());
- }).some(function checker(v, i, a) {
- return (v !== a[0]);
- });
- }
-
- /* eslint-disable complexity */
- /**
- * HyphenateFunction for words (compound or not)
- * @param {string} word The word
- * @returns {string} The hyphenated word
- */
- function hyphenator(word) {
- let hw = lo.cache.get(sel).get(word);
- if (!classSettings.mixedCase && isMixedCase(word)) {
- hw = word;
- }
- if (!hw) {
- if (lo.exceptions.has(word)) {
- hw = lo.exceptions.get(word).replace(
- /-/g,
- classSettings.hyphen
- );
- } else if (word.indexOf("-") === -1) {
- if (word.length > 61) {
- H.events.dispatch("error", {
- "lvl": "warn",
- "msg": "found word longer than 61 characters"
- });
- hw = word;
- } else {
- /* eslint-disable security/detect-object-injection */
- hw = lo.hyphenateFunction(
- word,
- hyphen.charCodeAt(0),
- classSettings.leftminPerLang[lang],
- classSettings.rightminPerLang[lang]
- );
- /* eslint-enable security/detect-object-injection */
- }
- } else {
- hw = hyphenateCompound(word);
- }
- lo.cache.get(sel).set(word, hw);
- }
- return hw;
- }
- /* eslint-enable complexity */
- wordHyphenatorPool.set(lang + "-" + sel, hyphenator);
- return hyphenator;
- }
-
- const orphanControllerPool = new Map();
-
- /**
- * Factory for function that handles orphans
- * @param {string} sel The selector
- * @returns {function} The function created
- */
- function createOrphanController(sel) {
- /**
- * Function template
- * @param {string} ignore unused result of replace
- * @param {string} leadingWhiteSpace The leading whiteSpace
- * @param {string} lastWord The last word
- * @param {string} trailingWhiteSpace The trailing whiteSpace
- * @returns {string} Treated end of text
- */
- function controlOrphans(
- ignore,
- leadingWhiteSpace,
- lastWord,
- trailingWhiteSpace
- ) {
- /* eslint-disable security/detect-object-injection */
- const classSettings = C[sel];
- /* eslint-enable security/detect-object-injection */
- let h = classSettings.hyphen;
- if (".\\+*?[^]$(){}=!<>|:-".indexOf(classSettings.hyphen) !== -1) {
- h = "\\" + classSettings.hyphen;
- }
- if (classSettings.orphanControl === 3 && leadingWhiteSpace === " ") {
- leadingWhiteSpace = String.fromCharCode(160);
- }
- /* eslint-disable security/detect-non-literal-regexp */
- return leadingWhiteSpace + lastWord.replace(new RegExp(h, "g"), "") + trailingWhiteSpace;
- /* eslint-enable security/detect-non-literal-regexp */
- }
- orphanControllerPool.set(sel, controlOrphans);
- return controlOrphans;
- }
-
- /**
- * Hyphenate an entitiy (text string or Element-Object)
- * @param {string} lang - the language of the string
- * @param {string} sel - the selectorName of settings
- * @param {string} entity - the entity to be hyphenated
- * @returns {string | null} hyphenated str according to setting of sel
- */
- function hyphenate(lang, sel, entity) {
- const lo = H.languages.get(lang);
- /* eslint-disable security/detect-object-injection */
- const classSettings = C[sel];
- /* eslint-enable security/detect-object-injection */
- const minWordLength = classSettings.minWordLength;
- const normalize = C.normalize &&
- Boolean(String.prototype.normalize);
- const poolKey = lang + "-" + sel;
- const wordHyphenator = (wordHyphenatorPool.has(poolKey))
- ? wordHyphenatorPool.get(poolKey)
- : createWordHyphenator(lo, lang, sel);
- const orphanController = (orphanControllerPool.has(sel))
- ? orphanControllerPool.get(sel)
- : createOrphanController(sel);
- const re = lo.genRegExps.get(sel);
-
- /**
- * Hyphenate text according to setting in sel
- * @param {string} text - the strint to be hyphenated
- * @returns {string} hyphenated string according to setting of sel
- */
- function hyphenateText(text) {
- let tn = null;
- if (normalize) {
- tn = text.normalize("NFC").replace(re, wordHyphenator);
- } else {
- tn = text.replace(re, wordHyphenator);
- }
- if (classSettings.orphanControl !== 1) {
- tn = tn.replace(
- // eslint-disable-next-line prefer-named-capture-group
- /(\u0020*)(\S+)(\s*)$/,
- orphanController
- );
- }
- return tn;
- }
-
- /**
- * Hyphenate element according to setting in sel
- * @param {object} el - the HTMLElement to be hyphenated
- * @returns {undefined}
- */
- function hyphenateElement(el) {
- H.events.dispatch("beforeElementHyphenation", {
- "el": el,
- "lang": lang
- });
- const cn = el.childNodes;
- Array.prototype.forEach.call(cn, function eachChildNode(n) {
- if (
- n.nodeType === 3 &&
- n.data.length >= minWordLength
- ) {
- n.data = hyphenateText(n.data);
- }
- });
- elements.counter[0] -= 1;
- H.events.dispatch("afterElementHyphenation", {
- "el": el,
- "lang": lang
- });
- }
- let r = null;
- if (typeof entity === "string") {
- r = hyphenateText(entity);
- } else if (entity instanceof HTMLElement) {
- hyphenateElement(entity);
- }
- return r;
- }
-
- H.createHyphenator = function createHyphenator(lang) {
- return function hyphenator(entity, sel) {
- sel = sel || ".hyphenate";
- return hyphenate(lang, sel, entity);
- };
- };
-
- H.unhyphenate = function unhyphenate() {
- elements.each(function eachLang(lang, els) {
- els.forEach(function eachElem(elo) {
- const n = elo.element.firstChild;
- const h = C[elo.selector].hyphen;
- /* eslint-disable security/detect-non-literal-regexp */
- n.data = n.data.replace(new RegExp(h, "g"), "");
- /* eslint-enable security/detect-non-literal-regexp */
- });
- });
- };
-
- /**
- * Hyphenate all elements with a given language
- * @param {string} lang The language
- * @param {Array} elArr Array of elements
- * @returns {undefined}
- */
- function hyphenateLangElements(lang, elArr) {
- if (elArr) {
- elArr.forEach(function eachElem(elo) {
- hyphenate(lang, elo.selector, elo.element);
- });
- } else {
- H.events.dispatch("error", {
- "lvl": "warn",
- "msg": "engine for language '" + lang + "' loaded, but no elements found."
- });
- }
- if (elements.counter[0] === 0) {
- H.events.dispatch("hyphenopolyEnd");
- }
- }
-
- /**
- * Convert exceptions to object
- * @param {string} exc comma separated list of exceptions
- * @returns {Object} Map of exceptions
- */
- function convertExceptions(exc) {
- const r = new Map();
- exc.split(", ").forEach(function eachExc(e) {
- const key = e.replace(/-/g, "");
- r.set(key, e);
- });
- return r;
- }
-
- /**
- * Create lang Object
- * @param {string} lang The language
- * @returns {Object} The newly
- */
- function createLangObj(lang) {
- if (!H.languages) {
- H.languages = new Map();
- }
- if (!H.languages.has(lang)) {
- H.languages.set(lang, empty());
- }
- return H.languages.get(lang);
- }
-
- /**
- * Setup lo
- * @param {string} lang The language
- * @param {function} hyphenateFunction The hyphenateFunction
- * @param {string} alphabet List of used characters
- * @param {number} leftmin leftmin
- * @param {number} rightmin rightmin
- * @returns {undefined}
- */
- function prepareLanguagesObj(
- lang,
- hyphenateFunction,
- alphabet,
- leftmin,
- rightmin
- ) {
- alphabet = alphabet.replace(/-/g, "");
- const lo = createLangObj(lang);
- if (!lo.engineReady) {
- lo.cache = new Map();
- /* eslint-disable security/detect-object-injection */
- if (H.c.exceptions.global) {
- if (H.c.exceptions[lang]) {
- H.c.exceptions[lang] += ", " + H.c.exceptions.global;
- } else {
- H.c.exceptions[lang] = H.c.exceptions.global;
- }
- }
- if (H.c.exceptions[lang]) {
- lo.exceptions = convertExceptions(H.c.exceptions[lang]);
- delete H.c.exceptions[lang];
- } else {
- lo.exceptions = new Map();
- }
- /* eslint-enable security/detect-object-injection */
- lo.genRegExps = new Map();
- lo.leftmin = leftmin;
- lo.rightmin = rightmin;
- lo.hyphenateFunction = hyphenateFunction;
- C.selectors.forEach(function eachSelector(sel) {
- /* eslint-disable security/detect-object-injection */
- const classSettings = C[sel];
- /* eslint-enable security/detect-object-injection */
- if (classSettings.leftminPerLang === 0) {
- Object.defineProperty(
- classSettings,
- "leftminPerLang",
- setProp(empty(), 2)
- );
- }
- if (classSettings.rightminPerLang === 0) {
- Object.defineProperty(
- classSettings,
- "rightminPerLang",
- setProp(empty(), 2)
- );
- }
- /* eslint-disable security/detect-object-injection */
- if (classSettings.leftminPerLang[lang]) {
- classSettings.leftminPerLang[lang] = Math.max(
- lo.leftmin,
- classSettings.leftmin,
- classSettings.leftminPerLang[lang]
- );
- } else {
- classSettings.leftminPerLang[lang] = Math.max(
- lo.leftmin,
- classSettings.leftmin
- );
- }
- if (classSettings.rightminPerLang[lang]) {
- classSettings.rightminPerLang[lang] = Math.max(
- lo.rightmin,
- classSettings.rightmin,
- classSettings.rightminPerLang[lang]
- );
- } else {
- classSettings.rightminPerLang[lang] = Math.max(
- lo.rightmin,
- classSettings.rightmin
- );
- }
- /* eslint-enable security/detect-object-injection */
-
- /*
- * Find words with characters from `alphabet` and
- * `Zero Width Non-Joiner` and `-` with a min length.
- *
- * This regexp is not perfect. It also finds parts of words
- * that follow a character that is not in the `alphabet`.
- * Word delimiters are not taken in account.
- */
- /* eslint-disable security/detect-non-literal-regexp */
- lo.genRegExps.set(sel, new RegExp("[\\w" + alphabet + String.fromCharCode(8204) + "-]{" + classSettings.minWordLength + ",}", "gi"));
- /* eslint-enable security/detect-non-literal-regexp */
- });
- lo.engineReady = true;
- }
- Hyphenopoly.events.dispatch("engineReady", {"msg": lang});
- }
-
- /**
- * Calculate heap size for (w)asm
- * wasm page size: 65536 = 64 Ki
- * asm: http://asmjs.org/spec/latest/#linking-0
- * @param {number} targetSize The targetet Size
- * @returns {number} The necessary heap size
- */
- function calculateHeapSize(targetSize) {
- /* eslint-disable no-bitwise */
- if (H.cf.wasm) {
- return Math.ceil(targetSize / 65536) * 65536;
- }
- const exp = Math.ceil(Math.log(targetSize) * Math.LOG2E);
- if (exp <= 12) {
- return 1 << 12;
- }
- if (exp < 24) {
- return 1 << exp;
- }
- return Math.ceil(targetSize / (1 << 24)) * (1 << 24);
- /* eslint-enable no-bitwise */
- }
-
- /**
- * Polyfill for TextDecoder
- */
- const decode = (function makeDecoder() {
- if (w.TextDecoder) {
- const utf16ledecoder = new TextDecoder("utf-16le");
- return function decoder(ui16) {
- return utf16ledecoder.decode(ui16);
- };
- }
- return function decoder(ui16) {
- return String.fromCharCode.apply(null, ui16);
- };
- }());
-
- /**
- * Calculate Base Data
- *
- * Build Heap (the heap object's byteLength must be
- * either 2^n for n in [12, 24)
- * or 2^24 · n for n ≥ 1;)
- *
- * MEMORY LAYOUT:
- *
- * -------------------- <- Offset 0
- * | translateMap |
- * | keys: |
- * |256 chars * 2Bytes|
- * | + |
- * | values: |
- * |256 chars * 1Byte |
- * -------------------- <- 768 Bytes
- * | alphabet |
- * |256 chars * 2Bytes|
- * -------------------- <- valueStoreOffset (vs) = 1280
- * | valueStore |
- * | 1 Byte |
- * |* valueStoreLength|
- * --------------------
- * | align to 4Bytes |
- * -------------------- <- patternTrieOffset (pt)
- * | patternTrie |
- * | 4 Bytes |
- * |*patternTrieLength|
- * -------------------- <- wordOffset (wo)
- * | wordStore |
- * | Uint16[64] | 128 bytes
- * -------------------- <- translatedWordOffset (tw)
- * | transl.WordStore |
- * | Uint8[64] | 64 bytes
- * -------------------- <- hyphenPointsOffset (hp)
- * | hyphenPoints |
- * | Uint8[64] | 64 bytes
- * -------------------- <- hyphenatedWordOffset (hw)
- * | hyphenatedWord |
- * | Uint16[128] | 256 Bytes
- * -------------------- <- hpbOffset (ho) -
- * | HEADER | |
- * | 6*4 Bytes | |
- * | 24 Bytes | |
- * -------------------- |
- * | PATTERN LIC | |
- * | variable Length | |
- * -------------------- |
- * | align to 4Bytes | } this is the .hpb-file
- * -------------------- <- hpbTranslateOffset |
- * | TRANSLATE | |
- * | 2 + [0] * 2Bytes | |
- * -------------------- <-hpbPatternsOffset(po)|
- * | PATTERNS | |
- * | patternsLength | |
- * -------------------- <- heapEnd -
- * | align to 4Bytes |
- * -------------------- <- heapSize (hs)
- * @param {Object} hpbBuf FileBuffer from .hpb-file
- * @returns {Object} baseData-object
- */
- function calculateBaseData(hpbBuf) {
- const hpbMetaData = new Uint32Array(hpbBuf).subarray(0, 8);
- if (hpbMetaData[0] !== 40005736) {
- /*
- * Pattern files must begin with "hpb2"
- * Get current utf8 values with
- * `new Uint8Array(Uint32Array.of(hpbMetaData[0]).buffer)`
- */
- H.events.dispatch("error", {
- "lvl": "error",
- "msg": "Pattern file format error: " + new Uint8Array(Uint32Array.of(hpbMetaData[0]).buffer)
- });
- throw new Error("Pattern file format error!");
- }
- const valueStoreLength = hpbMetaData[7];
- const valueStoreOffset = 1280;
- const patternTrieOffset = valueStoreOffset + valueStoreLength +
- (4 - ((valueStoreOffset + valueStoreLength) % 4));
- const wordOffset = patternTrieOffset + (hpbMetaData[6] * 4);
- return {
- // Set hpbOffset
- "ho": wordOffset + 512,
- // Set hyphenPointsOffset
- "hp": wordOffset + 192,
- // Set heapSize
- "hs": Math.max(calculateHeapSize(wordOffset + 512 + hpbMetaData[2] + hpbMetaData[3]), 32 * 1024 * 64),
- // Set hyphenatedWordOffset
- "hw": wordOffset + 256,
- // Set leftmin
- "lm": hpbMetaData[4],
- // Set patternsLength
- "pl": hpbMetaData[3],
- // Set hpbPatternsOffset
- "po": wordOffset + 512 + hpbMetaData[2],
- // Set patternTrieOffset
- "pt": patternTrieOffset,
- // Set rightmin
- "rm": hpbMetaData[5],
- // Set translateOffset
- "to": wordOffset + 512 + hpbMetaData[1],
- // Set translatedWordOffset
- "tw": wordOffset + 128,
- // Set valueStoreOffset
- "vs": valueStoreOffset,
- // Set wordOffset
- "wo": wordOffset
- };
- }
-
- /**
- * Setup env for hyphenateFunction
- * @param {Object} baseData baseData
- * @param {function} hyphenateFunc hyphenateFunction
- * @returns {function} hyphenateFunction with closured environment
- */
- function encloseHyphenateFunction(baseData, hyphenateFunc) {
- /* eslint-disable no-bitwise */
- const heapBuffer = H.cf.wasm
- ? baseData.wasmMemory.buffer
- : baseData.heapBuffer;
- const wordStore = (new Uint16Array(heapBuffer)).subarray(
- baseData.wo >> 1,
- (baseData.wo >> 1) + 64
- );
- const hydWrdStore = (new Uint16Array(heapBuffer)).subarray(
- baseData.hw >> 1,
- (baseData.hw >> 1) + 128
- );
- /* eslint-enable no-bitwise */
- wordStore[0] = 95;
- return function enclHyphenate(word, hyphencc, leftmin, rightmin) {
- let i = 0;
- let cc = 0;
- do {
- cc = word.charCodeAt(i);
- i += 1;
- // eslint-disable-next-line security/detect-object-injection
- wordStore[i] = cc;
- } while (cc);
- /* eslint-disable security/detect-object-injection */
- wordStore[i] = 95;
- wordStore[i + 1] = 0;
- /* eslint-enable security/detect-object-injection */
- if (hyphenateFunc(leftmin, rightmin, hyphencc) === 1) {
- word = decode(hydWrdStore.subarray(1, hydWrdStore[0] + 1));
- }
- return word;
- };
- }
-
- /**
- * Instantiate Wasm Engine
- * @param {string} lang The language
- * @returns {undefined}
- */
- function instantiateWasmEngine(lang) {
- Promise.all([H.bins.get(lang), H.bins.get("hyphenEngine")]).then(
- function onAll(binaries) {
- const hpbBuf = binaries[0];
- const baseData = calculateBaseData(hpbBuf);
- const wasmModule = binaries[1];
- const specMem = H.specMems.get(lang);
- const wasmMemory = (
- specMem.buffer.byteLength >= baseData.hs
- )
- ? specMem
- : new WebAssembly.Memory({
- "initial": baseData.hs / 65536,
- "maximum": 256
- });
- const ui32wasmMemory = new Uint32Array(wasmMemory.buffer);
- ui32wasmMemory.set(
- new Uint32Array(hpbBuf),
- // eslint-disable-next-line no-bitwise
- baseData.ho >> 2
- );
- baseData.wasmMemory = wasmMemory;
- WebAssembly.instantiate(wasmModule, {
- "env": {
- "memory": baseData.wasmMemory,
- "memoryBase": 0
- },
- "x": baseData
- }).then(
- function runWasm(result) {
- const alphalen = result.exports.convert();
- prepareLanguagesObj(
- lang,
- encloseHyphenateFunction(
- baseData,
- result.exports.hyphenate
- ),
- decode(
- (new Uint16Array(wasmMemory.buffer)).
- subarray(385, 384 + alphalen)
- ),
- baseData.lm,
- baseData.rm
- );
- }
- );
- }
- );
- }
-
- /**
- * Instantiate asm Engine
- * @param {string} lang The language
- * @returns {undefined}
- */
- function instantiateAsmEngine(lang) {
- const hpbBuf = H.bins.get(lang);
- const baseData = calculateBaseData(hpbBuf);
- const specMem = H.specMems.get(lang);
- const heapBuffer = (specMem.byteLength >= baseData.hs)
- ? specMem
- : new ArrayBuffer(baseData.hs);
- const ui8Heap = new Uint8Array(heapBuffer);
- const ui8Patterns = new Uint8Array(hpbBuf);
- ui8Heap.set(ui8Patterns, baseData.ho);
- baseData.heapBuffer = heapBuffer;
- const theHyphenEngine = asmHyphenEngine(
- {
- "Int32Array": w.Int32Array,
- "Math": Math,
- "Uint16Array": w.Uint16Array,
- "Uint8Array": w.Uint8Array
- },
- baseData,
- baseData.heapBuffer
- );
- const alphalen = theHyphenEngine.convert();
- prepareLanguagesObj(
- lang,
- encloseHyphenateFunction(baseData, theHyphenEngine.hyphenate),
- decode(
- (new Uint16Array(heapBuffer)).
- subarray(385, 384 + alphalen)
- ),
- baseData.lm,
- baseData.rm
- );
- }
-
- let engineInstantiator = null;
- const hpb = [];
-
- /**
- * Instantiate hyphenEngines for languages
- * @param {string} lang The language
- * @param {string} engineType The engineType: "wasm" or "asm"
- * @returns {undefined}
- */
- function prepare(lang, engineType) {
- if (lang === "*") {
- if (engineType === "wasm") {
- engineInstantiator = instantiateWasmEngine;
- } else if (engineType === "asm") {
- engineInstantiator = instantiateAsmEngine;
- }
- hpb.forEach(function eachHbp(hpbLang) {
- engineInstantiator(hpbLang);
- });
- } else if (engineInstantiator) {
- engineInstantiator(lang);
- } else {
- hpb.push(lang);
- }
- }
-
- H.events.define(
- "contentLoaded",
- function onContentLoaded() {
- autoSetMainLanguage();
- collectElements();
- H.events.dispatch("elementsReady");
- },
- false
- );
-
- H.events.define(
- "elementsReady",
- function onElementsReady() {
- elements.each(function eachElem(lang, values) {
- if (H.languages &&
- H.languages.has(lang) &&
- H.languages.get(lang).engineReady
- ) {
- hyphenateLangElements(lang, values);
- }
- });
- },
- false
- );
-
- H.events.define(
- "engineLoaded",
- function onEngineLoaded(e) {
- prepare("*", e.msg);
- },
- false
- );
-
- H.events.define(
- "hpbLoaded",
- function onHpbLoaded(e) {
- prepare(e.msg, "*");
- },
- false
- );
-
- H.events.addListener(
- "loadError",
- function onLoadError(e) {
- if (e.msg !== "wasm") {
- elements.rem(e.name);
- }
- },
- false
- );
-
- H.events.define(
- "engineReady",
- function onEngineReady(e) {
- if (H.elementsReady) {
- hyphenateLangElements(e.msg, elements.list.get(e.msg));
- }
- },
- false
- );
-
- H.events.define(
- "hyphenopolyStart",
- null,
- true
- );
-
- H.events.define(
- "hyphenopolyEnd",
- function def() {
- w.clearTimeout(C.timeOutHandler);
- if (C.hide !== "none") {
- H.toggle("on");
- }
- if (!C.keepAlive) {
- window.Hyphenopoly = null;
- }
- },
- false
- );
-
- H.events.define(
- "beforeElementHyphenation",
- null,
- true
- );
-
- H.events.define(
- "afterElementHyphenation",
- null,
- true
- );
-
- H.events.tempRegister.forEach(function eachEo(eo) {
- H.events.addListener(eo.name, eo.handler, false);
- });
- delete H.events.tempRegister;
-
- H.events.dispatch("hyphenopolyStart", {"msg": "Hyphenopoly started"});
-
- w.clearTimeout(H.c.timeOutHandler);
-
- Object.defineProperty(C, "timeOutHandler", setProp(
- w.setTimeout(function ontimeout() {
- H.events.dispatch("timeout", {"delay": C.timeout});
- }, C.timeout),
- 2
- ));
-
- H.events.deferred.forEach(function eachDeferred(deferredeo) {
- H.events.dispatch(deferredeo.name, deferredeo.data);
- });
- delete H.events.deferred;
- }(Hyphenopoly));
-}(window));
diff --git a/static/lib/Hyphenopoly-master/Hyphenopoly_Loader.js b/static/lib/Hyphenopoly-master/Hyphenopoly_Loader.js
deleted file mode 100644
index 1a06efd..0000000
--- a/static/lib/Hyphenopoly-master/Hyphenopoly_Loader.js
+++ /dev/null
@@ -1,785 +0,0 @@
-/**
- * @license Hyphenopoly_Loader 3.4.0 - client side hyphenation
- * ©2019 Mathias Nater, Zürich (mathiasnater at gmail dot com)
- * https://github.com/mnater/Hyphenopoly
- *
- * Released under the MIT license
- * http://mnater.github.io/Hyphenopoly/LICENSE
- */
-
-/* globals Hyphenopoly:readonly */
-
-/**
- * Wrap all code in an iife to keep a scope. Important objects are parameters
- * of this iife to keep codesize low.
- * @param {Object} w shorthand for window
- * @param {Object} d shorthand for document
- * @param {Object} H shorthand for Hyphenopoly
- * @param {Object} o shorthand for object
- */
-(function H9YL(w, d, H, o) {
- "use strict";
-
- const store = sessionStorage;
- const wa = w.WebAssembly;
- const lcFallbacks = new Map();
- const lcRequire = new Map();
-
- /**
- * Create Object without standard Object-prototype
- * @returns {Object} empty object
- */
- function empty() {
- return o.create(null);
- }
-
-
- /**
- * Shorthand for Object.keys(obj).forEach(function () {})
- * @param {Object} obj the object to iterate
- * @param {function} fn the function to execute
- * @returns {undefined}
- */
- function eachKey(obj, fn) {
- o.keys(obj).forEach(fn);
- }
-
- /**
- * Set H.cf (Hyphenopoly.clientFeatures) either by reading out previously
- * computed settings from sessionStorage or creating an template object.
- * This is in an iife to keep complexity low.
- */
- (function configFeat() {
- if (H.cacheFeatureTests && store.getItem("Hyphenopoly_Loader")) {
- H.cf = JSON.parse(store.getItem("Hyphenopoly_Loader"));
- } else {
- H.cf = {
- "langs": empty(),
- "polyfill": false,
- "wasm": null
- };
- }
- }());
-
- /**
- * Set H.paths defaults or overwrite with user settings.
- * This is in an iife to keep complexity low.
- */
- (function configPaths() {
- const maindir = (d.currentScript)
- ? d.currentScript.src.replace(/Hyphenopoly_Loader.js/i, "")
- : "../";
- const patterndir = maindir + "patterns/";
- if (H.paths) {
- H.paths.maindir = H.paths.maindir || maindir;
- H.paths.patterndir = H.paths.patterndir || patterndir;
- } else {
- H.paths = o.create({
- "maindir": maindir,
- "patterndir": patterndir
- });
- }
- }());
-
- /**
- * Set some H.setup fields to defaults or overwrite with user settings.
- * This is in an iife to keep complexity low.
- */
- (function configSetup() {
- if (H.setup) {
- H.setup.selectors = H.setup.selectors || {".hyphenate": {}};
- H.setup.timeout = H.setup.timeout || 1000;
- H.setup.hide = H.setup.hide || "all";
- } else {
- H.setup = {
- "hide": "all",
- "selectors": {".hyphenate": {}},
- "timeout": 1000
- };
- }
- }());
-
- /**
- * Copy required languages to local lcRequire and
- * eventually fallbacks to local lcFallbacks.
- * This is in an iife to keep complexity low.
- */
- (function configRequire() {
- eachKey(H.require, function copyRequire(k) {
- // eslint-disable-next-line security/detect-object-injection
- lcRequire.set(k.toLowerCase(), H.require[k]);
- });
- if (H.fallbacks) {
- eachKey(H.fallbacks, function copyFallbacks(k) {
- lcFallbacks.set(
- k.toLowerCase(),
- // eslint-disable-next-line security/detect-object-injection
- H.fallbacks[k].toLowerCase()
- );
- });
- }
- }());
-
- /**
- * Define function H.toggle.
- * This function hides or unhides (depending of the parameter state)
- * the whole document (H.setup.hide == "all") or
- * each selected element (H.setup.hide == "element") or
- * text of each selected element (H.setup.hide == "text")
- * @param {string} state State: either on (visible) or off (hidden)
- */
- H.toggle = function toggle(state) {
- if (state === "on") {
- const stylesNode = d.getElementById("H9Y_Styles");
- if (stylesNode) {
- stylesNode.parentNode.removeChild(stylesNode);
- }
- } else {
- const vis = " {visibility: hidden !important}\n";
- const sc = d.createElement("style");
- let myStyle = "";
- sc.id = "H9Y_Styles";
- switch (H.setup.hide) {
- case "all":
- myStyle = "html" + vis;
- break;
- case "element":
- eachKey(H.setup.selectors, function eachSelector(sel) {
- myStyle += sel + vis;
- });
- break;
- case "text":
- eachKey(H.setup.selectors, function eachSelector(sel) {
- myStyle += sel + " {color: transparent !important}\n";
- });
- break;
- // No Default
- }
- sc.appendChild(d.createTextNode(myStyle));
- d.head.appendChild(sc);
- }
- };
-
- /**
- * Setup basic event system. Some events are defined but the definition of
- * what happens when they are triggered is deferred to Hyphenopoly.js
- * This is in an iife to keep complexity low.
- */
- (function setupEvents() {
- // Events known to the system
- const definedEvents = new Map();
- // Default events, execution deferred to Hyphenopoly.js
- const deferred = [];
-
- /*
- * Register for custom event handlers, where event is not yet defined
- * these events will be correctly registered in Hyphenopoly.js
- */
- const tempRegister = [];
-
- /**
- * Create Event Object
- * @param {string} name The Name of the event
- * @param {function} defFunc The default method of the event
- * @param {boolean} cancellable Is the default cancellable
- * @returns {undefined}
- */
- function define(name, defFunc, cancellable) {
- definedEvents.set(name, {
- "cancellable": cancellable,
- "default": defFunc,
- "register": []
- });
- }
-
- define(
- "timeout",
- function def(e) {
- H.toggle("on");
- w.console.info(
- "Hyphenopolys 'FOUHC'-prevention timed out after %dms",
- e.delay
- );
- },
- false
- );
-
- define(
- "error",
- function def(e) {
- switch (e.lvl) {
- case "info":
- w.console.info(e.msg);
- break;
- case "warn":
- w.console.warn(e.msg);
- break;
- default:
- w.console.error(e.msg);
- }
- },
- true
- );
-
- define(
- "contentLoaded",
- function def(e) {
- deferred.push({
- "data": e,
- "name": "contentLoaded"
- });
- },
- false
- );
-
- define(
- "engineLoaded",
- function def(e) {
- deferred.push({
- "data": e,
- "name": "engineLoaded"
- });
- },
- false
- );
-
- define(
- "hpbLoaded",
- function def(e) {
- deferred.push({
- "data": e,
- "name": "hpbLoaded"
- });
- },
- false
- );
-
- define(
- "loadError",
- function def(e) {
- deferred.push({
- "data": e,
- "name": "loadError"
- });
- },
- false
- );
-
- define(
- "tearDown",
- null,
- true
- );
-
- /**
- * Dispatch event with arguments
- * @param {string} name The name of the event
- * @param {Object|undefined} data Data of the event
- * @returns {undefined}
- */
- function dispatch(name, data) {
- data = data || empty();
- let defaultPrevented = false;
- definedEvents.get(name).register.forEach(
- function call(currentHandler) {
- data.preventDefault = function preventDefault() {
- if (definedEvents.get(name).cancellable) {
- defaultPrevented = true;
- }
- };
- currentHandler(data);
- }
- );
- if (
- !defaultPrevented &&
- definedEvents.get(name).default
- ) {
- definedEvents.get(name).default(data);
- }
- }
-
- /**
- * Add EventListender to event
- * @param {string} name The name of the event
- * @param {function} handler Function to register
- * @param {boolean} defer If the registration is deferred
- * @returns {undefined}
- */
- function addListener(name, handler, defer) {
- if (definedEvents.has(name)) {
- definedEvents.get(name).register.push(handler);
- } else if (defer) {
- tempRegister.push({
- "handler": handler,
- "name": name
- });
- } else {
- H.events.dispatch(
- "error",
- {
- "lvl": "warn",
- "msg": "unknown Event \"" + name + "\" discarded"
- }
- );
- }
- }
-
- if (H.handleEvent) {
- eachKey(H.handleEvent, function add(name) {
- /* eslint-disable security/detect-object-injection */
- addListener(name, H.handleEvent[name], true);
- /* eslint-enable security/detect-object-injection */
- });
- }
-
- H.events = empty();
- H.events.deferred = deferred;
- H.events.tempRegister = tempRegister;
- H.events.dispatch = dispatch;
- H.events.define = define;
- H.events.addListener = addListener;
- }());
-
- /**
- * Feature test for wasm.
- * @returns {boolean} support
- */
- function runWasmTest() {
- /*
- * Wasm feature test with iOS bug detection
- * (https://bugs.webkit.org/show_bug.cgi?id=181781)
- */
- if (
- typeof wa === "object" &&
- typeof wa.Instance === "function"
- ) {
- /* eslint-disable array-element-newline */
- const module = new wa.Module(Uint8Array.from([
- 0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
- 3, 2, 1, 0, 5, 3, 1, 0, 1, 7, 5, 1, 1, 116, 0, 0,
- 10, 16, 1, 14, 0, 32, 0, 65, 1, 54, 2, 0, 32, 0, 40, 2,
- 0, 11
- ]));
- /* eslint-enable array-element-newline */
- return (new wa.Instance(module).exports.t(4) !== 0);
- }
- return false;
- }
-
- /**
- * Load script by adding
-
-
-
-
- Example 1
-
-
Qua de causa Helvetii quoque reliquos Gallos virtute praecedunt, quod fere cotidianis proeliis cum Germanis contendunt, cum aut suis finibus eos prohibent aut ipsi in eorum finibus bellum gerunt.
-
For which reason the Helvetii also surpass the rest of the Gauls in valor, as they contend with the Germans in almost daily battles, when they either repel them from their own territories, or themselves wage war on their frontiers.
-
Aus diesem Grund übertreffen auch die Helvetier die übrigen Gallier an Tapferkeit, weil sie sich in fast täglichen Gefechten mit den Germanen messen, wobei sie diese entweder von ihrem Gebiet fernhalten oder selbst in deren Gebiet kämpfen.
-
-
-