jekyll-theme-open-course 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_layouts/calendar.html +15 -2
- data/assets/js/site.js +124 -71
- data/lib/jtoc.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b09a6cad886465d099731b73e29af902f0090bd7dd2ea5fa205605db2985d79
|
4
|
+
data.tar.gz: 78eebd7ecb8fcad3138444969f987b3bff2ceeb402114e502bbc523a4c1f860e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b70ff525e5feffc9c4717a1756af5ab92a21fdb095a8f425ecb18e822391a2e8a0345a84d9917c578f8fe249ea99c00516434542f467a43be458e3d970ba98ea
|
7
|
+
data.tar.gz: '0795071f2df2501ed8799f2420ca96223aaaa8319ce7c97f86369cd6977a437fe8536d9b97bc12721317636fcdd9a1a01ca7e821d52f97217fa3a52a8d82ed92'
|
data/_layouts/calendar.html
CHANGED
@@ -4,13 +4,21 @@ layout: default
|
|
4
4
|
{% assign util = site.data.utility %}
|
5
5
|
{% assign projects = site.projects %}
|
6
6
|
|
7
|
+
{% assign week_count = site.data.calendar | size %}
|
8
|
+
{% assign final_week = week_count | minus: 1 %}
|
9
|
+
|
10
|
+
{% assign today = "today" | date: "%s" %}
|
11
|
+
{% assign last_expiry = site.data.calendar[final_week].expires | date: "%s" %}
|
12
|
+
|
7
13
|
{% assign current = true %}
|
14
|
+
{% if today > last_expiry %}
|
15
|
+
{% assign current = false %}
|
16
|
+
{% endif %}
|
8
17
|
|
9
18
|
{% for entry in site.data.calendar %}
|
10
19
|
{% assign week_int = forloop.index | times: 1 %}
|
11
20
|
{% capture week_num %}{% if week_int < 10 %}0{% endif %}{{ week_int }}{% endcapture %}
|
12
21
|
{% assign week = site.weeks[forloop.index0] %}
|
13
|
-
{% assign today = "today" | date: "%s" %}
|
14
22
|
{% assign expiry = entry.expires | date: "%s" %}
|
15
23
|
|
16
24
|
<!-- past dates? -->
|
@@ -66,7 +74,12 @@ layout: default
|
|
66
74
|
<aside class="assigned">
|
67
75
|
<header>
|
68
76
|
<h3>Assigned Work</h3>
|
69
|
-
|
77
|
+
{% if entry.due_date %}
|
78
|
+
{% assign due_date = entry.due_date %}
|
79
|
+
{% else %}
|
80
|
+
{% assign due_date = entry.expires %}
|
81
|
+
{% endif %}
|
82
|
+
<small>Due {{ due_date | date: "%A, %B %-e" }}</small>
|
70
83
|
</header>
|
71
84
|
{% if week.readings %}
|
72
85
|
<section class="readings">
|
data/assets/js/site.js
CHANGED
@@ -25,73 +25,111 @@ if ('serviceWorker' in navigator) {
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
|
29
|
-
|
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
|
-
|
44
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
-
|
70
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
89
|
-
|
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
|
-
|
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
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
118
|
-
|
119
|
-
|
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
|
-
|
164
|
+
nav.removeChild(nav.firstChild); // remove text nodes
|
122
165
|
}
|
123
166
|
}
|
124
|
-
for (var i = 0; i <
|
125
|
-
|
167
|
+
for (var i = 0; i < nav_items.length; i++) {
|
168
|
+
quick_nav.appendChild(nav_items[i]);
|
126
169
|
}
|
127
|
-
|
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
|
-
|
175
|
+
full_nav.classList.add('hidden');
|
130
176
|
}
|
131
177
|
if (!responsiveFeature('navbar') && html.classList.contains('navbar')) {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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]);
|
184
|
+
}
|
185
|
+
if (thm_btn) {
|
186
|
+
quick_nav.appendChild(nav_thm);
|
136
187
|
}
|
137
|
-
|
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
|
@@ -204,6 +255,8 @@ if ('fetch' in window) {
|
|
204
255
|
data = data[0]; // only need most recent commit
|
205
256
|
// Lowercase commit message's first word to run in `...to XYZ` copy:
|
206
257
|
commit.message = data.commit.message.charAt(0).toLowerCase() + data.commit.message.slice(1);
|
258
|
+
// Grab only the first line of a multiline message
|
259
|
+
commit.message = commit.message.split("\n\n")[0];
|
207
260
|
commit.url = data.html_url;
|
208
261
|
commit.stamp = data.commit.author.date;
|
209
262
|
commit.date = new Date(commit.stamp);
|
data/lib/jtoc.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-open-course
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Stolley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.1.2
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: A Jekyll theme for accessible course sites.
|