1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Update Daux theme using custom changes for now

This commit is contained in:
J. King 2019-08-22 13:30:10 -04:00
parent a24bfa0683
commit 2c1dcdcd6d
5 changed files with 48 additions and 40 deletions

File diff suppressed because one or more lines are too long

View file

@ -107,64 +107,57 @@ if (hljs) {
};
};
var navItems = document.querySelectorAll('.Nav__item.has-children > a');
var navItems = document.querySelectorAll('.Nav__item.has-children i.Nav__arrow');
function _toggleSubMenu(ev) {
if (ev.preventDefault !== undefined) {
ev.preventDefault();
}
var parent = ev.target.parentNode;
var parent = ev.target.parentNode.parentNode;
var subNav = parent.querySelector('ul.Nav');
if (ev.preventDefault !== undefined && parent.classList.contains('Nav__item--open')) {
subNav.style.height = 0;
// Temporarily set the height so the transition can work.
subNav.style.height = subNav.scrollHeight + 'px';
subNav.style.transitionDuration = Math.max(subNav.scrollHeight, 150) + 'ms';
subNav.style.height = '0px';
parent.classList.remove('Nav__item--open');
} else {
if (ev.preventDefault !== undefined) {
subNav.style.transitionDuration = Math.max(subNav.scrollHeight, 150) + 'ms';
// After the transition finishes set the height to auto so child
// menus can expand properly.
subNav.addEventListener('transitionend', _setHeightToAuto);
subNav.style.height = subNav.scrollHeight + 'px';
parent.classList.add('Nav__item--open');
} else {
// When running at page load the transitions don't need to fire and
// the classList doesn't need to be altered.
subNav.style.transitionDuration = '0ms';
subNav.style.height = subNav.scrollHeight + 'px';
subNav.style.transitionDuration = Math.max(subNav.scrollHeight, 150) + 'ms';
subNav.style.height = 'auto';
}
}
}
// Because font sizes change the height of the menus can change so they must
// be recalculated if necessary when the viewport size changes.
function _resize() {
var subNav = document.querySelector('.Nav .Nav'),
height, cur;
for (var i = 0; i < subNav.length; i++) {
cur = subNav[i];
height = parseFloat(cur.style.height, 10);
if (height > 0 && cur.scrollHeight !== height) {
// Transitions don't need to fire when resizing the window.
cur.style.transitionDuration = '0ms';
cur.style.height = cur.scrollHeight + 'px';
cur.style.transitionDuration = Math.max(cur.scrollHeight, 150) + 'ms';
}
function _setHeightToAuto(ev) {
if (ev.target.style.height !== '0px') {
ev.target.style.height = 'auto';
}
ev.target.removeEventListener('transitionend', _setHeightToAuto);
}
for (var i = 0, cur; i < navItems.length; i++) {
// Go in reverse here because on page load the child nav items need to be
// opened first before their parents so the height on the parents can be
// calculated properly.
for (var i = navItems.length - 1, cur; i >= 0; i--) {
cur = navItems[i];
cur.addEventListener('click', _toggleSubMenu);
if (cur.parentNode.classList.contains('Nav__item--open')) {
if (cur.parentNode.parentNode.classList.contains('Nav__item--open')) {
_toggleSubMenu({ target: cur });
}
}
window.addEventListener('resize', debounce(_resize, 150));
window.addEventListener('orientationchange', _resize);
})();
(function() {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,11 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mensbeam/daux.io/"
}
],
"require": {
"daux/daux.io": "*"
"daux/daux.io": "dev-sans-jquery"
}
}

View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "18f1867fdb8b951d62546b63f535d837",
"content-hash": "42b5c476c1c8044c78bad07aa023a824",
"packages": [
{
"name": "daux/daux.io",
"version": "0.10.0",
"version": "dev-sans-jquery",
"source": {
"type": "git",
"url": "https://github.com/dauxio/daux.io.git",
"reference": "5a19258651d5ff7d4079eda09faa537626b28420"
"url": "https://github.com/mensbeam/daux.io.git",
"reference": "7e45ef7f0040f0cabd2bd6792b074b2e9a629db0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dauxio/daux.io/zipball/5a19258651d5ff7d4079eda09faa537626b28420",
"reference": "5a19258651d5ff7d4079eda09faa537626b28420",
"url": "https://api.github.com/repos/mensbeam/daux.io/zipball/7e45ef7f0040f0cabd2bd6792b074b2e9a629db0",
"reference": "7e45ef7f0040f0cabd2bd6792b074b2e9a629db0",
"shasum": ""
},
"require": {
@ -52,7 +52,11 @@
"Todaymade\\Daux\\": "libs/"
}
},
"notification-url": "https://packagist.org/downloads/",
"scripts": {
"test": [
"phpunit"
]
},
"license": [
"MIT"
],
@ -74,7 +78,10 @@
"markdown",
"md"
],
"time": "2019-08-13T09:20:39+00:00"
"support": {
"source": "https://github.com/mensbeam/daux.io/tree/sans-jquery"
},
"time": "2019-08-17T01:08:58+00:00"
},
{
"name": "guzzlehttp/guzzle",
@ -1485,7 +1492,9 @@
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"daux/daux.io": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],