File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -3,22 +3,20 @@ fetch("../lexicon.json").then(r => r.json())
3
3
const alreadyDone = { } ;
4
4
[ ...document . querySelectorAll ( "a.dfn" ) ] . forEach ( a => {
5
5
if ( lexicon [ a . textContent ] && ! alreadyDone [ a . textContent ] ) {
6
- if ( lexicon [ a . textContent ] . href ) {
7
- a . href = lexicon [ a . textContent ] . href ;
8
- return ;
6
+ let target = lexicon [ a . textContent ] ;
7
+ if ( target . alias ) {
8
+ target = lexicon [ target . alias ] ;
9
9
}
10
- let dfnTarget ;
11
- if ( ! lexicon [ a . textContent ] . alias ) {
12
- dfnTarget = a . textContent ;
13
- } else {
14
- dfnTarget = lexicon [ a . textContent ] . alias ;
10
+ if ( target . href ) {
11
+ a . href = target . href ;
12
+ return ;
15
13
}
16
- const dfnId = dfnTarget . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) ;
14
+ const dfnId = target . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) ;
17
15
18
16
const dfn = document . createElement ( "p" ) ;
19
17
dfn . id = dfnId ;
20
18
dfn . className = "hidden" ;
21
- dfn . innerHTML = lexicon [ dfnTarget ] ;
19
+ dfn . innerHTML = target ;
22
20
document . getElementById ( "lexicon" ) . appendChild ( dfn ) ;
23
21
24
22
a . className = "js-simple-tooltip" ;
You can’t perform that action at this time.
0 commit comments