guipenedo HF staff commited on
Commit
f2b528f
1 Parent(s): 79ddb0e
Files changed (1) hide show
  1. script.js +7 -7
script.js CHANGED
@@ -73,14 +73,13 @@ document.addEventListener("DOMContentLoaded", function() {
73
  drawVisibleNodes();
74
  })
75
 
76
- function getScriptNames(node, namesSet = new Set()) {
77
  if (!node)
78
  return namesSet;
79
  if (node.scripts.length > 0) {
80
  for(const script of node.scripts)
81
  namesSet.add(script);
82
- } else
83
- namesSet.add('x');
84
  if (node.children) {
85
  node.children.forEach(child => getScriptNames(child, namesSet));
86
  }
@@ -134,14 +133,13 @@ document.addEventListener("DOMContentLoaded", function() {
134
  });
135
  }
136
 
137
- function getTokenizerNames(node, namesSet = new Set()) {
138
  if (!node)
139
  return namesSet;
140
  if (node.tokenizers) {
141
  for(const [script, tokenizer] of Object.entries(node.tokenizers))
142
  namesSet.add(tokenizer.original_lang_name);
143
- } else
144
- namesSet.add('x')
145
  if (node.children) {
146
  node.children.forEach(child => getTokenizerNames(child, namesSet));
147
  }
@@ -319,7 +317,9 @@ document.addEventListener("DOMContentLoaded", function() {
319
  .map(child => filterHierarchy(child, expandedNodes.has(node.id), depth + 1))
320
  .filter(child => child !== null);
321
 
322
- const shouldBeShown = selectedTokenizers.some(tok => (node.tokenizers ? Object.values(node.tokenizers).map(x => x.original_lang_name) : ['x']).includes(tok)) && selectedScripts.some(scr => (node.scripts.length ? node.scripts : ['x']).includes(scr) && (node.scripts.length > 0 || showNonGlotlid)); // if one of the leaves has this tokenizer and the selected scripts
 
 
323
  if (!parentExpanded && filteredChildren.length === 0 && !(node.children.length === 0 && shouldBeShown) && node.id != 0)
324
  return null;
325
 
 
73
  drawVisibleNodes();
74
  })
75
 
76
+ function getScriptNames(node, namesSet = new Set('x')) {
77
  if (!node)
78
  return namesSet;
79
  if (node.scripts.length > 0) {
80
  for(const script of node.scripts)
81
  namesSet.add(script);
82
+ }
 
83
  if (node.children) {
84
  node.children.forEach(child => getScriptNames(child, namesSet));
85
  }
 
133
  });
134
  }
135
 
136
+ function getTokenizerNames(node, namesSet = new Set('x')) {
137
  if (!node)
138
  return namesSet;
139
  if (node.tokenizers) {
140
  for(const [script, tokenizer] of Object.entries(node.tokenizers))
141
  namesSet.add(tokenizer.original_lang_name);
142
+ }
 
143
  if (node.children) {
144
  node.children.forEach(child => getTokenizerNames(child, namesSet));
145
  }
 
317
  .map(child => filterHierarchy(child, expandedNodes.has(node.id), depth + 1))
318
  .filter(child => child !== null);
319
 
320
+ const shouldBeShown = selectedTokenizers.some(tok => (Object.keys(node.tokenizers).length > 0 ? Object.values(node.tokenizers).map(x => x.original_lang_name) : ['x']).includes(tok)) &&
321
+ selectedScripts.some(scr => (node.scripts.length ? node.scripts : ['x']).includes(scr) && (node.scripts.length > 0 || showNonGlotlid)); // if one of the leaves has this tokenizer and the selected scripts
322
+
323
  if (!parentExpanded && filteredChildren.length === 0 && !(node.children.length === 0 && shouldBeShown) && node.id != 0)
324
  return null;
325