Archived
1
0
This commit is contained in:
Jeff Becker 2017-01-16 11:47:53 -05:00
parent ad3089728a
commit a97c3d7d48

View File

@ -26,23 +26,16 @@ function table_insert_row(table, header, items) {
/** /**
build dynamic reply box build dynamic reply box
*/ */
function DynReply() { function DynReply(rootElem) {
var elem = document.createElement("div"); var elem = document.createElement("div");
elem.setAttribute("id", "postform_container");
this.elem = elem; this.elem = elem;
// build post form
this.form = document.createElement("form");
this.form.enctype = "multipart/form-data";
this.form.name = "post";
this.form.method = "post";
// reference // reference
elem = document.createElement("input"); elem = document.createElement("input");
elem.setAttribute("id", "postform_reference");
elem.name = "reference"; elem.name = "reference";
elem.type = "hidden"; elem.type = "hidden";
this.form.appendChild(elem); this.elem.appendChild(elem);
var table = document.createElement("table"); var table = document.createElement("table");
table.setAttribute("class", "postform"); table.setAttribute("class", "postform");
@ -87,7 +80,6 @@ function DynReply() {
// file // file
elem = document.createElement("input"); elem = document.createElement("input");
elem.setAttribute("class", "postform_attachment"); elem.setAttribute("class", "postform_attachment");
elem.setAttribute("id", "postform_attachments");
elem.setAttribute("type", "file"); elem.setAttribute("type", "file");
elem.setAttribute("name", "attachment_uploaded"); elem.setAttribute("name", "attachment_uploaded");
elem.setAttribute("multiple", "multiple"); elem.setAttribute("multiple", "multiple");
@ -101,7 +93,6 @@ function DynReply() {
// captcha // captcha
elem = document.createElement("img"); elem = document.createElement("img");
elem.setAttribute("id", "captcha_img");
elem.alt = "captcha"; elem.alt = "captcha";
table_insert_row(tbody, document.createTextNode("Captcha"), [elem]); table_insert_row(tbody, document.createTextNode("Captcha"), [elem]);
@ -109,36 +100,17 @@ function DynReply() {
elem = document.createElement("input"); elem = document.createElement("input");
elem.name = "captcha"; elem.name = "captcha";
elem.autocomplete = "off"; elem.autocomplete = "off";
elem.setAttribute("id", "captcha_solution");
table_insert_row(tbody, document.createTextNode("Solution"), [elem]); table_insert_row(tbody, document.createTextNode("Solution"), [elem]);
table.appendChild(tbody); table.appendChild(tbody);
this.form.appendChild(table); this.elem.appendChild(table);
this.elem.appendChild(this.form);
document.body.appendChild(this.elem);
this.board = null; this.board = null;
this.rootmsg = null; this.rootmsg = null;
this.prefix = null; this.prefix = null;
this.url = null; this.url = null;
this.x = 1; this.x = 1;
this.y = 1; this.y = 1;
} rootElem.appendChild(this.elem);
DynReply.prototype.update = function() {
if (this.prefix) {
// update captcha
this.updateCaptcha();
if (this.board) {
// update post form
var ref = document.getElementById("postform_reference");
if (this.rootmsg) {
ref.setAttribute("value", this.rootmsg);
} else {
ref.setAttribute("value", "");
}
this.url = this.prefix + "post/" + this.board + "/json";
}
}
} }
DynReply.prototype.show = function() { DynReply.prototype.show = function() {