Stylesheet Updats

This commit is contained in:
2025-08-24 23:47:15 -05:00
parent a215784424
commit f2e774f8ec
35 changed files with 6083 additions and 16022 deletions

View File

@@ -0,0 +1,147 @@
/**
* darkmode-toggle.js — Floating theme switch (class-based, CSP-proof)
* @version 2.2.1
* Storage key: "theme" -> "light" | "dark"
* Corner from <body data-theme-fab-pos="br|bl|tr|tl"> (default br)
*/
(function () {
'use strict';
var STORAGE_KEY = 'theme';
var docEl = document.documentElement;
var mql = window.matchMedia('(prefers-color-scheme: dark)');
function getStored() { try { return localStorage.getItem(STORAGE_KEY); } catch (e) { return null; } }
function setStored(v) { try { localStorage.setItem(STORAGE_KEY, v); } catch (e) {} }
function clearStored() { try { localStorage.removeItem(STORAGE_KEY); } catch (e) {} }
function systemTheme() { return mql.matches ? 'dark' : 'light'; }
function applyTheme(theme) {
docEl.setAttribute('data-bs-theme', theme);
docEl.setAttribute('data-aria-theme', theme);
var meta = document.querySelector('meta[name="theme-color"]');
if (meta) {
meta.setAttribute('content', theme === 'dark' ? '#0f1115' : '#ffffff');
}
var sw = document.getElementById('mokoThemeSwitch');
if (sw) {
sw.setAttribute('aria-checked', theme === 'dark' ? 'true' : 'false');
}
}
function initTheme() {
var stored = getStored();
applyTheme(stored ? stored : systemTheme());
}
function posClassFromBody() {
var pos = (document.body.getAttribute('data-theme-fab-pos') || 'br').toLowerCase();
if (!/^(br|bl|tr|tl)$/.test(pos)) pos = 'br';
return 'pos-' + pos;
}
function buildToggle() {
if (document.getElementById('mokoThemeFab')) return;
var wrap = document.createElement('div');
wrap.id = 'mokoThemeFab';
wrap.className = posClassFromBody();
// Light label
var lblL = document.createElement('span');
lblL.className = 'label';
lblL.textContent = 'Light';
// Switch
var switchWrap = document.createElement('button');
switchWrap.id = 'mokoThemeSwitch';
switchWrap.type = 'button';
switchWrap.setAttribute('role', 'switch');
switchWrap.setAttribute('aria-label', 'Toggle dark mode');
switchWrap.setAttribute('aria-checked', 'false'); // updated after init
var track = document.createElement('span');
track.className = 'switch';
var knob = document.createElement('span');
knob.className = 'knob';
track.appendChild(knob);
switchWrap.appendChild(track);
// Dark label
var lblD = document.createElement('span');
lblD.className = 'label';
lblD.textContent = 'Dark';
// Auto button
var auto = document.createElement('button');
auto.id = 'mokoThemeAuto';
auto.type = 'button';
auto.className = 'btn btn-sm btn-link text-decoration-none px-2';
auto.setAttribute('aria-label', 'Follow system theme');
auto.textContent = 'Auto';
// Behavior
switchWrap.addEventListener('click', function () {
var current = (docEl.getAttribute('data-bs-theme') || 'light').toLowerCase();
var next = current === 'dark' ? 'light' : 'dark';
applyTheme(next);
setStored(next);
});
auto.addEventListener('click', function () {
clearStored();
applyTheme(systemTheme());
});
// Respond to OS changes only when not user-forced
var onMql = function () {
if (!getStored()) applyTheme(systemTheme());
};
if (typeof mql.addEventListener === 'function') mql.addEventListener('change', onMql);
else if (typeof mql.addListener === 'function') mql.addListener(onMql);
// Initial state
var initial = getStored() || systemTheme();
switchWrap.setAttribute('aria-checked', initial === 'dark' ? 'true' : 'false');
// Mount
wrap.appendChild(lblL);
wrap.appendChild(switchWrap);
wrap.appendChild(lblD);
wrap.appendChild(auto);
document.body.appendChild(wrap);
// Debug helper
window.mokoThemeFabStatus = function () {
var el = document.getElementById('mokoThemeFab');
if (!el) return { mounted: false };
var r = el.getBoundingClientRect();
return {
mounted: true,
rect: { top: r.top, left: r.left, width: r.width, height: r.height },
zIndex: window.getComputedStyle(el).zIndex,
posClass: el.className
};
};
// Outline if invisible
setTimeout(function () {
var r = wrap.getBoundingClientRect();
if (r.width < 10 || r.height < 10) {
wrap.classList.add('debug-outline');
console.warn('[moko] Theme FAB mounted but appears too small — check CSS collisions.');
}
}, 50);
}
function init() {
initTheme();
buildToggle();
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();

View File

@@ -1,2 +1,11 @@
/* MOKO-COPYRIGHT: © 2025-08-10 Jonathan Miller || Moko Consulting — https://mokoconsulting.tech */
/**
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @file /media/templates/site/moko-cassiopeia/js/mod_gabble.js
* @copyright (C) 2025 Jonathan Miler || Moko Consulting <https://mokoconsulting.tech>
* @website: https://mokoconsulting.tech
* @email: hello@mokoconsulting.tech
* @phone: +1 (931) 279-6313
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @note This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/

View File

@@ -1,31 +1,42 @@
/* MOKO-COPYRIGHT: © 2025-08-10 Jonathan Miller || Moko Consulting — https://mokoconsulting.tech */
/**
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @file /media/templates/site/moko-cassiopeia/js/mod_menu/menu-metismenu-es5.js
* @copyright (C) 2025 Jonathan Miler || Moko Consulting <https://mokoconsulting.tech>
* @website: https://mokoconsulting.tech
* @email: hello@mokoconsulting.tech
* @phone: +1 (931) 279-6313
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @note This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
(function () {
'use strict';
'use strict';
/**
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 4.0.0
*/
/**
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 4.0.0
*/
document.addEventListener('DOMContentLoaded', function () {
var allMenus = document.querySelectorAll('ul.mod-menu_dropdown-metismenu');
allMenus.forEach(function (menu) {
// eslint-disable-next-line no-new, no-undef
var mm = new MetisMenu(menu, {
triggerElement: 'button.mm-toggler'
}).on('shown.metisMenu', function (event) {
window.addEventListener('click', function mmClick(e) {
if (!event.target.contains(e.target)) {
mm.hide(event.detail.shownElement);
window.removeEventListener('click', mmClick);
}
});
});
});
});
document.addEventListener('DOMContentLoaded', function () {
var allMenus = document.querySelectorAll('ul.mod-menu_dropdown-metismenu');
allMenus.forEach(function (menu) {
// eslint-disable-next-line no-new, no-undef
var mm = new MetisMenu(menu, {
triggerElement: 'button.mm-toggler'
}).on('shown.metisMenu', function (event) {
window.addEventListener('click', function mmClick(e) {
if (!event.target.contains(e.target)) {
mm.hide(event.detail.shownElement);
window.removeEventListener('click', mmClick);
}
});
});
});
});
})();

View File

@@ -1,27 +1,29 @@
/* MOKO-COPYRIGHT: © 2025-08-10 Jonathan Miller || Moko Consulting — https://mokoconsulting.tech */
/**
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
* @copyright (C) 2025 Jonathan Miler || Moko Consulting <https://mokoconsulting.tech>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 4.0.0
* @file /media/templates/site/moko-cassiopeia/js/mod_menu/menu-metismenu.js
* @copyright (C) 2025 Jonathan Miler || Moko Consulting <https://mokoconsulting.tech>
* @website: https://mokoconsulting.tech
* @email: hello@mokoconsulting.tech
* @phone: +1 (931) 279-6313
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @note This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
document.addEventListener('DOMContentLoaded', () => {
const allMenus = document.querySelectorAll('ul.mod-menu_dropdown-metismenu');
allMenus.forEach(menu => {
// eslint-disable-next-line no-new, no-undef
const mm = new MetisMenu(menu, {
triggerElement: 'button.mm-toggler'
}).on('shown.metisMenu', event => {
window.addEventListener('click', function mmClick(e) {
if (!event.target.contains(e.target)) {
mm.hide(event.detail.shownElement);
window.removeEventListener('click', mmClick);
}
});
});
});
const allMenus = document.querySelectorAll('ul.mod-menu_dropdown-metismenu');
allMenus.forEach(menu => {
// eslint-disable-next-line no-new, no-undef
const mm = new MetisMenu(menu, {
triggerElement: 'button.mm-toggler'
}).on('shown.metisMenu', event => {
window.addEventListener('click', function mmClick(e) {
if (!event.target.contains(e.target)) {
mm.hide(event.detail.shownElement);
window.removeEventListener('click', mmClick);
}
});
});
});
});

View File

@@ -1,76 +1,120 @@
/* MOKO-COPYRIGHT: © 2025-08-10 Jonathan Miller || Moko Consulting — https://mokoconsulting.tech */
/**
* template.js — Custom JavaScript for the Moko Cassiopeia Joomla template
*
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @since 4.0.0
* @file /media/templates/site/moko-cassiopeia/js/template.js
* @version 2.0
*
* @copyright (C) 2025 Moko Consulting
* @author Jonathan Miller
* @website https://mokoconsulting.tech
* @email hello@mokoconsulting.tech
* @phone +1 (931) 279-6313
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This file is part of a Moko Consulting project.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Joomla = window.Joomla || {};
(function (win, doc) {
"use strict";
(function(Joomla, document) {
'use strict';
/**
* Utility: smooth scroll to top
*/
function backToTop() {
win.scrollTo({ top: 0, behavior: "smooth" });
}
function initTemplate(event) {
var target = event && event.target ? event.target : document;
/**
* Utility: toggle body class on scroll for sticky header styling
*/
function handleScroll() {
if (win.scrollY > 50) {
doc.body.classList.add("scrolled");
} else {
doc.body.classList.remove("scrolled");
}
}
/**
* Prevent clicks on buttons within a disabled fieldset
*/
var fieldsets = target.querySelectorAll('fieldset.btn-group');
for (var i = 0; i < fieldsets.length; i++) {
var self = fieldsets[i];
if (self.getAttribute('disabled') === true) {
self.style.pointerEvents = 'none';
var btns = self.querySelectorAll('.btn');
for (var ib = 0; ib < btns.length; ib++) {
btns[ib].classList.add('disabled');
}
}
}
}
/**
* Initialize Bootstrap TOC if #toc element exists.
* Requires bootstrap-toc.min.js to be loaded.
*/
function initTOC() {
if (typeof win.Toc === "function" && doc.querySelector("#toc")) {
win.Toc.init({
$nav: $("#toc"),
$scope: $("main")
});
}
}
document.addEventListener('DOMContentLoaded', function (event) {
initTemplate(event);
/**
* Initialize offcanvas drawer buttons for left/right drawers.
* Uses Bootstrap's offcanvas component.
*/
function initDrawers() {
var leftBtn = doc.querySelector(".drawer-toggle-left");
var rightBtn = doc.querySelector(".drawer-toggle-right");
if (leftBtn) {
leftBtn.addEventListener("click", function () {
var target = doc.querySelector(leftBtn.getAttribute("data-bs-target"));
if (target) new bootstrap.Offcanvas(target).show();
});
}
if (rightBtn) {
rightBtn.addEventListener("click", function () {
var target = doc.querySelector(rightBtn.getAttribute("data-bs-target"));
if (target) new bootstrap.Offcanvas(target).show();
});
}
}
/**
* Back to top
*/
var backToTop = document.getElementById('back-top');
/**
* Initialize back-to-top link if present
*/
function initBackTop() {
var backTop = doc.getElementById("back-top");
if (backTop) {
backTop.addEventListener("click", function (e) {
e.preventDefault();
backToTop();
});
}
}
if (backToTop) {
/**
* Run all template JS initializations
*/
function init() {
// Sticky header behavior
handleScroll();
win.addEventListener("scroll", handleScroll);
function checkScrollPos() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
backToTop.classList.add('visible');
} else {
backToTop.classList.remove('visible')
}
}
checkScrollPos();
window.onscroll = function() {
checkScrollPos();
};
backToTop.addEventListener('click', function(event) {
event.preventDefault();
window.scrollTo(0, 0);
});
}
[].slice.call(document.head.querySelectorAll('link[rel="lazy-stylesheet"]'))
.forEach(function($link){
$link.rel = "stylesheet";
});
});
/**
* Initialize when a part of the page was updated
*/
document.addEventListener('joomla:updated', initTemplate);
})(Joomla, document);
// Init features
initTOC();
initDrawers();
initBackTop();
}
if (doc.readyState === "loading") {
doc.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})(window, document);

View File

@@ -0,0 +1,111 @@
/**
* theme-init.js — Light/Dark mode initialization for Moko Cassiopeia
*
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @file /media/templates/site/moko-cassiopeia/js/theme-init.js
* @version 2.0
*
* @copyright (C) 2025 Moko Consulting
* @author Jonathan Miller
* @website https://mokoconsulting.tech
* @email hello@mokoconsulting.tech
* @phone +1 (931) 279-6313
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This file is part of a Moko Consulting project.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
(function (win, doc) {
"use strict";
var storageKey = "theme"; // localStorage key
var mql = win.matchMedia("(prefers-color-scheme: dark)");
var root = doc.documentElement;
/**
* Apply theme to <html>, syncing both data-bs-theme and data-aria-theme.
* @param {"light"|"dark"} theme
*/
function applyTheme(theme) {
root.setAttribute("data-bs-theme", theme);
root.setAttribute("data-aria-theme", theme);
try { localStorage.setItem(storageKey, theme); } catch (e) {}
}
/**
* Clear stored preference so system preference is followed.
*/
function clearStored() {
try { localStorage.removeItem(storageKey); } catch (e) {}
}
/**
* Determine system theme.
*/
function systemTheme() {
return mql.matches ? "dark" : "light";
}
/**
* Initialize theme on load.
*/
function init() {
var stored = null;
try { stored = localStorage.getItem(storageKey); } catch (e) {}
var theme = stored ? stored : systemTheme();
applyTheme(theme);
// Listen for system changes only if Auto mode (no stored)
var onChange = function () {
if (!localStorage.getItem(storageKey)) {
applyTheme(systemTheme());
}
};
if (typeof mql.addEventListener === "function") {
mql.addEventListener("change", onChange);
} else if (typeof mql.addListener === "function") {
mql.addListener(onChange);
}
// Hook toggle UI if present
var switchEl = doc.getElementById("themeSwitch");
var autoBtn = doc.getElementById("themeAuto");
if (switchEl) {
switchEl.checked = (theme === "dark");
switchEl.addEventListener("change", function () {
var choice = switchEl.checked ? "dark" : "light";
applyTheme(choice);
});
}
if (autoBtn) {
autoBtn.addEventListener("click", function () {
clearStored();
applyTheme(systemTheme());
});
}
}
if (doc.readyState === "loading") {
doc.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})(window, document);

View File

@@ -0,0 +1,31 @@
/**
* user.js — User Custom JS File for Moko Cassiopeia
*
* @package Joomla.Site
* @subpackage Templates.Moko-Cassiopeia
* @file /media/templates/site/moko-cassiopeia/js/user.js
* @version 2.0
*
* @copyright (C) 2025 Moko Consulting
* @author Jonathan Miller
* @website https://mokoconsulting.tech
* @email hello@mokoconsulting.tech
* @phone +1 (931) 279-6313
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* This file is part of a Moko Consulting project.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

View File

@@ -1,4 +1,3 @@
/* MOKO-COPYRIGHT: © 2025-08-10 Jonathan Miller || Moko Consulting — https://mokoconsulting.tech */
/*!
* Bootstrap Table of Contents v1.0.1 (http://afeld.github.io/bootstrap-toc/)
* Copyright 2015 Aidan Feldman