File tree Expand file tree Collapse file tree
Daniel15.Web/wwwroot/Content Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Plausible from 'plausible-tracker' ;
22
3- const { trackPageview, enableAutoOutboundTracking} = Plausible ( {
4- apiHost : 'https://d.sb' ,
5- trackLocalhost : false ,
6- } ) ;
3+ export function trackPageview ( ) : void {
4+ const { trackPageview, enableAutoOutboundTracking} = Plausible ( {
5+ apiHost : 'https://d.sb' ,
6+ trackLocalhost : false ,
7+ } ) ;
78
8- trackPageview ( ) ;
9- // TODO: This doesn't provide a way to ignore links, which breaks the
10- // JS-powered links on the projects page.
11- // https://github.com/plausible/plausible-tracker/blob/c0b87d997d839938c23023d35bac0d6683635bbc/src/lib/tracker.ts#L292
12- //enableAutoOutboundTracking();
9+ trackPageview ( ) ;
10+ // TODO: This doesn't provide a way to ignore links, which breaks the
11+ // JS-powered links on the projects page.
12+ // https://github.com/plausible/plausible-tracker/blob/c0b87d997d839938c23023d35bac0d6683635bbc/src/lib/tracker.ts#L292
13+ //enableAutoOutboundTracking();
14+ }
Original file line number Diff line number Diff line change 11import '../css/main.less' ;
22
3+ import { initBlog } from './pages/blog' ;
34import { initIndex } from './pages/home' ;
45import { initProjects } from './pages/projects' ;
56import { initSocialFeed } from './pages/socialfeed' ;
67
7- import './analytics' ;
8- import '../not_an_easter_egg/secret' ;
8+ import { trackPageview } from './analytics' ;
9+ import { attachKonamiCodeListener } from '../not_an_easter_egg/secret' ;
910
10- switch ( document . body . id ) {
11- case 'site-index' :
12- initIndex ( ) ;
13- break ;
11+ function initPage ( ) : void {
12+ const controller = document . body . dataset . controller ;
13+ const action = document . body . dataset . action ;
14+ switch ( controller ) {
15+ case 'blog' :
16+ initBlog ( ) ;
17+ break ;
1418
15- case 'site-socialfeed ' :
16- initSocialFeed ( ) ;
17- break ;
19+ case 'projects ' :
20+ initProjects ( ) ;
21+ break ;
1822
19- case 'project-index' :
20- initProjects ( ) ;
21- break ;
23+ case 'site' :
24+ switch ( action ) {
25+ case 'index' :
26+ initIndex ( ) ;
27+ break ;
28+
29+ case 'socialfeed' :
30+ initSocialFeed ( ) ;
31+ break ;
32+ }
33+ break ;
34+ }
2235}
36+
37+ trackPageview ( ) ;
38+ initPage ( ) ;
39+ attachKonamiCodeListener ( ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const KEY_SEQUENCE = [
1515] ;
1616let step = 0 ;
1717
18- window . addEventListener ( 'keydown' , evt => {
18+ function checkKonamiCode ( evt : KeyboardEvent ) : void {
1919 // If incorrect key is pressed, start again!
2020 if ( evt . key . toLowerCase ( ) !== KEY_SEQUENCE [ step ] ) {
2121 step = 0 ;
@@ -34,4 +34,8 @@ window.addEventListener('keydown', evt => {
3434 newCSS . setAttribute ( 'type' , 'text/css' ) ;
3535 head . appendChild ( newCSS ) ;
3636 }
37- } ) ;
37+ }
38+
39+ export function attachKonamiCodeListener ( ) : void {
40+ window . addEventListener ( 'keydown' , checkKonamiCode ) ;
41+ }
You can’t perform that action at this time.
0 commit comments