show "posting..." message right before posting
This commit is contained in:
parent
187eef590d
commit
ba045b6903
@ -245,6 +245,7 @@ DynReply.prototype.showError = function(msg) {
|
|||||||
|
|
||||||
DynReply.prototype.showMessage = function(msg) {
|
DynReply.prototype.showMessage = function(msg) {
|
||||||
this._error.setAttribute("class", "message");
|
this._error.setAttribute("class", "message");
|
||||||
|
this._error.innerHTML = "";
|
||||||
this._error.appendChild(document.createTextNode(msg));
|
this._error.appendChild(document.createTextNode(msg));
|
||||||
var e = this._error;
|
var e = this._error;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -377,6 +378,7 @@ function init(prefix) {
|
|||||||
var f = document.querySelector("form");
|
var f = document.querySelector("form");
|
||||||
// do ajax request to post data
|
// do ajax request to post data
|
||||||
var r = getReplyTo();
|
var r = getReplyTo();
|
||||||
|
r.showMessage("posting... ");
|
||||||
r.post(function(j) {
|
r.post(function(j) {
|
||||||
if(j.error) {
|
if(j.error) {
|
||||||
// an error happened
|
// an error happened
|
||||||
@ -391,7 +393,6 @@ function init(prefix) {
|
|||||||
r.showError(err);
|
r.showError(err);
|
||||||
r.clearSolution();
|
r.clearSolution();
|
||||||
});
|
});
|
||||||
r.showMessage("posting... ");
|
|
||||||
}
|
}
|
||||||
e.onclick = postit;
|
e.onclick = postit;
|
||||||
var f = document.querySelector("form");
|
var f = document.querySelector("form");
|
||||||
|
@ -35,7 +35,7 @@ DynReply.prototype.hide=function(){this.elem.style.display='none';}
|
|||||||
DynReply.prototype.setBoard=function(boardname){if(boardname){this.board=boardname;}}
|
DynReply.prototype.setBoard=function(boardname){if(boardname){this.board=boardname;}}
|
||||||
DynReply.prototype.setRoot=function(roothash){if(roothash){this.roothash=roothash;}}
|
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));this.updateCaptcha();}
|
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);}
|
DynReply.prototype.showMessage=function(msg){this._error.setAttribute("class","message");this._error.innerHTML="";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();}
|
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)
|
var elem=document.getElementById("postform_message");if(elem)
|
||||||
{elem.value+=">>"+shorthash.substr(0,10)+"\n";}}
|
{elem.value+=">>"+shorthash.substr(0,10)+"\n";}}
|
||||||
@ -47,7 +47,7 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do
|
|||||||
parent.backlink=true;}};parent.backlink=true;}
|
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<l;idx++){var e=elems[idx];ls.push(e);}
|
function inject_hover_for_element(elem){var elems=elem.getElementsByClassName("backlink");var ls=[];var l=elems.length;for(var idx=0;idx<l;idx++){var e=elems[idx];ls.push(e);}
|
||||||
for(var elem in ls){inject_hover(prefix,ls[elem]);}}
|
for(var elem in ls){inject_hover(prefix,ls[elem]);}}
|
||||||
function init(prefix){inject_hover_for_element(document);var rpl=getReplyTo();rpl.setPrefix(prefix);var e=rpl.elem;e.setAttribute("draggable","true");var mouseDownX,mouseDownY;var originalX=window.screenX-150;var originalY=10;rpl.moveTo(originalX,originalY);e.addEventListener("dragstart",function(ev){mouseDownX=ev.clientX;mouseDownY=ev.clientY;if(!ev.ctrlKey){ev.preventDefault();}},false);e.addEventListener("dragend",function(ev){var x=originalX+ev.clientX-mouseDownX;var y=originalY+ev.clientY-mouseDownY;x-=window.screenLeft;y-=window.screenTop;rpl.moveTo(x,y);originalX=x;originalY=y;},false);e=document.getElementById("postform_submit");var postit=function(){var f=document.querySelector("form");var r=getReplyTo();r.post(function(j){if(j.error){r.showError(j.error);}else{r.showMessage("posted as "+j.message_id);r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});r.showMessage("posting... ");}
|
function init(prefix){inject_hover_for_element(document);var rpl=getReplyTo();rpl.setPrefix(prefix);var e=rpl.elem;e.setAttribute("draggable","true");var mouseDownX,mouseDownY;var originalX=window.screenX-150;var originalY=10;rpl.moveTo(originalX,originalY);e.addEventListener("dragstart",function(ev){mouseDownX=ev.clientX;mouseDownY=ev.clientY;if(!ev.ctrlKey){ev.preventDefault();}},false);e.addEventListener("dragend",function(ev){var x=originalX+ev.clientX-mouseDownX;var y=originalY+ev.clientY-mouseDownY;x-=window.screenLeft;y-=window.screenTop;rpl.moveTo(x,y);originalX=x;originalY=y;},false);e=document.getElementById("postform_submit");var postit=function(){var f=document.querySelector("form");var r=getReplyTo();r.showMessage("posting... ");r.post(function(j){if(j.error){r.showError(j.error);}else{r.showMessage("posted as "+j.message_id);r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});}
|
||||||
e.onclick=postit;var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}}
|
e.onclick=postit;var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}}
|
||||||
/* ./contrib/js/banner.js */
|
/* ./contrib/js/banner.js */
|
||||||
var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);}
|
var banner_count=3;function nntpchan_inject_banners(elem,prefix){var n=Math.floor(Math.random()*banner_count);var banner=prefix+"static/banner_"+n+".jpg";var e=document.createElement("img");e.src=banner;e.id="nntpchan_banner";elem.appendChild(e);}
|
||||||
|
Reference in New Issue
Block a user