Move KefinTweaks configuration button to Administration area on the left menu

This commit is contained in:
HighImKevin
2025-11-23 19:17:49 -05:00
parent f5090bbd8f
commit c720ee7d7b
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -47,7 +47,7 @@
.navMenuOption:has(.build) {
order: 9999;
margin-top: 2em !important;
margin-top: 3em !important;
position: relative;
}
@@ -179,5 +179,5 @@ summary.listItemBodyText {
.navMenuOption:has(.build):hover:not(.navMenuOption-selected) {
transform: none !important;
margin-top: 2em !important;
margin-top: 3em !important;
}
+2 -1
View File
@@ -4656,7 +4656,8 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`;
'Configure',
'build',
configUrl,
false
false,
'.adminMenuOptions'
);
if (success) {
+5 -4
View File
@@ -283,12 +283,13 @@
* @param {string} icon - Material icon name
* @param {string} url - URL to navigate to
* @param {boolean} openInNewTab - Whether to open in new tab (default: false)
* @param {string} containerSelector - CSS selector for the container to add the link to (default: '.customMenuOptions')
* @returns {Promise<boolean>} - True if successfully added, false otherwise
*/
function addCustomMenuLink(name, icon, url, openInNewTab = false) {
function addCustomMenuLink(name, icon, url, openInNewTab = false, containerSelector = '.customMenuOptions') {
return new Promise((resolve) => {
// Check if menu container already exists
const existingContainer = document.querySelector('.customMenuOptions');
const existingContainer = document.querySelector(containerSelector);
if (existingContainer) {
const success = addLinkToContainer(existingContainer, name, icon, url, openInNewTab);
resolve(success);
@@ -303,8 +304,8 @@
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE) {
// Check if the added node is the menu or contains it
if (node.matches?.('.customMenuOptions') || node.querySelector?.('.customMenuOptions')) {
const container = node.matches?.('.customMenuOptions') ? node : node.querySelector('.customMenuOptions');
if (node.matches?.(containerSelector) || node.querySelector?.(containerSelector)) {
const container = node.matches?.(containerSelector) ? node : node.querySelector(containerSelector);
LOG(`Custom menu container detected, adding link: ${name}`);
observer.disconnect();