/** Datei: themes/lcars/assets.OLD/js/arunox/hooks/button.js **/ /** * /lcars/hooks/button.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Hooks.register( 'button->config', function( config ) { return Object.assignRecursive( config, { block : 'frame', color : Object.assign( { color : 'primary', prefix : 'theme', }, config.color ), classes : [ config.classes, [ 'frame__element', 'frame__element--button', ]].flat().filter(Boolean), }); }, 5 ); if( 'vibrate' in navigator ) { ARUNOX.Hooks.register( 'button->afterRender', function() { this.instance.element.addEventListener( 'touchstart', event => { navigator.vibrate(50); }); }); } /** Datei: themes/lcars/assets.OLD/js/arunox/hooks/menus.js **/ /** * /lcars/hooks/_general.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Hooks.register( 'addMenus', async function( anchor ) { const wrapper = this.instance.replace( 'div' ); const routes = ( await ARUNOX.Router.routes() ).map( item => { if( !Array.isArray( item.menu ) ) { item.menu = [ item.menu ]; } return item; }); const filtered = routes.filter( item => item.menu.includes( anchor ) ); for( const route of filtered ) { if( route.path ) { wrapper.apply( 'addMenus->item', route ); continue; } wrapper.apply( 'addMenus->category', route, routes ); } }); ARUNOX.Hooks.register( 'addMenus->category', async function( route, routes ) { const filtered = routes.filter( item => item.menu.includes( route.name ) ); const wrapper = this.instance.render( 'div', { classes : [ 'frame__wrapper' ], content : ARUNOX.Templates.config( 'div', { classes : [ 'frame__element', 'frame__element--label' ], content : ARUNOX.Templates.config( 'span', { classes : [ 'label' ], content : route.label, }), }), }); for( const route of filtered ) { wrapper.apply( 'addMenus->item', route ); } }); ARUNOX.Hooks.register( 'addMenus->item', async function( route ) { this.instance.render( 'button', { label : route.label, icon : route.icon, action : route.path, }); }); /** Datei: themes/lcars/assets.OLD/js/arunox/hooks/form.js **/ /** * rest/arunox/hooks/form.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Hooks.register( 'form->afterRender', function() { const section = this.instance.closest( 'layout/section' ); const buttons = this.instance.nodes.buttons; if( section ) { section.nodes.footer.nodes.after.replace( buttons ); } }); /** Datei: themes/lcars/assets.OLD/js/arunox/hooks/notifications.js **/ /** * /lcars/hooks/notifications.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Hooks.register( 'notifications->afterRender', function() { const section = this.instance.closest( 'layout/section' ); if( section ) { section.nodes.header.nodes.before.render(); section.nodes.header.nodes.before.replace( this.instance ); this.instance.addNotification({ duration : 0, icon : 'bi-bell', title : 'Benachrichtigungen', message : 'Keine Benachrichtigungen', style : { order : -1, }, }); } }); ARUNOX.Hooks.register( 'notification->afterRender', function() { const config = this.instance.config; if( config.duration === 0 ) return; config.delay ??= 2000; config.animate ??= config.delay <= 500 ? 100 : 500; if( typeof ARUNOX.Tools.Beep === 'function' ) { if( config.type == 'danger' ) ARUNOX.Tools.Beep.alert(); else if( config.type == 'success' ) ARUNOX.Tools.Beep.short(); else if( config.type == 'warning' ) ARUNOX.Tools.Beep.long(); } window.setTimeout( () => { this.instance.parent.root.classList.add( 'hover' ); window.setTimeout( () => { this.instance.parent.root.classList.remove('hover'); // if( config.redirect !== false && config.redirect.url !== false ) { // if( config.redirect === true ) location.reload(); // else location.href = config.redirect.url; // } window.setTimeout( () => { this.instance.root.classList.add( 'fade-out' ); window.setTimeout( () => { this.instance.root.remove(); }, 250 ); }, config.message ? 2000 : 0 ); }, config.delay || 2000 ); }, config.animate || 500 ); });