Merge remote-tracking branch 'origin/v5.4.9' into v5.4.9

# Conflicts:
#	assets/built/casper.js.map
#	assets/built/screen.css
#	assets/built/screen.css.map
#	assets/css/screen.css
#	assets/js/dropdown.js
#	package.json
This commit is contained in:
Aytac Kirmizi 2023-04-11 11:41:57 +02:00
commit d1595f421a
7 changed files with 90 additions and 99 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2285,12 +2285,6 @@ html.dark-mode .footer-cta-title {
color: #fff; color: #fff;
} }
@media (max-width: 767px) {
html.dark-mode .gh-head-open #gh-head .gh-head-actions {
background-color: var(--color-darkmode);
}
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
html.auto-color body { html.auto-color body {
color: rgba(255, 255, 255, 0.75); color: rgba(255, 255, 255, 0.75);
@ -2475,12 +2469,6 @@ html.dark-mode .footer-cta-title {
html.auto-color .footer-cta-title { html.auto-color .footer-cta-title {
color: #fff; color: #fff;
} }
@media (max-width: 767px) {
html.auto-color .gh-head-open #gh-head .gh-head-actions {
background-color: var(--color-darkmode);
}
}
} }
/* /*

View File

@ -1,82 +1,85 @@
(function () { (function () {
const mediaQuery = window.matchMedia('(max-width: 767px)'); const mediaQuery = window.matchMedia('(max-width: 767px)');
const head = document.querySelector('.gh-head'); const head = document.querySelector('.gh-head');
const menu = head.querySelector('.gh-head-menu'); const menu = head.querySelector('.gh-head-menu');
const nav = menu.querySelector('.nav'); const nav = menu.querySelector('.nav');
if (!nav) return; if (!nav) return;
const logo = document.querySelector('.gh-head-logo'); const logo = document.querySelector('.gh-head-logo');
const navHTML = nav.innerHTML; const navHTML = nav.innerHTML;
if (mediaQuery.matches) { if (mediaQuery.matches) {
const items = nav.querySelectorAll('li'); const items = nav.querySelectorAll('li');
items.forEach(function (item, index) { items.forEach(function (item, index) {
item.style.transitionDelay = 0.03 * (index + 1) + 's'; item.style.transitionDelay = 0.03 * (index + 1) + 's';
}); });
} }
const makeDropdown = function () { var windowClickListener;
if (mediaQuery.matches) return; const makeDropdown = function () {
const submenuItems = []; if (mediaQuery.matches) return;
const submenuItems = [];
while ((nav.offsetWidth + 64) > menu.offsetWidth) {
if (nav.lastElementChild) { while ((nav.offsetWidth + 64) > menu.offsetWidth) {
submenuItems.unshift(nav.lastElementChild); if (nav.lastElementChild) {
nav.lastElementChild.remove(); submenuItems.unshift(nav.lastElementChild);
} else { nav.lastElementChild.remove();
return; } else {
} return;
} }
}
if (!submenuItems.length) {
document.body.classList.add('is-dropdown-loaded'); if (!submenuItems.length) {
return; document.body.classList.add('is-dropdown-loaded');
} return;
}
const toggle = document.createElement('button');
toggle.setAttribute('class', 'nav-more-toggle'); const toggle = document.createElement('button');
toggle.setAttribute('aria-label', 'More'); toggle.setAttribute('class', 'nav-more-toggle');
toggle.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M21.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM13.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM5.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0z"></path></svg>'; toggle.setAttribute('aria-label', 'More');
toggle.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M21.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM13.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM5.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0z"></path></svg>';
const wrapper = document.createElement('div');
wrapper.setAttribute('class', 'gh-dropdown'); const wrapper = document.createElement('div');
wrapper.setAttribute('class', 'gh-dropdown');
if (submenuItems.length >= 10) {
document.body.classList.add('is-dropdown-mega'); if (submenuItems.length >= 10) {
wrapper.style.gridTemplateRows = 'repeat(' + Math.ceil(submenuItems.length / 2) + ', 1fr)'; document.body.classList.add('is-dropdown-mega');
} else { wrapper.style.gridTemplateRows = 'repeat(' + Math.ceil(submenuItems.length / 2) + ', 1fr)';
document.body.classList.remove('is-dropdown-mega'); } else {
} document.body.classList.remove('is-dropdown-mega');
}
submenuItems.forEach(function (child) {
wrapper.appendChild(child); submenuItems.forEach(function (child) {
}); wrapper.appendChild(child);
});
toggle.appendChild(wrapper);
nav.appendChild(toggle); toggle.appendChild(wrapper);
nav.appendChild(toggle);
document.body.classList.add('is-dropdown-loaded');
document.body.classList.add('is-dropdown-loaded');
toggle.addEventListener('click', function () {
document.body.classList.toggle('is-dropdown-open'); toggle.addEventListener('click', function () {
}); document.body.classList.toggle('is-dropdown-open');
});
window.addEventListener('click', function (e) {
if (!toggle.contains(e.target) && document.body.classList.contains('is-dropdown-open')) { windowClickListener = function (e) {
document.body.classList.remove('is-dropdown-open'); if (!toggle.contains(e.target) && document.body.classList.contains('is-dropdown-open')) {
} document.body.classList.remove('is-dropdown-open');
}); }
} };
window.addEventListener('click', windowClickListener);
imagesLoaded(head, function () { }
makeDropdown();
}); imagesLoaded(head, function () {
makeDropdown();
window.addEventListener('resize', function () { });
setTimeout(function () {
nav.innerHTML = navHTML; window.addEventListener('resize', function () {
makeDropdown(); setTimeout(function () {
}, 1); window.removeEventListener('click', windowClickListener);
}); nav.innerHTML = navHTML;
})(); makeDropdown();
}, 1);
});
})();

View File

@ -2,7 +2,7 @@
"name": "casper-aytac", "name": "casper-aytac",
"description": "A clean, minimal default theme for the Ghost publishing platform with little modifications by Aytac", "description": "A clean, minimal default theme for the Ghost publishing platform with little modifications by Aytac",
"demo": "https://aytac.kirmizi.online", "demo": "https://aytac.kirmizi.online",
"version": "5.4.8", "version": "5.4.9",
"engines": { "engines": {
"ghost": ">=5.0.0" "ghost": ">=5.0.0"
}, },