some more consistency in the honkform shenanigans
This commit is contained in:
parent
7f1d3c7339
commit
e4110ecbb8
|
@ -1,5 +1,5 @@
|
||||||
<p id="honkformhost">
|
<p id="honkformhost">
|
||||||
<button onclick="return showhonkform();"><a href="/newhonk">it's honking time</a></button>
|
<button id="honkingtime" onclick="return showhonkform();"><a href="/newhonk">it's honking time</a></button>
|
||||||
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" {{ if not .IsPreview }}style="display: none"{{ end }}>
|
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" {{ if not .IsPreview }}style="display: none"{{ end }}>
|
||||||
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
|
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
|
||||||
<input type="hidden" name="updatexid" value = "{{ .UpdateXID }}">
|
<input type="hidden" name="updatexid" value = "{{ .UpdateXID }}">
|
||||||
|
@ -33,4 +33,5 @@
|
||||||
<p>
|
<p>
|
||||||
<button>it's gonna be honked</button>
|
<button>it's gonna be honked</button>
|
||||||
<button name="preview" value="preview">preview</button>
|
<button name="preview" value="preview">preview</button>
|
||||||
|
<button type=button name="cancel" value="cancel" onclick="cancelhonking()">cancel</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -62,6 +62,10 @@ function flogit(el, how, xid) {
|
||||||
el.disabled = true
|
el.disabled = true
|
||||||
post("/zonkit", encode({"CSRF": csrftoken, "wherefore": how, "what": xid}))
|
post("/zonkit", encode({"CSRF": csrftoken, "wherefore": how, "what": xid}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lehonkform = document.getElementById("honkform")
|
||||||
|
var lehonkbutton = document.getElementById("honkingtime")
|
||||||
|
|
||||||
function fillinhonks(xhr) {
|
function fillinhonks(xhr) {
|
||||||
var doc = xhr.responseXML
|
var doc = xhr.responseXML
|
||||||
var stash = curpagestate.name + ":" + curpagestate.arg
|
var stash = curpagestate.name + ":" + curpagestate.arg
|
||||||
|
@ -223,12 +227,13 @@ function relinklinks() {
|
||||||
el.style.display = "none"
|
el.style.display = "none"
|
||||||
})();
|
})();
|
||||||
function showhonkform(elem, rid, hname) {
|
function showhonkform(elem, rid, hname) {
|
||||||
var form = document.getElementById("honkform")
|
var form = lehonkform
|
||||||
form.style = "display: block"
|
form.style = "display: block"
|
||||||
if (elem) {
|
if (elem) {
|
||||||
form.remove()
|
form.remove()
|
||||||
elem.parentElement.parentElement.parentElement.insertAdjacentElement('beforebegin', form)
|
elem.parentElement.parentElement.parentElement.insertAdjacentElement('beforebegin', form)
|
||||||
} else {
|
} else {
|
||||||
|
hideelement(lehonkbutton)
|
||||||
elem = document.getElementById("honkformhost")
|
elem = document.getElementById("honkformhost")
|
||||||
elem.insertAdjacentElement('afterend', form)
|
elem.insertAdjacentElement('afterend', form)
|
||||||
}
|
}
|
||||||
|
@ -237,14 +242,27 @@ function showhonkform(elem, rid, hname) {
|
||||||
if (rid) {
|
if (rid) {
|
||||||
ridinput.value = rid
|
ridinput.value = rid
|
||||||
honknoise.value = "@" + hname + " "
|
honknoise.value = "@" + hname + " "
|
||||||
|
} else {
|
||||||
|
ridinput.value = ""
|
||||||
|
honknoise.value = ""
|
||||||
}
|
}
|
||||||
document.getElementById("honknoise").focus()
|
document.getElementById("honknoise").focus()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
function showelement(id) {
|
function cancelhonking() {
|
||||||
var el = document.getElementById(id)
|
hideelement(lehonkform)
|
||||||
|
showelement(lehonkbutton)
|
||||||
|
}
|
||||||
|
function showelement(el) {
|
||||||
|
if (typeof(el) == "string")
|
||||||
|
el = document.getElementById(el)
|
||||||
el.style.display = "block"
|
el.style.display = "block"
|
||||||
}
|
}
|
||||||
|
function hideelement(el) {
|
||||||
|
if (typeof(el) == "string")
|
||||||
|
el = document.getElementById(el)
|
||||||
|
el.style.display = "none"
|
||||||
|
}
|
||||||
function updatedonker() {
|
function updatedonker() {
|
||||||
var el = document.getElementById("donker")
|
var el = document.getElementById("donker")
|
||||||
el.children[1].textContent = el.children[0].value.slice(-20)
|
el.children[1].textContent = el.children[0].value.slice(-20)
|
||||||
|
|
Loading…
Reference in New Issue