File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ class Kunai {
107
107
108
108
async onDatabase ( db ) {
109
109
// this.log.debug(`onDatabase`, db)
110
+ UI . Badge . onDatabase ( db )
110
111
await this . ui . sidebar . onDatabase ( db )
111
112
await this . ui . sidebar . treeview . onPageID ( this . meta . page_id )
112
113
}
Original file line number Diff line number Diff line change 1
1
export { Content } from './ui/content'
2
2
export { Sidebar } from './ui/sidebar'
3
3
export { Navbar } from './ui/navbar'
4
-
4
+ import * as Badge from './ui/badge'
5
+ export { Badge }
Original file line number Diff line number Diff line change
1
+ let base_url = null
2
+ const unresolved_links = [ ]
3
+
4
+ const onDatabase = ( db ) => {
5
+ base_url = db . base_url . toString ( )
6
+ for ( let a_elem of unresolved_links )
7
+ a_elem . attr ( 'href' , base_url . replace ( / \/ $ / , '' ) + a_elem . attr ( 'href' ) )
8
+ unresolved_links . length = 0
9
+ }
10
+
1
11
const sanitize = ( badges ) => {
2
12
let i = 0
3
13
@@ -46,15 +56,18 @@ const sanitize = (badges) => {
46
56
const lang_path = cppv ? `/lang/cpp${ cppv } ` :
47
57
named_version ? `/lang/${ named_version } ` :
48
58
`/lang`
59
+ const a_elem = $ ( '<a>' , { href : `${ lang_path } .html` } )
60
+ . append ( $ ( '<i>' ) )
61
+ // .append($('<span>').text(clean_txt))
62
+ . appendTo ( b . empty ( ) )
49
63
50
- b . empty ( ) . append (
51
- $ ( '<a>' , { href : `${ lang_path } .html` } )
52
- . append ( $ ( '<i>' ) )
53
- // .append($('<span>').text(clean_txt))
54
- )
64
+ if ( base_url )
65
+ a_elem . attr ( 'href' , base_url . replace ( / \/ $ / , '' ) + a_elem . attr ( 'href' ) )
66
+ else
67
+ unresolved_links . push ( a_elem )
55
68
}
56
69
return i
57
70
}
58
71
59
- export { sanitize }
72
+ export { onDatabase , sanitize }
60
73
You can’t perform that action at this time.
0 commit comments