-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade example project dependencies (#468)
- Loading branch information
1 parent
7cb088a
commit 75e2493
Showing
5 changed files
with
5,124 additions
and
3,334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
htmx.defineExtension('debug', { | ||
onEvent: function (name, evt) { | ||
if (console.debug) { | ||
console.debug(name, evt); | ||
} else if (console) { | ||
console.log("DEBUG:", name, evt); | ||
} else { | ||
throw "NO CONSOLE SUPPORTED" | ||
} | ||
onEvent: function(name, evt) { | ||
if (console.debug) { | ||
console.debug(name, evt) | ||
} else if (console) { | ||
console.log('DEBUG:', name, evt) | ||
} else { | ||
throw new Error('NO CONSOLE SUPPORTED') | ||
} | ||
}); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
(function(){ | ||
function stringifyEvent(event) { | ||
var obj = {}; | ||
for (var key in event) { | ||
obj[key] = event[key]; | ||
} | ||
return JSON.stringify(obj, function(key, value){ | ||
if(value instanceof Node){ | ||
var nodeRep = value.tagName; | ||
if (nodeRep) { | ||
nodeRep = nodeRep.toLowerCase(); | ||
if(value.id){ | ||
nodeRep += "#" + value.id; | ||
} | ||
if(value.classList && value.classList.length){ | ||
nodeRep += "." + value.classList.toString().replace(" ", ".") | ||
} | ||
return nodeRep; | ||
} else { | ||
return "Node" | ||
} | ||
} | ||
if (value instanceof Window) return 'Window'; | ||
return value; | ||
}); | ||
(function() { | ||
function stringifyEvent(event) { | ||
var obj = {} | ||
for (var key in event) { | ||
obj[key] = event[key] | ||
} | ||
return JSON.stringify(obj, function(key, value) { | ||
if (value instanceof Node) { | ||
var nodeRep = value.tagName | ||
if (nodeRep) { | ||
nodeRep = nodeRep.toLowerCase() | ||
if (value.id) { | ||
nodeRep += '#' + value.id | ||
} | ||
if (value.classList && value.classList.length) { | ||
nodeRep += '.' + value.classList.toString().replace(' ', '.') | ||
} | ||
return nodeRep | ||
} else { | ||
return 'Node' | ||
} | ||
} | ||
if (value instanceof Window) return 'Window' | ||
return value | ||
}) | ||
} | ||
|
||
htmx.defineExtension('event-header', { | ||
onEvent: function (name, evt) { | ||
if (name === "htmx:configRequest") { | ||
if (evt.detail.triggeringEvent) { | ||
evt.detail.headers['Triggering-Event'] = stringifyEvent(evt.detail.triggeringEvent); | ||
} | ||
} | ||
htmx.defineExtension('event-header', { | ||
onEvent: function(name, evt) { | ||
if (name === 'htmx:configRequest') { | ||
if (evt.detail.triggeringEvent) { | ||
evt.detail.headers['Triggering-Event'] = stringifyEvent(evt.detail.triggeringEvent) | ||
} | ||
}); | ||
})(); | ||
} | ||
} | ||
}) | ||
})() |
Oops, something went wrong.