From 68a83205abb4085226aa51fc3a38bb099c7d95ec Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 30 Apr 2016 16:20:27 -0400 Subject: [PATCH] add captcha updating --- contrib/js/backlink.js | 2 ++ contrib/static/nntpchan.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/js/backlink.js b/contrib/js/backlink.js index f32afef..dfcf0cf 100644 --- a/contrib/js/backlink.js +++ b/contrib/js/backlink.js @@ -216,6 +216,7 @@ DynReply.prototype.showError = function(msg) { console.log("error in dynreply: "+msg); this._error.setAttribute("class", "error"); this._error.appendChild(document.createTextNode(msg)); + this.updateCaptcha(); } DynReply.prototype.showMessage = function(msg) { @@ -356,6 +357,7 @@ function init(prefix) { } else { // we're good r.showMessage("posted as "+j.message_id); + r.updateCaptcha(); } }, function(err) { r.showError(err); diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index 2e1a35b..1d8a4e0 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -30,7 +30,7 @@ DynReply.prototype.setPrefix=function(prefix){this.prefix=prefix;} DynReply.prototype.hide=function(){this.elem.style.display='none';} DynReply.prototype.setBoard=function(boardname){if(boardname){this.board=boardname;}} DynReply.prototype.setRoot=function(roothash){if(roothash){this.roothash=roothash;}} -DynReply.prototype.showError=function(msg){console.log("error in dynreply: "+msg);this._error.setAttribute("class","error");this._error.appendChild(document.createTextNode(msg));} +DynReply.prototype.showError=function(msg){console.log("error in dynreply: "+msg);this._error.setAttribute("class","error");this._error.appendChild(document.createTextNode(msg));this.updateCaptcha();} DynReply.prototype.showMessage=function(msg){this._error.setAttribute("class","message");this._error.appendChild(document.createTextNode(msg));var e=this._error;setTimeout(function(){e.innerHTML="";},2000);} function nntpchan_reply(parent,shorthash){if(parent){var boardname=parent.getAttribute("boardname");var roothash=parent.getAttribute("root");var replyto=getReplyTo();replyto.setBoard(boardname);replyto.setRoot(roothash);replyto.show();} var elem=document.getElementById("postform_message");if(elem) @@ -43,7 +43,7 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do parent.backlink=true;}};parent.backlink=true;} function inject_hover_for_element(elem){var elems=elem.getElementsByClassName("backlink");var ls=[];var l=elems.length;for(var idx=0;idx