[file]
and add script
tested with chrome,FF,Edge
Update: more elegant
[file]
and add script at the end
or use a single event handler
Update2: if {.get|can delete.} slowes down, you can try
[file]
and add to function del
Code: [Select]
{.if|{.get|can delete.}|<span onclick='del("%item-url%")'>x</span>.}
and add script
Code: [Select]
<script>
function del(it) {
if(!confirm("Delete "+it+"?")) return 0;
var xhr = new XMLHttpRequest();
xhr.open("POST", "%folder%")
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
xhr.onload = function() {document.write(xhr.responseText);}
xhr.send("action=delete&selection="+it)
}
</script>
tested with chrome,FF,Edge
Update: more elegant
[file]
Code: [Select]
{.if|{.get|can delete.}|<span class='del' data-it='%item-url%'>x</span>.}
and add script at the end
Code: [Select]
<script>
document.querySelectorAll('.del').forEach(function(userItem) {
userItem.addEventListener('click',function(){del(this.getAttribute("data-it"))})
})
</script>
or use a single event handler
Update2: if {.get|can delete.} slowes down, you can try
[file]
Code: [Select]
<span class='del' data-it='%item-url%'>x</span>
and add to function del
Code: [Select]
if (!'{.get|can delete.}') return 0