@@ -44,7 +44,6 @@ $(function(){
4444 class : "img-circle img-thumbnail"
4545 } ) . appendTo ( "#teacher-avatar" ) ;
4646
47-
4847 $ ( "<span/>" ,
4948 {
5049 text : data . public_repos ,
@@ -63,27 +62,35 @@ $(function(){
6362 class : "badge"
6463 } ) . appendTo ( "#teacher-following" ) ;
6564
66-
67-
6865 $ ( "#teacher" ) . toggleClass ( "hidden" ) ;
6966 $ ( "#teacher" ) . toggleClass ( "slide" ) ;
67+
68+ updateSlideSize ( ) ;
7069 }
7170 } ) ;
7271 }
7372
74-
73+ // Render the TOC
74+ buildToc ( ) ;
75+ // Reframe slides on any window resize
7576 $ ( window ) . resize ( function ( ) {
7677 updateSlideSize ( ) ;
7778 } ) ;
78-
79+ // Ensure slide scale at start
7980 updateSlideSize ( ) ;
81+ // Startup slide scrollsnap watching
82+ $ ( document ) . scrollsnap ( {
83+ snaps : '.slide' ,
84+ proximity : 200
85+ } ) ;
8086
8187 function updateSlideSize ( ) {
8288 var w = window . innerWidth ;
8389 var h = window . innerHeight ;
8490 $ ( ".slide" ) . css ( "height" , h ) ;
8591 }
8692
93+ //Time toggle keybinding
8794 $ ( ".timer-toggle" ) . click ( function ( ) {
8895 $ ( ".timer-wrapper" ) . toggleClass ( "fade-out" ) ;
8996 resetTimer ( ) ;
@@ -92,16 +99,13 @@ $(function(){
9299 $ ( ".timer-amount" ) . toggle ( ) ;
93100 }
94101 } ) ;
95-
96102 $ ( "#start-stop" ) . click ( function ( ) {
97103 var timeLeftDisplay = $ ( "#time-left" )
98104 var min = $ ( "#minutes" ) . attr ( "value" ) ;
99105 var duration = min * 60 ;
100106
101107 $ ( ".timer-amount" ) . toggle ( ) ;
102-
103108 resetTimer ( ) ;
104-
105109 timeLeftInterval = setInterval ( function ( ) {
106110 timeLeftDisplay . html ( Math . floor ( ( duration ) / 60 ) + ":" + ( duration % 60 < 10 ? "0" + duration % 60 :duration % 60 ) ) ;
107111 duration = -- duration ;
@@ -111,19 +115,12 @@ $(function(){
111115 }
112116 } , 1000 ) ;
113117 } ) ;
114-
115118 function resetTimer ( ) {
116119 clearInterval ( timeLeftInterval ) ;
117120 $ ( "#time-left" ) . html ( "" ) ;
118121 }
119122
120- buildToc ( ) ;
121-
122- $ ( document ) . scrollsnap ( {
123- snaps : '.slide' ,
124- proximity : 100
125- } ) ;
126-
123+ // Table of Contents header parsing and builder
127124 function buildToc ( ) {
128125 var headings = $ ( ".curriculum h2" ) ,
129126 toc = $ ( "#toc-list" ) ;
0 commit comments