kcc-gem-theme 1.50.28 → 1.51.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_data/cache_bust_css.yml +1 -1
- data/_data/theme_hash.yml +1 -1
- data/_includes/emergency-alerts.html +14 -0
- data/_includes/scripts/emergency-alerts.html +2 -0
- data/_layouts/default.html +3 -1
- data/assets/css/kcc-theme.css +1 -1
- data/assets/js/theme/dist/alerts.bundle.js +1 -0
- data/assets/js/theme/dist/kcc-alerts.bundle.js +1 -1
- data/assets/js/theme/dist/kcc-mega-nav.bundle.js +1 -1
- data/assets/js/theme/dist/kcc-nav.bundle.js +1 -1
- data/assets/js/theme/dist/kcc-theme-landing.bundle.js +1 -1
- data/assets/js/theme/dist/kcc-theme.bundle.js +1 -1
- data/assets/js/theme/emergency/alerts.js +5 -0
- data/assets/js/theme/emergency/campusAlertsSheetsAPI.js +41 -0
- data/assets/js/theme/emergency/createAlertsHtml.js +91 -0
- data/assets/js/theme/emergency/parseMarkdownToHTML.js +63 -0
- data/assets/js/theme/emergency/simpleSetSheetParameters.js +23 -0
- data/assets/scss/1-base/_typography.scss +3 -0
- metadata +10 -2
@@ -0,0 +1,63 @@
|
|
1
|
+
function replaceRegex(string, regex, replacement) {
|
2
|
+
const newString = string.replace(regex, replacement);
|
3
|
+
return newString;
|
4
|
+
}
|
5
|
+
|
6
|
+
function escapeCharacters(string, escapeOption) {
|
7
|
+
const escapedCharactersObject = {
|
8
|
+
'\\*': '__asterisk__',
|
9
|
+
'\\_': '__underscore__',
|
10
|
+
'\\[': '__openBracket__',
|
11
|
+
'\\]': '__closeBracket__',
|
12
|
+
'\\(': '__openParenthesis__',
|
13
|
+
'\\)': '__closeParenthesis__'
|
14
|
+
}
|
15
|
+
|
16
|
+
for (let char in escapedCharactersObject) {
|
17
|
+
if (escapedCharactersObject.hasOwnProperty(char)) {
|
18
|
+
escapeOption === true ? string = replaceRegex(string, char, escapedCharactersObject[char])
|
19
|
+
: escapeOption === false ? string = replaceRegex(string, escapedCharactersObject[char], char.replace(/^\\/g, ''))
|
20
|
+
: null;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return string;
|
24
|
+
}
|
25
|
+
|
26
|
+
function createAnchorElements(string) {
|
27
|
+
return string = string.replace(/\[(?<linkText>[^\]]*)\]\((?<linkHref>[^\)]*)\)/g, '<a href="$<linkHref>" target="_blank" rel="noopener noreferrer">$<linkText></a>');
|
28
|
+
}
|
29
|
+
|
30
|
+
function createInlineElements(string) {
|
31
|
+
const inlineElementObject = {
|
32
|
+
'strong': /\*\*([^\*]*)\*\*/g,
|
33
|
+
'em': /(?<!_)_([^_]*)(?<!_)_/g // That's some pretty intense RegEx right there: "Negative lookbehind" to omit the escaped characters
|
34
|
+
}
|
35
|
+
for (var el in inlineElementObject) {
|
36
|
+
if (inlineElementObject.hasOwnProperty(el)) {
|
37
|
+
string = string.replace(inlineElementObject[el], '<' + el + '>$1</' + el + '>' );
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return string;
|
41
|
+
}
|
42
|
+
|
43
|
+
function createParagraphElements(string) {
|
44
|
+
return string = string.replace(/(?<!$)^(.*)(?<!^)$/gm, '<p class="typography__alert">$1</p>');
|
45
|
+
}
|
46
|
+
|
47
|
+
function parseMarkdownToHTML(string) {
|
48
|
+
const escapedString = escapeCharacters(string, true);
|
49
|
+
const stringWithInlineElements = createInlineElements(escapedString);
|
50
|
+
const stringWithAnchorElements = createAnchorElements(stringWithInlineElements);
|
51
|
+
const stringWithParagraphElements = createParagraphElements(stringWithAnchorElements);
|
52
|
+
const unescapedString = escapeCharacters(stringWithParagraphElements, false);
|
53
|
+
//console.log(unescapedString);
|
54
|
+
return unescapedString;
|
55
|
+
}
|
56
|
+
|
57
|
+
//
|
58
|
+
// USAGE:
|
59
|
+
// import parseMarkdownToHTML from './parseMarkdownToHTML.js';
|
60
|
+
//
|
61
|
+
// parseMarkdownToHTML(stringContainingSimplifiedMarkdown);
|
62
|
+
|
63
|
+
export default parseMarkdownToHTML;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
function setId(params, i) {
|
2
|
+
return params.spreadsheetId = i;
|
3
|
+
}
|
4
|
+
|
5
|
+
function setRange(params, r) {
|
6
|
+
return params.range = r;
|
7
|
+
}
|
8
|
+
|
9
|
+
function setSheetParameters(key, tab) {
|
10
|
+
let sheetParams = {};
|
11
|
+
|
12
|
+
setId(sheetParams, key);
|
13
|
+
setRange(sheetParams, tab);
|
14
|
+
return sheetParams;
|
15
|
+
}
|
16
|
+
//
|
17
|
+
// USAGE:
|
18
|
+
// const SHEET_KEY = '1spDfZUVLeEE5n0OFvbXl2FSJD_RmS0dSPc7CSGr1TjI'; // Long string from the URL of the Google Sheet
|
19
|
+
// const TAB_NAME = 'Scholarships Count' // Name as it appears on the "tab" of the desired sheet. Usually "Sheet1", "Sheet2", etc. if not renamed.
|
20
|
+
//
|
21
|
+
// const sheetParams = setSheetParameters(SHEET_KEY, TAB_NAME);
|
22
|
+
//
|
23
|
+
export default setSheetParameters;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kcc-gem-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.51.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wdzajicek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- _includes/contacts.html
|
76
76
|
- _includes/document-head.html
|
77
77
|
- _includes/emergency-alert.html
|
78
|
+
- _includes/emergency-alerts.html
|
78
79
|
- _includes/foot.html
|
79
80
|
- _includes/footer.html
|
80
81
|
- _includes/header-global.html
|
@@ -90,6 +91,7 @@ files:
|
|
90
91
|
- _includes/nav-sub.html
|
91
92
|
- _includes/old-head.html
|
92
93
|
- _includes/scripts/custom.html
|
94
|
+
- _includes/scripts/emergency-alerts.html
|
93
95
|
- _includes/scripts/google-api.html
|
94
96
|
- _includes/scripts/google-noscript.html
|
95
97
|
- _includes/scripts/google-tag.html
|
@@ -184,11 +186,17 @@ files:
|
|
184
186
|
- assets/js/theme/alerts/gapi.js
|
185
187
|
- assets/js/theme/alerts/simpleSetSheetParameters.js
|
186
188
|
- assets/js/theme/alerts/trackAlertsCloseClicks.js
|
189
|
+
- assets/js/theme/dist/alerts.bundle.js
|
187
190
|
- assets/js/theme/dist/kcc-alerts.bundle.js
|
188
191
|
- assets/js/theme/dist/kcc-mega-nav.bundle.js
|
189
192
|
- assets/js/theme/dist/kcc-nav.bundle.js
|
190
193
|
- assets/js/theme/dist/kcc-theme-landing.bundle.js
|
191
194
|
- assets/js/theme/dist/kcc-theme.bundle.js
|
195
|
+
- assets/js/theme/emergency/alerts.js
|
196
|
+
- assets/js/theme/emergency/campusAlertsSheetsAPI.js
|
197
|
+
- assets/js/theme/emergency/createAlertsHtml.js
|
198
|
+
- assets/js/theme/emergency/parseMarkdownToHTML.js
|
199
|
+
- assets/js/theme/emergency/simpleSetSheetParameters.js
|
192
200
|
- assets/js/theme/landing/landing.js
|
193
201
|
- assets/js/theme/landing/landingPage.js
|
194
202
|
- assets/js/theme/nav/megaNav/closeMegaNavOnClick.js
|