jekyll-theme-open-course 1.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,387 @@
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
+ font-weight: normal;
117
+ border-radius: $base-line / 4;
118
+ display: block;
119
+ padding: $base-line / 4;
120
+ text-decoration: none;
121
+ display: inline-block;
122
+ }
123
+ #btn-show-calendar {
124
+ margin-bottom: $base-line * 2;
125
+ text-decoration: none;
126
+ }
127
+
128
+ .agenda h3 a {
129
+ padding: $base-line / 8 $base-line / 4;
130
+ padding: calc(#{$base-line / 10} - 1px) $base-line / 4 calc(#{$base-line / 8} - 1px) $base-line / 4;
131
+ margin-top: -($base-line / 8);
132
+ }
133
+ .youtube {
134
+ float: left;
135
+ padding-right: 5px;
136
+ padding-top: 1px;
137
+ height: 25px;
138
+ width: 25px;
139
+ }
140
+ #content header {
141
+ padding-bottom: $base-line;
142
+ }
143
+ header small {
144
+ display: block;
145
+ font-weight: 500;
146
+ // padding-top: $base-line * 0.25;
147
+ }
148
+ .week > header small {
149
+ font-weight: normal;
150
+ }
151
+
152
+ #content article {
153
+ padding-bottom: $base-line * 3;
154
+ }
155
+
156
+ .current {
157
+ padding: $base-line * 1.5;
158
+ margin: ($base-line * 1.5) (-($base-line * 1.5));
159
+ }
160
+
161
+ .assigned {
162
+ padding-top: $base-line;
163
+ }
164
+
165
+ #header {
166
+ padding: $base-line * 0.5;
167
+ }
168
+ #header p {
169
+ min-height: $base-line * 4;
170
+ padding-top: $base-line * 0.5;
171
+ }
172
+ #header,
173
+ #content,
174
+ #footer,
175
+ #instructor {
176
+ padding-left: $base-line * 1.5;
177
+ padding-right: $base-line * 1.5;
178
+ }
179
+
180
+ #instructor {
181
+ padding-bottom: $base-line * 2;
182
+ }
183
+
184
+ /* ~ 690px */
185
+ @media screen and (min-width: 43.125em) {
186
+ #header,
187
+ .policy,
188
+ .project,
189
+ .week,
190
+ #instructor,
191
+ #footer {
192
+ display: grid;
193
+ grid-template-columns: repeat(5,1fr);
194
+ grid-column-gap: $base-line;
195
+ }
196
+ .week {
197
+ grid-template-rows: auto ($base-line * 3.25);
198
+ align-content: stretch;
199
+ }
200
+ .policy header,
201
+ .project header,
202
+ .week header {
203
+ grid-column: 1 / 6;
204
+ }
205
+ .week .agendas {
206
+ grid-column: 1 / 3;
207
+ grid-row-start: 3;
208
+ }
209
+ .week .assigned {
210
+ padding-top: 0;
211
+ grid-column: 3 / 6;
212
+ grid-row: 2 / 4;
213
+ }
214
+
215
+ .policy > * {
216
+ grid-column: 1 / 5;
217
+ }
218
+ #books.policy section,
219
+ #materials.policy .required {
220
+ grid-column: 1 / 4;
221
+ }
222
+ #books.policy .fine-print,
223
+ #materials.policy .recommended {
224
+ grid-column: 4 / 6;
225
+ grid-row: 3 / 5;
226
+ }
227
+ #books.policy .fine-print,
228
+ #materials.policy .recommended {
229
+ grid-row: 2 / 5;
230
+ }
231
+ .project .description {
232
+ grid-column: 1 / 3;
233
+ grid-row: 2 / 3;
234
+ }
235
+ .project .goals {
236
+ grid-column: 1 / 3;
237
+ grid-row: 3 / 4;
238
+ }
239
+ .project .deliverables,
240
+ .project .requirements {
241
+ grid-column: 3 / 6;
242
+ }
243
+ .project .preview {
244
+ grid-column: 1 / 6;
245
+ }
246
+ #header h1 {
247
+ grid-column: 1 / 6;
248
+ }
249
+ #header p {
250
+ grid-column: 1 / 4;
251
+ }
252
+ #header #quick-nav {
253
+ grid-column: 1 / 6;
254
+ }
255
+
256
+ #instructor > * {
257
+ grid-column: 2 / 6;
258
+ }
259
+ #footer #full-nav {
260
+ grid-column: 1 / 2;
261
+ }
262
+ #footer #colophon {
263
+ grid-column: 2 / 6;
264
+ }
265
+ .navbar #instructor > *,
266
+ .navbar #footer #colophon {
267
+ grid-column: 1 / 4;
268
+ }
269
+ }
270
+
271
+ /* ~ 855px */
272
+ @media screen and (min-width: 53.4375em) {
273
+ #header,
274
+ #content,
275
+ #footer,
276
+ #instructor {
277
+ padding: ($base-line * 1.5) 10%;
278
+ }
279
+ #instructor {
280
+ padding-bottom: $base-line * 2;
281
+ }
282
+ #footer {
283
+ padding-top: 0;
284
+ }
285
+ h2 {
286
+ font-size: $base-size * $mod-scale * $mod-scale * $mod-scale * $mod-scale;
287
+ line-height: $base-line * 2.5;
288
+ }
289
+ .project .description {
290
+ grid-column: 1 / 4;
291
+ grid-row: 2 / 3;
292
+ }
293
+ .project .goals {
294
+ grid-column: 4 / 6;
295
+ grid-row: 2 / 3;
296
+ }
297
+ .project .deliverables,
298
+ .project .requirements {
299
+ grid-row: 3 / 6;
300
+ }
301
+ .project .deliverables {
302
+ grid-column: 1 / 3;
303
+ }
304
+ .project .requirements {
305
+ grid-column: 3 / 6;
306
+ }
307
+ .project .preview {
308
+ grid-column: 1 / 4;
309
+ }
310
+ }
311
+
312
+ /* ~ 890px */
313
+ @media screen and (min-width: 55.625em) {
314
+ body::after {
315
+ content: 'navbar';
316
+ display: none;
317
+ }
318
+ .links {
319
+ display: grid;
320
+ grid-template-columns: repeat(3,1fr);
321
+ grid-column-gap: $base-line;
322
+ }
323
+ .links header {
324
+ grid-column: 1 / 4;
325
+ }
326
+ .links .suggestions {
327
+ grid-column: 2 / span 2;
328
+ }
329
+ }
330
+
331
+ /* ~ 1100px */
332
+ @media screen and (min-width: 68.75em) {
333
+ #header,
334
+ #content,
335
+ #footer,
336
+ #instructor {
337
+ padding-top: ($base-line * 3);
338
+ }
339
+ #footer {
340
+ padding-top: 0;
341
+ }
342
+ .policy,
343
+ .project,
344
+ .week {
345
+ grid-column-gap: $base-line * 1.5;
346
+ }
347
+ h2 {
348
+ font-size: $base-size * $mod-scale * $mod-scale * $mod-scale * $mod-scale * $mod-scale;
349
+ line-height: $base-line * 3;
350
+ }
351
+ }
352
+
353
+ /* States */
354
+ .js .past,
355
+ .grad .ugrad,
356
+ .ugrad .grad,
357
+ .grad .grad h3,
358
+ .ugrad .ugrad h3 {
359
+ display: none;
360
+ }
361
+
362
+ /**
363
+ * A quick baseline grid overlay using css+svg.
364
+ * Inspired by [Basehold.it](https://basehold.it/).
365
+ * @author leshido
366
+ */
367
+
368
+ .g body {
369
+ position: relative;
370
+ }
371
+
372
+ .g body::after {
373
+ 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;
374
+ content: "";
375
+ display: block;
376
+ pointer-events: none;
377
+ top: 0;
378
+ right: 0;
379
+ bottom: 0;
380
+ left: 0;
381
+ z-index: 9999;
382
+ position: absolute;
383
+ }
384
+
385
+ .g body:active::after {
386
+ display: none;
387
+ }
@@ -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;
@@ -212,11 +212,11 @@ if ((document.querySelector('#calendar')) && (document.querySelector('#this-week
212
212
  // location.hash = '#this-week'; // point at the new hash position; viewport should show this one
213
213
  // }
214
214
  var btn_show_calendar = document.createElement('a');
215
+ var past_weeks = document.querySelectorAll('article.past');
215
216
  btn_show_calendar.id = "btn-show-calendar";
216
217
  btn_show_calendar.href = "#null";
217
218
  btn_show_calendar.text = "Show Previous Weeks"
218
219
  btn_show_calendar.addEventListener('click', function(e) {
219
- var past_weeks = document.querySelectorAll('article.past');
220
220
  for (var week of past_weeks) {
221
221
  week.classList.remove('past');
222
222
  }
@@ -224,7 +224,9 @@ if ((document.querySelector('#calendar')) && (document.querySelector('#this-week
224
224
  e.preventDefault();
225
225
  }
226
226
  );
227
- current_week.insertAdjacentElement('afterend', btn_show_calendar);
227
+ if (past_weeks.length > 1) {
228
+ current_week.insertAdjacentElement('afterend', btn_show_calendar);
229
+ }
228
230
  }
229
231
 
230
232
  if ('fetch' in window) {
@@ -235,7 +237,13 @@ if ('fetch' in window) {
235
237
  var url = document.querySelector('#github').getAttribute('href'); // grab the href value of the repo link
236
238
  if (typeof(url) !== 'undefined') {
237
239
  var fragment = url.substring(url.indexOf('.com/') + 5); // find the tail end (5 = .com/)
238
- return 'https://api.github.com/repos/' + fragment + '/commits?per_page=1'; // return the API url
240
+ var branch_regex = /tree/gi;
241
+ var branch_fragment = fragment.replace(branch_regex,'branches'); // replace 'tree' with 'branches'
242
+ // If not dealing with an archival branch (no replacement), append the `main` branch
243
+ if (fragment === branch_fragment) {
244
+ branch_fragment = fragment + '/branches/main';
245
+ }
246
+ return 'https://api.github.com/repos/' + branch_fragment; // return the branch API url
239
247
  }
240
248
  })();
241
249
 
@@ -251,14 +259,14 @@ if ('fetch' in window) {
251
259
  return response.json();
252
260
  })
253
261
  .then(function(data) {
262
+ var c = data.commit; // Work only with the commit property of the branch API response
254
263
  var commit = {};
255
- data = data[0]; // only need most recent commit
256
264
  // Lowercase commit message's first word to run in `...to XYZ` copy:
257
- commit.message = data.commit.message.charAt(0).toLowerCase() + data.commit.message.slice(1);
265
+ commit.message = c.commit.message.charAt(0).toLowerCase() + c.commit.message.slice(1);
258
266
  // Grab only the first line of a multiline message
259
267
  commit.message = commit.message.split("\n\n")[0];
260
- commit.url = data.html_url;
261
- commit.stamp = data.commit.author.date;
268
+ commit.url = c.html_url;
269
+ commit.stamp = c.commit.author.date;
262
270
  commit.date = new Date(commit.stamp);
263
271
  // Put the date in Day, Month 31 at <Local Time String> format
264
272
  commit.time_string = namedDays[commit.date.getDay()] + ', ' +
@@ -272,6 +280,28 @@ if ('fetch' in window) {
272
280
  }
273
281
  }
274
282
 
283
+ // This is 10,000 kinds of ugly and bad, but it gets the job done...for now.
284
+ var course_levels = ['grad','ugrad','all'];
285
+ var title = document.querySelector('title');
286
+ var title_components = {};
287
+ title_components.original = title.innerText.trim();
288
+ title_components.name = title_components.original.split(':')[1] // Web Real-Time Communications
289
+ title_components.full = title_components.original.split(':')[0]; // ITMD 469/545
290
+ title_components.code = title_components.full.split(' ')[0]; // ITMD
291
+ title_components.all = title_components.full.split(' ')[1]; // 469/545
292
+ title_components.ugrad = title_components.all.split('/')[0]; // 469
293
+ title_components.grad = title_components.all.split('/')[1]; // 545
294
+
295
+ document.querySelector('#footer').addEventListener('dblclick', function(e) {
296
+ // Adjust the <title> contents
297
+ title.innerText = title_components.code + ' ' + title_components[course_levels[0]] + ': ' + title_components.name;
298
+ // Switch up the ancestor level class
299
+ html.classList.remove(course_levels[course_levels.length - 1]);
300
+ html.classList.add(course_levels[0]);
301
+ // Push the current level to the end of the array
302
+ course_levels.push(course_levels.shift());
303
+ });
304
+
275
305
  window.addEventListener('keyup', function(e) {
276
306
  // console.log(e.keyCode);
277
307
  // Toggle the visibility of gridlines when `g` is pressed