aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknotteye <knotteye@airmail.cc>2021-07-02 10:24:38 -0500
committerknotteye <knotteye@airmail.cc>2021-07-02 10:24:38 -0500
commit44f5dd0279b18989dda5123f582e01af6cedb810 (patch)
tree1198680b0074729b049354a37291ff384770f6fb
parent97ce6d91545ec10f35d692ccbf60536d83f5debf (diff)
Alert user to bad captcha instead of changing the page
-rw-r--r--static/main.html33
1 files changed, 32 insertions, 1 deletions
diff --git a/static/main.html b/static/main.html
index 72ed321..af9947f 100644
--- a/static/main.html
+++ b/static/main.html
@@ -7,7 +7,38 @@
<meta name="keywords" content="Federated Imageboard based on Activtypub">
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
- <link rel="icon" type="image/png" href="/static/favicon.png">
+ <link rel="icon" type="image/png" href="/static/favicon.png">
+ <script>
+ window.addEventListener('DOMContentLoaded', function(){
+ var np = document.getElementById("new-post")
+ if(np){
+ np.setAttribute("onsubmit", "validatePost(this);return false;")
+ }
+ var np = document.getElementById("reply-post")
+ if(np){
+ np.setAttribute("onsubmit", "validatePost(this);return false;")
+ }
+ var np = document.getElementById("report-post")
+ if(np){
+ np.setAttribute("onsubmit", "validatePost(this);return false;")
+ }
+ })
+ function validatePost(form)
+ {
+ var data = new FormData(form)
+ fetch(form.action, {
+ method: "POST",
+ body: data
+ }).then((r) => {
+ if(r.redirected){
+ document.location = r.url
+ } else {
+ r.text().then((t) => {alert(t)})
+ }
+ })
+ return false
+ }
+ </script>
<style>
a, a:link, a:visited, a:hover, a:active {
text-decoration: none