File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,16 @@ function showMessage(message, type = 'info') {
313313 } , 5000 ) ;
314314}
315315
316+ // Generate random alias
317+ function generateRandomAlias ( length = 20 ) {
318+ const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ;
319+ let result = '' ;
320+ for ( let i = 0 ; i < length ; i ++ ) {
321+ result += chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) ) ;
322+ }
323+ return result ;
324+ }
325+
316326// Initialize when DOM is ready
317327document . addEventListener ( 'DOMContentLoaded' , function ( ) {
318328 console . log ( 'Dashboard JS loaded' ) ;
@@ -340,6 +350,15 @@ document.addEventListener('DOMContentLoaded', function() {
340350 } else {
341351 console . error ( 'Create forwarder form not found' ) ;
342352 }
353+
354+ // Dice button for random alias
355+ const randomBtn = document . getElementById ( 'randomAliasBtn' ) ;
356+ const aliasInput = document . getElementById ( 'alias' ) ;
357+ if ( randomBtn && aliasInput ) {
358+ randomBtn . addEventListener ( 'click' , function ( ) {
359+ aliasInput . value = generateRandomAlias ( ) ;
360+ } ) ;
361+ }
343362} ) ;
344363
345364// Utility function to escape HTML (prevent XSS)
You can’t perform that action at this time.
0 commit comments