return this;
};
+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;
get label() {
return row[0].replace(/\/.*/, ''); // primary form
},
+ get html() {
+ let aliases = this.title.split('/');
+ let html = aliases.shift();
+ html = html.replace(/\((.+)\)/, '<small>$1</small>');
+ for (let alias of aliases) {
+ html += ` <small>(${alias})</small>`;
+ }
+ return html;
+ },
level: row[1],
imgid: row[2],
thumb(size = 32) {
return selection;
}
- configure(params = window.location.hash.split('#')) {
+ configure(params = hashparams()) {
const opts = new Map(params.map(arg => arg.split(/[:=](.*)/)));
for (let [query, val] of opts) {
if (query.match(/^\d+$/)) {
else if (query === 'level') {
this.preset.level = parseInt(val);
}
+ else if (query === 'debug') {
+ this.preset.debug = true;
+ }
else {
this.preset[query] = val;
}