2018-01-11 02:57:18 +00:00
|
|
|
/*
|
2018-01-08 00:12:11 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* The Codex Mythica
|
|
|
|
*
|
2018-01-11 03:08:50 +00:00
|
|
|
* @copyright Copyright 2017-2018 Eric Woodward
|
2018-01-11 02:57:18 +00:00
|
|
|
* @license CC0 Public Domain License v1.0
|
2018-01-08 00:12:11 +00:00
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
****************************************************************************/
|
|
|
|
;
|
|
|
|
(function(){
|
|
|
|
'use strict';
|
|
|
|
|
2018-01-11 02:57:18 +00:00
|
|
|
// Check if the browser "cuts the mustard" - https://gomakethings.com/ditching-jquery/
|
2018-01-08 00:12:11 +00:00
|
|
|
if ( !(!!document.querySelector && !!window.addEventListener) ) return;
|
|
|
|
|
2018-01-11 02:57:18 +00:00
|
|
|
// NodeLisr.forEach polyfill for IE11
|
|
|
|
// See: https://github.com/imagitama/nodelist-foreach-polyfill/issues/3
|
|
|
|
if (window.NodeList && !NodeList.prototype.forEach) {
|
|
|
|
NodeList.prototype.forEach = Array.prototype.forEach;
|
|
|
|
}
|
|
|
|
|
|
|
|
let
|
2018-01-08 00:12:11 +00:00
|
|
|
protocol = window.location.protocol;
|
|
|
|
|
|
|
|
// Indicate JS is loaded
|
|
|
|
document.documentElement.className = document.documentElement.className.replace('no-js', 'js');
|
|
|
|
|
|
|
|
// Enable cached fonts ASAP
|
|
|
|
if (typeof Cookies !== 'undefined' && !!Cookies.get('fonts_loaded')) {
|
|
|
|
document.documentElement.className += " js-hasFontsLoaded";
|
|
|
|
}
|
|
|
|
docReady(function() {
|
|
|
|
setTimeout(function() {
|
|
|
|
// Handle Fonts
|
|
|
|
if (typeof Cookies !== 'undefined') {
|
|
|
|
if (typeof FontFaceObserver !== 'undefined') {
|
|
|
|
var
|
|
|
|
font_ls = new FontFaceObserver('liberation_serif'),
|
|
|
|
font_msc = new FontFaceObserver('marcellus_sc');
|
|
|
|
Promise.all([
|
|
|
|
font_ls.load(),
|
|
|
|
font_msc.load()
|
|
|
|
]).then(function () {
|
|
|
|
if (document.documentElement.className.indexOf("js-hasFontsLoaded") == -1) {
|
|
|
|
document.documentElement.className += " js-hasFontsLoaded";
|
|
|
|
}
|
|
|
|
Cookies.set('fonts_loaded', true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lazy-Load Media
|
|
|
|
if (typeof loadMedia === 'function') {
|
|
|
|
loadMedia('.js-lazyLoader', null, true);
|
|
|
|
}
|
2018-01-11 02:57:18 +00:00
|
|
|
|
2018-01-08 00:12:11 +00:00
|
|
|
document
|
|
|
|
.querySelectorAll('.js-checkToggle')
|
|
|
|
.forEach(function (el) {
|
|
|
|
el
|
|
|
|
.addEventListener('click', function() {
|
|
|
|
let
|
|
|
|
checks =
|
|
|
|
document
|
|
|
|
.querySelectorAll('input[name="' + this.htmlFor + '"]'),
|
|
|
|
is_checked = !!checks && checks.length > 0 ? checks[0].checked : false;
|
|
|
|
checks.forEach(function(check) {
|
|
|
|
check.checked = !is_checked;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2018-01-11 02:57:18 +00:00
|
|
|
|
2018-01-08 00:12:11 +00:00
|
|
|
/*
|
|
|
|
document
|
|
|
|
.querySelectorAll('.js-ulToggle')
|
|
|
|
.forEach(function (el) {
|
|
|
|
el.parentNode.classList.add('js-ulToggle-hidden')
|
|
|
|
el
|
|
|
|
.addEventListener('click', function() {
|
|
|
|
// let list = this.parentNode.querySelector('.js-ulToggle-list');
|
|
|
|
let fieldset = this.parentNode;
|
|
|
|
if (fieldset && fieldset.className) {
|
|
|
|
if (fieldset.className.indexOf('js-ulToggle-hidden') === -1) {
|
|
|
|
fieldset.classList.add('js-ulToggle-hidden');
|
|
|
|
} else {
|
|
|
|
fieldset.classList.remove('js-ulToggle-hidden');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
2018-01-11 02:57:18 +00:00
|
|
|
|
|
|
|
|
2018-01-08 00:12:11 +00:00
|
|
|
// fix search link on 404
|
|
|
|
if (document.documentElement.className.indexOf('is404') > -1) {
|
|
|
|
document
|
|
|
|
.getElementById("searchQuery")
|
|
|
|
.value =
|
|
|
|
window
|
|
|
|
.location
|
|
|
|
.pathname
|
|
|
|
.replace(/\\.html?$/, "")
|
|
|
|
.replace(/\//g, " ");
|
|
|
|
}
|
2018-01-11 02:57:18 +00:00
|
|
|
|
2018-01-08 00:12:11 +00:00
|
|
|
}, 1);
|
|
|
|
});
|
|
|
|
}());
|