Compare commits

...

9 Commits

Author SHA1 Message Date
6fbaffb998
Merge pull request #10 from spaytac/v5.4.11
V5.4.11
2023-06-07 14:59:29 +02:00
01b04e59da
Merge branch 'main' into v5.4.11 2023-06-07 14:56:41 +02:00
5ba628d1a3 **update** merged with origin 2023-06-07 14:51:10 +02:00
6abe0a1e25 **update** 2023-06-07 12:48:56 +00:00
2fa6b68cc3 **update** merged with origin 2023-06-07 14:48:08 +02:00
Sodbileg Gansukh
ba0b3d08cc v5.4.11 2023-05-09 13:30:12 +08:00
Sodbileg Gansukh
50d5727f77 Fixed mobile menu background in dark mode
no issues

- when there's no publication cover and the color scheme is in dark mode, the mobile menu had white background
- this fixes the issue by adding explicit dark mode rules to the styles
2023-05-09 13:27:37 +08:00
Sodbileg Gansukh
23f7c30365 v5.4.10 2023-04-21 09:49:57 +01:00
Sodbileg Gansukh
8ff3c6fcf1 Fixed main nav to make it work with the announcement bar 2023-04-21 09:49:37 +01:00
6 changed files with 2594 additions and 2576 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 it is too large Load Diff

View File

@ -1,85 +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';
}); });
} }
var windowClickListener; var windowClickListener;
const makeDropdown = function () { const makeDropdown = function () {
if (mediaQuery.matches) return; if (mediaQuery.matches) return;
const submenuItems = []; const submenuItems = [];
while ((nav.offsetWidth + 64) > menu.offsetWidth) { while ((nav.offsetWidth + 64) > menu.offsetWidth) {
if (nav.lastElementChild) { if (nav.lastElementChild) {
submenuItems.unshift(nav.lastElementChild); submenuItems.unshift(nav.lastElementChild);
nav.lastElementChild.remove(); nav.lastElementChild.remove();
} else { } else {
return; return;
} }
} }
if (!submenuItems.length) { if (!submenuItems.length) {
document.body.classList.add('is-dropdown-loaded'); document.body.classList.add('is-dropdown-loaded');
return; return;
} }
const toggle = document.createElement('button'); const toggle = document.createElement('button');
toggle.setAttribute('class', 'nav-more-toggle'); toggle.setAttribute('class', 'nav-more-toggle');
toggle.setAttribute('aria-label', 'More'); 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>'; 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'); const wrapper = document.createElement('div');
wrapper.setAttribute('class', 'gh-dropdown'); wrapper.setAttribute('class', 'gh-dropdown');
if (submenuItems.length >= 10) { if (submenuItems.length >= 10) {
document.body.classList.add('is-dropdown-mega'); document.body.classList.add('is-dropdown-mega');
wrapper.style.gridTemplateRows = 'repeat(' + Math.ceil(submenuItems.length / 2) + ', 1fr)'; wrapper.style.gridTemplateRows = 'repeat(' + Math.ceil(submenuItems.length / 2) + ', 1fr)';
} else { } else {
document.body.classList.remove('is-dropdown-mega'); document.body.classList.remove('is-dropdown-mega');
} }
submenuItems.forEach(function (child) { submenuItems.forEach(function (child) {
wrapper.appendChild(child); wrapper.appendChild(child);
}); });
toggle.appendChild(wrapper); toggle.appendChild(wrapper);
nav.appendChild(toggle); nav.appendChild(toggle);
document.body.classList.add('is-dropdown-loaded'); document.body.classList.add('is-dropdown-loaded');
toggle.addEventListener('click', function () { toggle.addEventListener('click', function () {
document.body.classList.toggle('is-dropdown-open'); document.body.classList.toggle('is-dropdown-open');
}); });
windowClickListener = function (e) { windowClickListener = function (e) {
if (!toggle.contains(e.target) && document.body.classList.contains('is-dropdown-open')) { if (!toggle.contains(e.target) && document.body.classList.contains('is-dropdown-open')) {
document.body.classList.remove('is-dropdown-open'); document.body.classList.remove('is-dropdown-open');
} }
}; };
window.addEventListener('click', windowClickListener); window.addEventListener('click', windowClickListener);
} }
imagesLoaded(head, function () { imagesLoaded(head, function () {
makeDropdown(); makeDropdown();
}); });
window.addEventListener('resize', function () { window.addEventListener('resize', function () {
setTimeout(function () { setTimeout(function () {
window.removeEventListener('click', windowClickListener); window.removeEventListener('click', windowClickListener);
nav.innerHTML = navHTML; nav.innerHTML = navHTML;
makeDropdown(); makeDropdown();
}, 1); }, 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.9", "version": "5.4.11",
"engines": { "engines": {
"ghost": ">=5.0.0" "ghost": ">=5.0.0"
}, },