+function hashparams() {
+ const encodedhash = window.location.href.split('#').slice(1) || '';
+ if (encodedhash.length == 1) {
+ // location.hash is not encoded in firefox
+ return decodeURIComponent(encodedhash).split('#');
+ }
+ return encodedhash;
+}
+
+class Words {
+ constructor(data, root = undefined) {
+ this.data = data;
+ this.selection = root || this.data[''][3];
+ this.visible = new Set(root || Object.keys(data).flatMap(id => id && parseInt(id)));
+ if (root) {
+ let children = root;
+ for (let loop = 0; children.length && loop < 20; loop++) {
+ for (let child of children) this.visible.add(child);
+ children = children.map(cat => data[cat][3]).filter(is => is).flat();