Skip to content

Commit bf68e27

Browse files
committed
Added voice-only name
1 parent 2b015eb commit bf68e27

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed

css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,11 @@ img {
960960
margin: 0px;
961961
vertical-align: top;
962962
position: relative;
963+
overflow: hidden;
964+
white-space: nowrap;
965+
text-overflow: ellipsis;
966+
padding-left: 2px;
967+
padding-right: 2px;
963968
}
964969

965970
.scene:active, .sound-only:active {

js/gbf.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,71 @@ class GBF
312312
}
313313
return null;
314314
}
315+
316+
lookup_word_is_part_of_name(word)
317+
{
318+
// word.match(/^[a-z0-9]+$/i) == null ||
319+
return !(["human", "harvin", "erune", "draph", "primal", "unknown", "male", "female", "other", "summer", "yukata", "valentine", "halloween", "holiday", "12generals", "grand", "fantasy", "collab", "eternals", "evokers", "4saints", "tie-in", "voiced", "voice-only"].includes(word) || word.endsWith("-boss"));
320+
}
321+
322+
lookup_word_is_japanese(word)
323+
{
324+
return (word.match(/[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/) != null)
325+
}
326+
327+
get_lookup_name(id)
328+
{
329+
if(typeof index !== "undefined" && "lookup" in index && id in index.lookup)
330+
{
331+
let words = index.lookup[id].split(" ");
332+
let i = 0;
333+
if(words.includes("missing-help-wanted"))
334+
{
335+
return id;
336+
}
337+
else if(words[0].startsWith("@@"))
338+
{
339+
return words[0].substring(2);
340+
341+
}
342+
while(i < words.length)
343+
{
344+
if(i == 0)
345+
{
346+
if(words[i].startsWith("@@") || ["sabre", "spear", "dagger", "axe", "gun", "bow", "melee", "harp", "katana", "staff", "fire", "water", "earth", "wind", "light", "dark", "r", "sr", "ssr"].includes(words[i]))
347+
{
348+
words.shift();
349+
}
350+
else
351+
{
352+
words[i] = capitalize(words[i]);
353+
++i;
354+
}
355+
}
356+
else if(this.lookup_word_is_japanese(words[i]))
357+
{
358+
words = words.splice(0, i);
359+
}
360+
else if(!this.lookup_word_is_part_of_name(words[i]))
361+
{
362+
if(i == words.length - 1 || !this.lookup_word_is_part_of_name(words[i+1]) || this.lookup_word_is_japanese(words[i+1]))
363+
{
364+
words = words.splice(0, i);
365+
}
366+
else
367+
{
368+
words[i] = capitalize(words[i]);
369+
++i;
370+
}
371+
}
372+
else
373+
{
374+
words[i] = capitalize(words[i]);
375+
++i
376+
}
377+
}
378+
return words.join(" ");
379+
}
380+
else return id;
381+
}
315382
};

js/page.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ function get_npc(id, data, prefix, range)
960960
}
961961
else // sound-only
962962
{
963-
return [{id:id, modifier:"sound-only", text:id}];
963+
return [{id:id, modifier:"sound-only", text:gbf.get_lookup_name(id)}];
964964
}
965965
}
966966
else return null;
@@ -1528,7 +1528,7 @@ function add_lookup(node, id)
15281528
else if(t.length == 1)
15291529
i.innerText = t.toUpperCase();
15301530
else
1531-
i.innerText = t.charAt(0).toUpperCase() + t.slice(1);
1531+
i.innerText = capitalize(t);
15321532
break;
15331533
}
15341534
}

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The main CSS file, used for the [GBF Asset Lookup](https://github.com/MizaGBF/GB
1818
## Javascript Files
1919

2020
### gbf.js
21-
Standalone.
21+
Requires `util.js`.
2222
Contains a class to handle types and corresponding index keys, along with returning endpoints for assets.
2323
Intended to be instantiated once in a global `gbf` variable upon initialization.
2424

0 commit comments

Comments
 (0)