mirror of
				https://github.com/Theodor-Springmann-Stiftung/musenalm.git
				synced 2025-10-31 18:25:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			713 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			713 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| (function() {
 | |
|   function mergeObjects(obj1, obj2) {
 | |
|     for (var key in obj2) {
 | |
|       if (obj2.hasOwnProperty(key)) {
 | |
|         obj1[key] = obj2[key]
 | |
|       }
 | |
|     }
 | |
|     return obj1
 | |
|   }
 | |
| 
 | |
|   htmx.defineExtension('include-vals', {
 | |
|     onEvent: function(name, evt) {
 | |
|       if (name === 'htmx:configRequest') {
 | |
|         var includeValsElt = htmx.closest(evt.detail.elt, '[include-vals],[data-include-vals]')
 | |
|         if (includeValsElt) {
 | |
|           var includeVals = includeValsElt.getAttribute('include-vals') || includeValsElt.getAttribute('data-include-vals')
 | |
|           var valuesToInclude = eval('({' + includeVals + '})')
 | |
|           mergeObjects(evt.detail.parameters, valuesToInclude)
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|   })
 | |
| })()
 | 
