Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/templates/layouts/index_admin.jet.html
kilo cc4e0fe5c0
Fix JS for torrent/user deletion that would delete even if you refused to confirm (#1711)
* Update torrentlist.jet.html

* Update index_admin.jet.html
2017-11-04 07:23:10 +01:00

53 lignes
1,6 Kio
HTML

{* We extend the base template *}
{{ extends "partials/base" }}
{{import "partials/helpers/search"}}
{* We apply the menu in the base template *}
{{ block menu()}}
{{include "partials/menu/site"}}
{{end}}
{* We used to add the class content for admin *}
{{ block contclass()}}admin-content{{end}}
{* We add the mod panel title and the title block *}
{{block titleBase()}} Moderation Panel - {{block title()}}{{end}}
{{end}}
{* We add the mod nav and the body block *}
{{ block content_body_base()}}
{{include "partials/menu/admin"}}
{{ block content_body()}}
{{end}}
{{end}}
{{block footer_js()}}
<script type="text/javascript">
var deleteButtons = document.querySelectorAll("button.form-input.btn-red")
for(var i = 0; i < deleteButtons.length; i++) {
var needConfirmation = (deleteButtons[i].onclick != null)
deleteButtons[i].onclick = null
deleteButtons[i].addEventListener("click", function (e) {
e.preventDefault()
if(needConfirmation && !confirm("Are you sure?")) {
return
} else if(!needConfirmation) {
var form = this.parentNode
var formInputs = form.querySelectorAll('input')
var query = ""
for(var x = 0; x < formInputs.length; x ++) {
if(query != "") query = query + "&"
query = query + formInputs[x].name + "=" + formInputs[x].value
}
Query.Post(form.action, query, function(data) {})
this.parentNode.parentNode.parentNode.className = this.parentNode.parentNode.className + " hidden"
this.innerText = "Deleted"
this.disabled = true
}
})
}
</script>
{{end}}