mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-07-22 21:01:40 +00:00
57 lines
2.6 KiB
HTML
57 lines
2.6 KiB
HTML
<div role="group" aria-labelledby="capability-inspector-settings-heading">
|
|
<h3 id="capability-inspector-settings-heading" class="text-sm font-medium text-gray-400 mb-2">Capability Inspector</h3>
|
|
<div class="flex flex-col gap-3 rounded-lg border border-gray-800 bg-dark-800/40 p-3">
|
|
<label class="flex items-start gap-3 text-sm text-gray-300 cursor-pointer">
|
|
<input type="checkbox" id="capability-inspector-show-nav" class="mt-1 accent-accent">
|
|
<span>
|
|
<span class="block text-gray-200">Show in Plugins menu</span>
|
|
<span class="block text-xs text-gray-500 mt-1">Adds the inspector to the desktop and mobile plugin navigation.</span>
|
|
</span>
|
|
</label>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
<button type="button" id="capability-inspector-open" class="rounded bg-dark-700 border border-gray-800 px-3 py-2 text-xs text-gray-300 hover:text-white hover:border-gray-600 transition">Open inspector</button>
|
|
<span id="capability-inspector-show-nav-status" class="text-xs text-gray-500"></span>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function () {
|
|
const key = 'capability_inspector.showInPluginsMenu';
|
|
const checkbox = document.getElementById('capability-inspector-show-nav');
|
|
const openButton = document.getElementById('capability-inspector-open');
|
|
const status = document.getElementById('capability-inspector-show-nav-status');
|
|
|
|
function isEnabled() {
|
|
try { return localStorage.getItem(key) === '1'; }
|
|
catch (_) { return false; }
|
|
}
|
|
|
|
function render() {
|
|
const enabled = isEnabled();
|
|
if (checkbox) checkbox.checked = enabled;
|
|
if (status) status.textContent = enabled ? 'Menu link enabled' : 'Menu link hidden';
|
|
}
|
|
|
|
function refreshPluginsMenu() {
|
|
if (typeof window.loadPlugins !== 'function') return;
|
|
setTimeout(() => window.loadPlugins(), 0);
|
|
}
|
|
|
|
if (checkbox) {
|
|
checkbox.addEventListener('change', () => {
|
|
try {
|
|
if (checkbox.checked) localStorage.setItem(key, '1');
|
|
else localStorage.removeItem(key);
|
|
} catch (_) {}
|
|
render();
|
|
refreshPluginsMenu();
|
|
});
|
|
}
|
|
if (openButton) {
|
|
openButton.addEventListener('click', () => {
|
|
if (typeof window.showScreen === 'function') window.showScreen('plugin-capability_inspector');
|
|
});
|
|
}
|
|
render();
|
|
})();
|
|
</script>
|
|
</div> |