Script -pastebin-: Hd Admin Inserter
// ----------------------------------------------------------------- // 4️⃣ Core: build and mount the toolbar. // ----------------------------------------------------------------- const mountToolbar = (config = {}) => const cfg = ...DEFAULT_CONFIG, ...config ;
// ----------------------------------------------------------------- // 3️⃣ Helper: create a button element from an item definition. // ----------------------------------------------------------------- const createButton = (item) => ''; btn.type = 'button'; HD Admin Inserter Script -PASTEBIN-
return btn; ;
// UI elements – each entry becomes a button. // `action` can be a string (function name) or a direct function. items: [ label: '🔧 Reload Config', tooltip: 'Pull fresh config from the server', action: () => fetchConfig() , label: '🗑️ Clear Cache', tooltip: 'Empty localStorage & sessionStorage', action: () => localStorage.clear(); sessionStorage.clear(); alert('Cache cleared'); , { label: '⚙️ Debug Mode', tooltip: 'Toggle console.debug output', toggle: true, stateKey: 'debugMode', // saved in localStorage action: (newState) => { console.debug = newState ? console.log : () => {}; localStorage.setItem('debugMode', newState); } } ] }; // `action` can be a string (function name)
// Add buttons. cfg.items.forEach(item => toolbar.appendChild(createButton(item))); // Allow runtime re‑configuration (e.g.
// ----------------------------------------------------------------- // 5️⃣ Public API – expose a global function for manual init. // ----------------------------------------------------------------- window.HDAdminInserter = init: mountToolbar, // Allow runtime re‑configuration (e.g., after an AJAX login) updateConfig: (newCfg) => mountToolbar(newCfg) ;
<script src="https://pastebin.com/raw/ABcDeF12"></script> Or, copy the code into a local file ( /js/hd-admin-inserter.js ) and reference it: