From 2a08f73db40d84f3ad099ba9da25d73d665369d0 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 3 May 2016 12:17:08 -0400 Subject: [PATCH] use alternative layout in postform for postform_msg --- contrib/js/reply.js | 6 +- contrib/static/nntpchan.js | 78 ++++++++++----------- contrib/static/site.css | 1 - contrib/templates/default/postform.mustache | 8 +-- 4 files changed, 48 insertions(+), 45 deletions(-) diff --git a/contrib/js/reply.js b/contrib/js/reply.js index e72c7df..cb8b27c 100644 --- a/contrib/js/reply.js +++ b/contrib/js/reply.js @@ -64,15 +64,19 @@ function DynReply(existingElem) { table.setAttribute("class", "postform"); var tbody = document.createElement("tbody"); + var span = document.createElement("span"); // name elem = document.createElement("input"); elem.setAttribute("name", "name"); elem.setAttribute("value", "Anonymous"); elem.setAttribute("id", "postform_name"); + span.appendChild(elem); + // error message var err_elem = document.createElement("span"); err_elem.setAttribute("id", "postform_msg"); + span.appendChild(err_elem); this._error = err_elem; - table_insert_row(tbody, document.createTextNode("Name"), [elem, err_elem]) + table_insert_row(tbody, document.createTextNode("Name"), [span]) // subject elem = document.createElement("input"); diff --git a/contrib/static/nntpchan.js b/contrib/static/nntpchan.js index 1bba52f..c2bd69d 100644 --- a/contrib/static/nntpchan.js +++ b/contrib/static/nntpchan.js @@ -10,45 +10,6 @@ return;} handler(j);}};ajax.open("GET",url);ajax.send();} function nntpchan_buildpost(parent,j){var post=document.createElement("div");if(j){post.innerHTML=j.PostMarkup;inject_hover_for_element(post);}else{post.setAttribute("class","notfound post");post.appendChild(document.createTextNode("post not found"));} parent.appendChild(post);} -/* ./contrib/js/backlink.js */ -var dynreply;function getReplyTo(){if(!dynreply){var e=document.getElementById("postform_container");if(e){dynreply=new DynReply(e);}else{dynreply=new DynReply();}} -return dynreply;} -function table_insert_row(table,header,items){var tr=document.createElement("tr");var th=document.createElement("th");th.appendChild(header);tr.appendChild(th);for(var idx=0;idx>"+linkhash.substr(0,10)));if(!parent){parent=el.parentNode;} -parent.removeChild(el);parent.appendChild(elem);elem.onclick=function(ev){if(parent.backlink){nntpchan_apicall(prefix+"api/find?hash="+linkhash,function(j){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);if(j==null){wrapper.setAttribute("class","hover notfound-hover "+linkhash);wrapper.appendChild(document.createTextNode("not found"));}else{nntpchan_buildpost(wrapper,j);} -parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);wrapper.appendChild(document.createTextNode(msg));parent.appendChild(wrapper);parent.backlink=false;});}else{var elems=document.getElementsByClassName(linkhash);if(!elems)throw"bad state, no backlinks open?";for(var idx=0;idx>"+linkhash.substr(0,10)));if(!parent){parent=el.parentNode;} +parent.removeChild(el);parent.appendChild(elem);elem.onclick=function(ev){if(parent.backlink){nntpchan_apicall(prefix+"api/find?hash="+linkhash,function(j){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);if(j==null){wrapper.setAttribute("class","hover notfound-hover "+linkhash);wrapper.appendChild(document.createTextNode("not found"));}else{nntpchan_buildpost(wrapper,j);} +parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=document.createElement("div");wrapper.setAttribute("class","hover "+linkhash);wrapper.appendChild(document.createTextNode(msg));parent.appendChild(wrapper);parent.backlink=false;});}else{var elems=document.getElementsByClassName(linkhash);if(!elems)throw"bad state, no backlinks open?";for(var idx=0;idx - - - - + + + +