more
This commit is contained in:
parent
ad3089728a
commit
a97c3d7d48
@ -26,23 +26,16 @@ function table_insert_row(table, header, items) {
|
||||
|
||||
/**
|
||||
build dynamic reply box
|
||||
*/
|
||||
function DynReply() {
|
||||
*/
|
||||
function DynReply(rootElem) {
|
||||
|
||||
var elem = document.createElement("div");
|
||||
elem.setAttribute("id", "postform_container");
|
||||
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
|
||||
elem = document.createElement("input");
|
||||
elem.setAttribute("id", "postform_reference");
|
||||
elem.name = "reference";
|
||||
elem.type = "hidden";
|
||||
this.form.appendChild(elem);
|
||||
this.elem.appendChild(elem);
|
||||
|
||||
var table = document.createElement("table");
|
||||
table.setAttribute("class", "postform");
|
||||
@ -87,7 +80,6 @@ function DynReply() {
|
||||
// file
|
||||
elem = document.createElement("input");
|
||||
elem.setAttribute("class", "postform_attachment");
|
||||
elem.setAttribute("id", "postform_attachments");
|
||||
elem.setAttribute("type", "file");
|
||||
elem.setAttribute("name", "attachment_uploaded");
|
||||
elem.setAttribute("multiple", "multiple");
|
||||
@ -101,7 +93,6 @@ function DynReply() {
|
||||
|
||||
// captcha
|
||||
elem = document.createElement("img");
|
||||
elem.setAttribute("id", "captcha_img");
|
||||
elem.alt = "captcha";
|
||||
table_insert_row(tbody, document.createTextNode("Captcha"), [elem]);
|
||||
|
||||
@ -109,36 +100,17 @@ function DynReply() {
|
||||
elem = document.createElement("input");
|
||||
elem.name = "captcha";
|
||||
elem.autocomplete = "off";
|
||||
elem.setAttribute("id", "captcha_solution");
|
||||
table_insert_row(tbody, document.createTextNode("Solution"), [elem]);
|
||||
|
||||
table.appendChild(tbody);
|
||||
this.form.appendChild(table);
|
||||
this.elem.appendChild(this.form);
|
||||
document.body.appendChild(this.elem);
|
||||
this.elem.appendChild(table);
|
||||
this.board = null;
|
||||
this.rootmsg = null;
|
||||
this.prefix = null;
|
||||
this.url = null;
|
||||
this.x = 1;
|
||||
this.y = 1;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
rootElem.appendChild(this.elem);
|
||||
}
|
||||
|
||||
DynReply.prototype.show = function() {
|
||||
|
Reference in New Issue
Block a user