@@ -7,14 +7,14 @@ const _ = require('lodash');
7
7
var md = require ( 'markdown-it' ) ( {
8
8
html : true ,
9
9
linkify : true ,
10
- typographer : true
10
+ typographer : true ,
11
11
} ) ;
12
12
let talks ;
13
13
14
- function templateContent ( selector , allIssues , label ) {
14
+ function templateContent ( selector , allIssues , label ) {
15
15
let issues = allIssues ;
16
- if ( label ) {
17
- issues = allIssues . filter ( function ( data ) {
16
+ if ( label ) {
17
+ issues = allIssues . filter ( function ( data ) {
18
18
const foundLabel = ! ! data . labels . map ( a => a . name ) . includes ( label ) ;
19
19
return foundLabel ;
20
20
} ) ;
@@ -27,13 +27,13 @@ function templateContent(selector, allIssues, label){
27
27
templateElement . parentNode . appendChild ( element ) ;
28
28
}
29
29
30
- function hashChange ( options ) {
30
+ function hashChange ( options ) {
31
31
const hash = window . location . hash . substring ( 1 ) || 'home' ;
32
32
Array . from ( document . querySelectorAll ( '[data-page]' ) ) . forEach ( page => {
33
33
const thisHash = page . dataset . page ;
34
34
const links = document . querySelectorAll ( `.page-${ thisHash } ` ) ;
35
- try {
36
- if ( thisHash === hash ) {
35
+ try {
36
+ if ( thisHash === hash ) {
37
37
page . style . display = 'block' ;
38
38
links [ 0 ] . className += ' active' ;
39
39
links [ 1 ] && ( links [ 1 ] . className += ' active' ) ;
@@ -43,41 +43,39 @@ function hashChange(options){
43
43
links [ 1 ] && ( links [ 1 ] . className = links [ 1 ] . className . replace ( / a c t i v e / , '' ) ) ;
44
44
}
45
45
document . querySelector ( '[data-page=talk-single]' ) . innerHTML = '' ;
46
- } catch ( e ) { }
47
- if ( options . jump !== false ) document . body . scrollTop = 0 ;
46
+ } catch ( e ) { }
47
+ if ( options . jump !== false ) document . body . scrollTop = 0 ;
48
48
document . body . className = hash ;
49
-
50
49
} ) ;
51
50
const talkId = hash . match ( / ^ t a l k - ( \d + ) $ / ) ;
52
- if ( talkId && talkId [ 1 ] && talks ) {
51
+ if ( talkId && talkId [ 1 ] && talks ) {
53
52
const talk = talks . find ( meetup => meetup . id === talkId [ 1 ] ) ;
54
- if ( ! talk ) return ;
53
+ if ( ! talk ) return ;
55
54
const template = require ( './templates/talk.hbs' ) ;
56
55
const page = document . querySelector ( '[data-page=talk-single]' ) ;
57
56
page . innerHTML = template ( talk ) ;
58
57
page . style . display = 'block' ;
59
58
}
60
59
}
61
60
62
- function init ( ) {
61
+ function init ( ) {
63
62
fetch ( config . dataSources . events )
64
63
. then ( response => response . json ( ) )
65
- . then ( function ( events ) {
64
+ . then ( function ( events ) {
66
65
const latest = events [ 0 ] ;
67
66
latest . dateHuman = dateFns . format ( new Date ( latest . time ) , 'd MMM' ) ;
68
- Array . from ( document . querySelectorAll ( '[data-latest]' ) )
69
- . forEach ( ( element ) => {
70
- const data = _ . get ( latest , element . dataset . latest ) ;
71
- const isHtml = element . dataset . html ;
72
- if ( data ) element [ isHtml ? 'innerHTML' : 'innerText' ] = data ;
73
- } ) ;
67
+ Array . from ( document . querySelectorAll ( '[data-latest]' ) ) . forEach ( element => {
68
+ const data = _ . get ( latest , element . dataset . latest ) ;
69
+ const isHtml = element . dataset . html ;
70
+ if ( data ) element [ isHtml ? 'innerHTML' : 'innerText' ] = data ;
71
+ } ) ;
74
72
} ) ;
75
73
76
74
fetch ( config . dataSources . githubIssues )
77
75
. then ( response => response . json ( ) )
78
- . then ( function ( issues ) {
76
+ . then ( function ( issues ) {
79
77
// render markdown
80
- issues = issues . map ( function ( issue ) {
78
+ issues = issues . map ( function ( issue ) {
81
79
issue . html = md . render ( issue . body ) ;
82
80
issue . dateHuman = dateFns . format ( new Date ( issue . updated_at ) , 'd MMM' ) ;
83
81
return issue ;
@@ -90,26 +88,25 @@ function init(){
90
88
fetch ( config . dataSources . talks )
91
89
. then ( response => response . text ( ) )
92
90
. then ( tsv => {
93
- const twitterData = require ( './data/twitter' ) ;
94
- talks = tsvTalks . parseTsv ( tsv , twitterData ) ;
95
- talks . reverse ( ) ;
96
- const meetups = tsvTalks . getTalksByMeetup ( talks ) ;
97
- templateContent ( '#template-talks' , meetups , '' ) ;
98
- hashChange ( {
99
- jump : false
100
- } ) ;
91
+ const twitterData = require ( './data/twitter' ) ;
92
+ talks = tsvTalks . parseTsv ( tsv , twitterData ) ;
93
+ talks . reverse ( ) ;
94
+ const meetups = tsvTalks . getTalksByMeetup ( talks ) ;
95
+ templateContent ( '#template-talks' , meetups , '' ) ;
96
+ hashChange ( {
97
+ jump : false ,
98
+ } ) ;
101
99
} ) ;
102
100
103
101
const contacts = require ( './data/contact' ) ;
104
102
templateContent ( '#template-contact' , contacts , '' ) ;
105
103
106
104
// initialize semantic ui sidebar
107
- $ ( '.ui.sidebar' )
108
- . sidebar ( 'attach events' , '.toc.item' ) ;
105
+ $ ( '.ui.sidebar' ) . sidebar ( 'attach events' , '.toc.item' ) ;
109
106
110
107
// set the pages ups
111
108
hashChange ( {
112
- jump : false
109
+ jump : false ,
113
110
} ) ;
114
111
}
115
112
0 commit comments