jekyll-theme-open-course 1.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ $font-url: "https://use.typekit.net/qqk1feg.css";
2
+
3
+ $primary-font-family: "alber-new-web", serif;
4
+ $secondary-font-family: "abril-titling-narrow";
5
+ $tertiary-font-family: "abril-titling";
6
+
7
+ // Font-Weight Reference
8
+ // Alder New Web: 300 (retina); 400 (normal); 500 (medium); 700 (bold)
9
+ // Abril Titling Narrow: 600 (semibold)
10
+ // Abril Titling: 700 (bold)
@@ -0,0 +1,382 @@
1
+ $base-size-px: 19;
2
+ $base-line-px: 25;
3
+ $base-size: ($base-size-px / 16) * 100%;
4
+ $base-line: ($base-line-px / $base-size-px) * 1rem;
5
+ $mod-scale: 1.25;
6
+
7
+
8
+ html {
9
+ -webkit-text-size-adjust: none;
10
+ font-family: $primary-font-family;
11
+ font-size: 19px;
12
+ }
13
+
14
+ @media screen and (min-resolution: 192dpi), (-webkit-min-device-pixel-ratio: 2) {
15
+ html {
16
+ font-weight: 300;
17
+ }
18
+ }
19
+
20
+ h2 {
21
+ font-family: $secondary-font-family;
22
+ font-weight: 600;
23
+ font-size: $base-size * $mod-scale * $mod-scale;
24
+ line-height: $base-line * 1.5;
25
+ }
26
+
27
+ #content b,
28
+ #content strong {
29
+ font-weight: 500;
30
+ }
31
+
32
+ #nav-con {
33
+ position: absolute;
34
+ left: -10000px;
35
+ }
36
+ #full-nav.hidden {
37
+ display: none;
38
+ }
39
+ #quick-nav {
40
+ align-items: baseline;
41
+ display: flex;
42
+ justify-content: space-between;
43
+ }
44
+ #quick-nav .nav {
45
+ display: flex;
46
+ flex: 1 0 auto;
47
+ flex-flow: row wrap;
48
+ justify-content: flex-end;
49
+ }
50
+ #quick-nav li {
51
+ padding: 0;
52
+ margin-left: $base-line / 2;
53
+ }
54
+ .navbar #quick-nav li::before {
55
+ content: "";
56
+ }
57
+ #nav-con a {
58
+ text-decoration: none;
59
+ }
60
+ .nav a {
61
+ border-radius: $base-line / 4;
62
+ display: block;
63
+ padding: $base-line / 4;
64
+ padding: calc(#{$base-line / 5} - 1px) $base-line / 4 calc(#{$base-line / 4} - 1px) $base-line / 4;
65
+ text-decoration: none;
66
+ }
67
+
68
+ .nav li::before {
69
+ content: "";
70
+ }
71
+
72
+ #header h1 a {
73
+ text-decoration: none;
74
+ }
75
+
76
+ #header #theme-button {
77
+ opacity: 0.55;
78
+ line-height: 0;
79
+ }
80
+
81
+ /* ~ 370px */
82
+ @media screen and (min-width: 23.125em) {
83
+ #header h1 {
84
+ position: relative;
85
+ }
86
+ }
87
+
88
+ /* ~ 620px */
89
+ @media screen and (min-width: 38.75em) {
90
+ h2 {
91
+ font-family: $tertiary-font-family;
92
+ font-weight: 700;
93
+ font-size: $base-size * $mod-scale * $mod-scale * $mod-scale;
94
+ line-height: $base-line * 2;
95
+ }
96
+ }
97
+
98
+ #header h3,
99
+ #footer h3,
100
+ #instructor h3,
101
+ .agenda h3 {
102
+ text-transform: none;
103
+ font-weight: 500;
104
+ padding-bottom: $base-line / 2;
105
+ }
106
+ .agenda h3 {
107
+ padding-bottom: $base-line / 4;
108
+ }
109
+ .assigned h3,
110
+ .project h3 {
111
+ font-weight: bold;
112
+ }
113
+
114
+ #btn-show-calendar,
115
+ .agenda h3 a {
116
+ border-radius: $base-line / 4;
117
+ display: block;
118
+ padding: $base-line / 4;
119
+ text-decoration: none;
120
+ display: inline-block;
121
+ }
122
+ #btn-show-calendar {
123
+ margin-bottom: $base-line * 2;
124
+ text-decoration: none;
125
+ }
126
+
127
+ .agenda h3 a {
128
+ padding: $base-line / 8 $base-line / 4;
129
+ padding: calc(#{$base-line / 10} - 1px) $base-line / 4 calc(#{$base-line / 8} - 1px) $base-line / 4;
130
+ margin-top: -($base-line / 8);
131
+ }
132
+ .agenda h3 a::before {
133
+ content: "▸ ";
134
+ }
135
+ #content header {
136
+ padding-bottom: $base-line;
137
+ }
138
+ header small {
139
+ display: block;
140
+ font-weight: 500;
141
+ // padding-top: $base-line * 0.25;
142
+ }
143
+ .week > header small {
144
+ font-weight: normal;
145
+ }
146
+
147
+ #content article {
148
+ padding-bottom: $base-line * 3;
149
+ }
150
+
151
+ .current {
152
+ padding: $base-line * 1.5;
153
+ margin: ($base-line * 1.5) (-($base-line * 1.5));
154
+ }
155
+
156
+ .assigned {
157
+ padding-top: $base-line;
158
+ }
159
+
160
+ #header {
161
+ padding: $base-line * 0.5;
162
+ }
163
+ #header p {
164
+ min-height: $base-line * 4;
165
+ padding-top: $base-line * 0.5;
166
+ }
167
+ #header,
168
+ #content,
169
+ #footer,
170
+ #instructor {
171
+ padding-left: $base-line * 1.5;
172
+ padding-right: $base-line * 1.5;
173
+ }
174
+
175
+ #instructor {
176
+ padding-bottom: $base-line * 2;
177
+ }
178
+
179
+ /* ~ 690px */
180
+ @media screen and (min-width: 43.125em) {
181
+ #header,
182
+ .policy,
183
+ .project,
184
+ .week,
185
+ #instructor,
186
+ #footer {
187
+ display: grid;
188
+ grid-template-columns: repeat(5,1fr);
189
+ grid-column-gap: $base-line;
190
+ }
191
+ .week {
192
+ grid-template-rows: auto ($base-line * 3.25);
193
+ align-content: stretch;
194
+ }
195
+ .policy header,
196
+ .project header,
197
+ .week header {
198
+ grid-column: 1 / 6;
199
+ }
200
+ .week .agendas {
201
+ grid-column: 1 / 3;
202
+ grid-row-start: 3;
203
+ }
204
+ .week .assigned {
205
+ padding-top: 0;
206
+ grid-column: 3 / 6;
207
+ grid-row: 2 / 4;
208
+ }
209
+
210
+ .policy > * {
211
+ grid-column: 1 / 5;
212
+ }
213
+ #books.policy section,
214
+ #materials.policy .required {
215
+ grid-column: 1 / 4;
216
+ }
217
+ #books.policy .fine-print,
218
+ #materials.policy .recommended {
219
+ grid-column: 4 / 6;
220
+ grid-row: 3 / 5;
221
+ }
222
+ #books.policy .fine-print,
223
+ #materials.policy .recommended {
224
+ grid-row: 2 / 5;
225
+ }
226
+ .project .description {
227
+ grid-column: 1 / 3;
228
+ grid-row: 2 / 3;
229
+ }
230
+ .project .goals {
231
+ grid-column: 1 / 3;
232
+ grid-row: 3 / 4;
233
+ }
234
+ .project .deliverables,
235
+ .project .requirements {
236
+ grid-column: 3 / 6;
237
+ }
238
+ .project .preview {
239
+ grid-column: 1 / 6;
240
+ }
241
+ #header h1 {
242
+ grid-column: 1 / 6;
243
+ }
244
+ #header p {
245
+ grid-column: 1 / 4;
246
+ }
247
+ #header #quick-nav {
248
+ grid-column: 1 / 6;
249
+ }
250
+
251
+ #instructor > * {
252
+ grid-column: 2 / 6;
253
+ }
254
+ #footer #full-nav {
255
+ grid-column: 1 / 2;
256
+ }
257
+ #footer #colophon {
258
+ grid-column: 2 / 6;
259
+ }
260
+ .navbar #instructor > *,
261
+ .navbar #footer #colophon {
262
+ grid-column: 1 / 4;
263
+ }
264
+ }
265
+
266
+ /* ~ 855px */
267
+ @media screen and (min-width: 53.4375em) {
268
+ #header,
269
+ #content,
270
+ #footer,
271
+ #instructor {
272
+ padding: ($base-line * 1.5) 10%;
273
+ }
274
+ #instructor {
275
+ padding-bottom: $base-line * 2;
276
+ }
277
+ #footer {
278
+ padding-top: 0;
279
+ }
280
+ h2 {
281
+ font-size: $base-size * $mod-scale * $mod-scale * $mod-scale * $mod-scale;
282
+ line-height: $base-line * 2.5;
283
+ }
284
+ .project .description {
285
+ grid-column: 1 / 4;
286
+ grid-row: 2 / 3;
287
+ }
288
+ .project .goals {
289
+ grid-column: 4 / 6;
290
+ grid-row: 2 / 3;
291
+ }
292
+ .project .deliverables,
293
+ .project .requirements {
294
+ grid-row: 3 / 6;
295
+ }
296
+ .project .deliverables {
297
+ grid-column: 1 / 3;
298
+ }
299
+ .project .requirements {
300
+ grid-column: 3 / 6;
301
+ }
302
+ .project .preview {
303
+ grid-column: 1 / 4;
304
+ }
305
+ }
306
+
307
+ /* ~ 890px */
308
+ @media screen and (min-width: 55.625em) {
309
+ body::after {
310
+ content: 'navbar';
311
+ display: none;
312
+ }
313
+ .links {
314
+ display: grid;
315
+ grid-template-columns: repeat(3,1fr);
316
+ grid-column-gap: $base-line;
317
+ }
318
+ .links header {
319
+ grid-column: 1 / 4;
320
+ }
321
+ .links .suggestions {
322
+ grid-column: 2 / span 2;
323
+ }
324
+ }
325
+
326
+ /* ~ 1100px */
327
+ @media screen and (min-width: 68.75em) {
328
+ #header,
329
+ #content,
330
+ #footer,
331
+ #instructor {
332
+ padding-top: ($base-line * 3);
333
+ }
334
+ #footer {
335
+ padding-top: 0;
336
+ }
337
+ .policy,
338
+ .project,
339
+ .week {
340
+ grid-column-gap: $base-line * 1.5;
341
+ }
342
+ h2 {
343
+ font-size: $base-size * $mod-scale * $mod-scale * $mod-scale * $mod-scale * $mod-scale;
344
+ line-height: $base-line * 3;
345
+ }
346
+ }
347
+
348
+ /* States */
349
+ .js .past,
350
+ .grad .ugrad,
351
+ .ugrad .grad,
352
+ .grad .grad h3,
353
+ .ugrad .ugrad h3 {
354
+ display: none;
355
+ }
356
+
357
+ /**
358
+ * A quick baseline grid overlay using css+svg.
359
+ * Inspired by [Basehold.it](https://basehold.it/).
360
+ * @author leshido
361
+ */
362
+
363
+ .g body {
364
+ position: relative;
365
+ }
366
+
367
+ .g body::after {
368
+ background: url('data:image/svg+xml;utf8,<svg height="25" width="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="0.5" style="fill:rgba(255, 0, 0, 0.3)" /></svg>') repeat top left;
369
+ content: "";
370
+ display: block;
371
+ pointer-events: none;
372
+ top: 0;
373
+ right: 0;
374
+ bottom: 0;
375
+ left: 0;
376
+ z-index: 9999;
377
+ position: absolute;
378
+ }
379
+
380
+ .g body:active::after {
381
+ display: none;
382
+ }
@@ -1,3 +1,12 @@
1
+ html {
2
+ font-size: 11pt;
3
+ color: black;
4
+ }
5
+
6
+ * {
7
+ color: black;
8
+ }
9
+
1
10
  #header,
2
11
  #footer {
3
12
  color: inherit;
@@ -7,7 +16,12 @@ a,
7
16
  text-decoration: none;
8
17
  color: inherit;
9
18
  }
10
- #content a[href^="http"]::after {
19
+ .agenda h3 a {
20
+ display: none;
21
+ }
22
+
23
+ #content a[href^="http"]::after,
24
+ #footer a[href^="http"]::after {
11
25
  display: inline;
12
26
  content: "(" attr(href) ")";
13
27
  font-family: Menlo, Monaco, "Droid Sans Mono", Courier, "Courier New", monospace;
@@ -19,14 +33,10 @@ p,li {
19
33
  -webkit-hyphens: none;
20
34
  hyphens: none;
21
35
  }
22
- h2 {
23
- font-family: "moderno-fb-condensed";
24
- font-weight: 700;
25
- }
26
-
27
36
 
28
37
  /* Hide Navigation Stuff */
29
38
 
39
+ #quick-nav,
30
40
  #nav-nav,
31
41
  #full-nav {
32
42
  display: none;
@@ -25,73 +25,111 @@ if ('serviceWorker' in navigator) {
25
25
  }
26
26
  }
27
27
 
28
- function themeSwitcher() {
29
- // Exit fast if no CSS properties support
30
- if (!('supports' in CSS && CSS.supports("(--foo: bar)"))) {
31
- return;
32
- }
33
-
34
- var header = document.querySelector('#header h1');
35
- var toggle = document.createElement('a');
36
- var html = document.querySelector('html');
37
- // Icons from https://remixicon.com/
38
- var icons = {
39
- light: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>',
40
- dark: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>'
41
- }
28
+ // Load up the theme switcher if @supports & custom properties available
29
+ if ('supports' in CSS && CSS.supports("(--foo: bar)")) {
42
30
 
43
- var dark_mode = false;
44
- var modes = ['light','dark'];
31
+ function ThemeSwitch() {
32
+ var html = document.querySelector('html');
33
+ var icons = {
34
+ light: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></svg>',
35
+ dark: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.38 2.019a7.5 7.5 0 1 0 10.6 10.6C21.662 17.854 17.316 22 12.001 22 6.477 22 2 17.523 2 12c0-5.315 4.146-9.661 9.38-9.981z"/></svg>',
36
+ system: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2V4a8 8 0 1 0 0 16z"/></svg>'
37
+ // system: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 1l9.5 5.5v11L12 23l-9.5-5.5v-11L12 1zm0 2.311L4.5 7.653v8.694l7.5 4.342 7.5-4.342V7.653L12 3.311zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm0-2a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></svg>'
38
+ }
39
+ var mode = 'system';
40
+ var modes = ['dark','light'];
41
+ var button = document.createElement('a');
45
42
 
46
- if ('matchMedia' in window) {
47
- dark_mode = window.matchMedia('(prefers-color-scheme: dark)').matches;
48
- if (dark_mode) {
49
- modes.reverse(); // ['dark','light']
43
+ var cleanupOldPreferences = function() {
44
+ // Clean up earlier `modes` item
45
+ if (storageAvailable('localStorage')) {
46
+ localStorage.removeItem('modes');
47
+ }
50
48
  }
51
- }
52
49
 
53
- if (storageAvailable('localStorage')) {
54
- if (!localStorage.getItem('modes')) {
55
- localStorage.setItem('modes',modes.join(','));
56
- } else {
57
- modes = localStorage.getItem('modes').split(',');
50
+ var loadPreference = function() {
51
+ // read from local storage
52
+ if (storageAvailable('localStorage')) {
53
+ if (localStorage.getItem('mode')) {
54
+ mode = localStorage.getItem('mode');
55
+ } else {
56
+ mode = 'system';
57
+ }
58
+ }
58
59
  }
59
- }
60
60
 
61
- html.classList.add(modes[0]);
61
+ var setModeOrder = function() {
62
+ // reverse the modes if dark mode is preferred,
63
+ // or if dark is set in preferences
64
+ if ('matchMedia' in window) {
65
+ if (window.matchMedia('(prefers-color-scheme: dark)').matches && (mode !== 'light')) {
66
+ modes.reverse(); // ['light','dark']
67
+ }
68
+ }
69
+ // system gets tacked onto the end as the last option, always
70
+ modes.push('system');
71
+ }
62
72
 
63
- toggle.id = 'theme-toggle';
64
- toggle.href = '#null';
65
- toggle.title = 'Switch to ' + modes[1] + ' theme';
66
- toggle.innerHTML = icons[modes[1]];
67
- header.appendChild(toggle);
73
+ var storePreference = function() {
74
+ // store current mode (default or selected) in local storage
75
+ if (storageAvailable('localStorage')) {
76
+ localStorage.setItem('mode', mode);
77
+ }
78
+ }
68
79
 
69
- toggle.addEventListener('click', function(e) {
70
- e.preventDefault();
71
- html.classList.replace(modes[0],modes[1]);
72
- modes.reverse();
73
- if (storageAvailable('localStorage')) {
74
- localStorage.setItem('modes',modes.join(','));
80
+ var setHTMLClass = function() {
81
+ html.classList.replace(mode,modes[0]);
75
82
  }
76
- toggle.title = 'Switch to ' + modes[1] + ' theme';
77
- toggle.innerHTML = icons[modes[1]];
78
- });
79
83
 
80
- function storageAvailable(type) {
81
- try {
82
- var storage = window[type];
83
- var x = '__storage_test__';
84
- storage.setItem(x, x);
85
- storage.removeItem(x);
86
- return true;
84
+ var cycleModes = function() {
85
+ mode = modes.shift(); // grab the current mode from the front of the array...
86
+ modes.push(mode); // ...and push it to the end of the array
87
87
  }
88
- catch(e) {
89
- return false;
88
+
89
+ this.switcherButton = function() {
90
+ button.id = 'theme-button';
91
+ button.href = '#null';
92
+ button.title = 'Switch to ' + modes[0] + ' theme';
93
+ button.innerHTML = icons[modes[0]];
94
+ button.addEventListener('click', function(e) {
95
+ e.preventDefault();
96
+ // fix the class list on <html>
97
+ setHTMLClass();
98
+ cycleModes();
99
+ storePreference();
100
+ button.title = 'Switch to ' + modes[0] + ' theme';
101
+ button.innerHTML = icons[modes[0]];
102
+ });
103
+ return button;
90
104
  }
105
+
106
+ // Do things on construction
107
+ cleanupOldPreferences();
108
+ loadPreference();
109
+ setModeOrder();
110
+ html.classList.add(mode);
91
111
  }
112
+
113
+ var ts = new ThemeSwitch();
114
+ var ts_li = document.createElement('li');
115
+ ts_li.id = 'nav-thm';
116
+ ts_li.appendChild(ts.switcherButton());
117
+ document.querySelector('#quick-nav .nav').appendChild(ts_li);
92
118
  }
93
119
 
94
- themeSwitcher();
120
+
121
+ function storageAvailable(type) {
122
+ try {
123
+ var storage = window[type];
124
+ var x = '__storage_test__';
125
+ storage.setItem(x, x);
126
+ storage.removeItem(x);
127
+ return true;
128
+ }
129
+ catch(e) {
130
+ return false;
131
+ }
132
+ }
95
133
 
96
134
  // Move the nav to the header when there is room
97
135
  // Responsive detection
@@ -107,34 +145,47 @@ function responsiveFeature(feature) {
107
145
  }
108
146
 
109
147
  function ToggledNav() {
110
- this.nav = document.querySelector('#full-nav .nav');
111
- this.quick_nav = document.querySelector('#quick-nav .nav');
112
- this.full_nav = document.querySelector('#full-nav');
113
- this.nav_nav;
114
- this.nav_items = [];
148
+ var nav = document.querySelector('#full-nav .nav');
149
+ var quick_nav = document.querySelector('#quick-nav .nav');
150
+ var full_nav = document.querySelector('#full-nav');
151
+ var thm_btn = document.querySelector('#theme-button')
152
+ var nav_thm;
153
+ var nav_nav;
154
+ var nav_items = [];
115
155
  this.toggle = function() {
116
156
  if (responsiveFeature('navbar') && !html.classList.contains('navbar')) {
117
- while (this.nav.firstChild) {
118
- if (this.nav.firstChild.tagName) {
119
- this.nav_items.push(this.nav.removeChild(this.nav.firstChild));
157
+ if (thm_btn) {
158
+ nav_thm = quick_nav.removeChild(document.getElementById('nav-thm'));
159
+ }
160
+ while (nav.firstChild) {
161
+ if (nav.firstChild.tagName) {
162
+ nav_items.push(nav.removeChild(nav.firstChild));
120
163
  } else {
121
- this.nav.removeChild(this.nav.firstChild); // remove text nodes
164
+ nav.removeChild(nav.firstChild); // remove text nodes
122
165
  }
123
166
  }
124
- for (var i = 0; i < this.nav_items.length; i++) {
125
- this.quick_nav.appendChild(this.nav_items[i]);
167
+ for (var i = 0; i < nav_items.length; i++) {
168
+ quick_nav.appendChild(nav_items[i]);
126
169
  }
127
- this.nav_nav = this.quick_nav.removeChild(document.getElementById('nav-nav'));
170
+ if (thm_btn) {
171
+ quick_nav.appendChild(nav_thm);
172
+ }
173
+ nav_nav = quick_nav.removeChild(document.getElementById('nav-nav'));
128
174
  html.classList.add('navbar');
129
- this.full_nav.classList.add('hidden');
175
+ full_nav.classList.add('hidden');
130
176
  }
131
177
  if (!responsiveFeature('navbar') && html.classList.contains('navbar')) {
132
- console.log('nav-nav node name:', this.nav_nav.nodeName);
133
- this.quick_nav.appendChild(this.nav_nav);
134
- for (var i = 0; i < this.nav_items.length; i++) {
135
- this.nav.appendChild(this.nav_items[i]);
178
+ if (thm_btn) {
179
+ nav_thm = quick_nav.removeChild(document.getElementById('nav-thm'));
180
+ }
181
+ quick_nav.appendChild(nav_nav);
182
+ for (var i = 0; i < nav_items.length; i++) {
183
+ nav.appendChild(nav_items[i]);
136
184
  }
137
- this.full_nav.classList.remove('hidden');
185
+ if (thm_btn) {
186
+ quick_nav.appendChild(nav_thm);
187
+ }
188
+ full_nav.classList.remove('hidden');
138
189
  html.classList.remove('navbar');
139
190
  }
140
191
  }
@@ -149,7 +200,7 @@ window.addEventListener('resize', function() {
149
200
 
150
201
 
151
202
  // Capture and replicate the current week at the top of the calendar
152
- if (document.querySelector('#calendar')) {
203
+ if ((document.querySelector('#calendar')) && (document.querySelector('#this-week'))) {
153
204
  var this_week = document.querySelector('#this-week').closest('article'); // grab this week's <article>
154
205
  var current_week = this_week.cloneNode(true); // make a copy of it,
155
206
  this_week.querySelector('#this-week').id = ''; // remove the original #this-week id
@@ -161,11 +212,11 @@ if (document.querySelector('#calendar')) {
161
212
  // location.hash = '#this-week'; // point at the new hash position; viewport should show this one
162
213
  // }
163
214
  var btn_show_calendar = document.createElement('a');
215
+ var past_weeks = document.querySelectorAll('article.past');
164
216
  btn_show_calendar.id = "btn-show-calendar";
165
217
  btn_show_calendar.href = "#null";
166
218
  btn_show_calendar.text = "Show Previous Weeks"
167
219
  btn_show_calendar.addEventListener('click', function(e) {
168
- var past_weeks = document.querySelectorAll('article.past');
169
220
  for (var week of past_weeks) {
170
221
  week.classList.remove('past');
171
222
  }
@@ -173,7 +224,9 @@ if (document.querySelector('#calendar')) {
173
224
  e.preventDefault();
174
225
  }
175
226
  );
176
- current_week.insertAdjacentElement('afterend', btn_show_calendar);
227
+ if (past_weeks.length > 1) {
228
+ current_week.insertAdjacentElement('afterend', btn_show_calendar);
229
+ }
177
230
  }
178
231
 
179
232
  if ('fetch' in window) {
@@ -204,6 +257,8 @@ if ('fetch' in window) {
204
257
  data = data[0]; // only need most recent commit
205
258
  // Lowercase commit message's first word to run in `...to XYZ` copy:
206
259
  commit.message = data.commit.message.charAt(0).toLowerCase() + data.commit.message.slice(1);
260
+ // Grab only the first line of a multiline message
261
+ commit.message = commit.message.split("\n\n")[0];
207
262
  commit.url = data.html_url;
208
263
  commit.stamp = data.commit.author.date;
209
264
  commit.date = new Date(commit.stamp);
@@ -219,6 +274,28 @@ if ('fetch' in window) {
219
274
  }
220
275
  }
221
276
 
277
+ // This is 10,000 kinds of ugly and bad, but it gets the job done...for now.
278
+ var course_levels = ['grad','ugrad','all'];
279
+ var title = document.querySelector('title');
280
+ var title_components = {};
281
+ title_components.original = title.innerText.trim();
282
+ title_components.name = title_components.original.split(':')[1] // Web Real-Time Communications
283
+ title_components.full = title_components.original.split(':')[0]; // ITMD 469/545
284
+ title_components.code = title_components.full.split(' ')[0]; // ITMD
285
+ title_components.all = title_components.full.split(' ')[1]; // 469/545
286
+ title_components.ugrad = title_components.all.split('/')[0]; // 469
287
+ title_components.grad = title_components.all.split('/')[1]; // 545
288
+
289
+ document.querySelector('#footer').addEventListener('dblclick', function(e) {
290
+ // Adjust the <title> contents
291
+ title.innerText = title_components.code + ' ' + title_components[course_levels[0]] + ': ' + title_components.name;
292
+ // Switch up the ancestor level class
293
+ html.classList.remove(course_levels[course_levels.length - 1]);
294
+ html.classList.add(course_levels[0]);
295
+ // Push the current level to the end of the array
296
+ course_levels.push(course_levels.shift());
297
+ });
298
+
222
299
  window.addEventListener('keyup', function(e) {
223
300
  // console.log(e.keyCode);
224
301
  // Toggle the visibility of gridlines when `g` is pressed