File tree 1 file changed +9
-16
lines changed
assets/javascripts/views/content
1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -96,16 +96,9 @@ app.views.EntryPage = class EntryPage extends app.View {
96
96
return content ;
97
97
}
98
98
99
- const links = ( ( ) => {
100
- const result = [ ] ;
101
- for ( var link in this . entry . doc . links ) {
102
- var url = this . entry . doc . links [ link ] ;
103
- result . push (
104
- `<a href="${ url } " class="_links-link">${ EntryPage . LINKS [ link ] } </a>` ,
105
- ) ;
106
- }
107
- return result ;
108
- } ) ( ) ;
99
+ const links = Object . entries ( this . entry . doc . links ) . map ( ( [ link , url ] ) => {
100
+ return `<a href="${ url } " class="_links-link">${ EntryPage . LINKS [ link ] } </a>` ;
101
+ } ) ;
109
102
110
103
return `<p class="_links">${ links . join ( "" ) } </p>${ content } ` ;
111
104
}
@@ -203,8 +196,8 @@ app.views.EntryPage = class EntryPage extends app.View {
203
196
}
204
197
205
198
restore ( ) {
206
- let path ;
207
- if ( this . cacheMap [ ( path = this . entry . filePath ( ) ) ] ) {
199
+ const path = this . entry . filePath ( ) ;
200
+ if ( this . cacheMap [ [ path ] ] ) {
208
201
this . render ( this . cacheMap [ path ] , true ) ;
209
202
return true ;
210
203
}
@@ -226,17 +219,17 @@ app.views.EntryPage = class EntryPage extends app.View {
226
219
}
227
220
228
221
onAltC ( ) {
229
- let link ;
230
- if ( ! ( link = this . find ( "._attribution:last-child ._attribution-link" ) ) ) {
222
+ const link = this . find ( "._attribution:last-child ._attribution-link" ) ;
223
+ if ( ! link ) {
231
224
return ;
232
225
}
233
226
console . log ( link . href + location . hash ) ;
234
227
navigator . clipboard . writeText ( link . href + location . hash ) ;
235
228
}
236
229
237
230
onAltO ( ) {
238
- let link ;
239
- if ( ! ( link = this . find ( "._attribution:last-child ._attribution-link" ) ) ) {
231
+ const link = this . find ( "._attribution:last-child ._attribution-link" ) ;
232
+ if ( ! link ) {
240
233
return ;
241
234
}
242
235
this . delay ( ( ) => $ . popup ( link . href + location . hash ) ) ;
You can’t perform that action at this time.
0 commit comments