Archived
1
0

dyn reply fixes

This commit is contained in:
Jeff Becker 2017-01-16 11:27:58 -05:00
parent 75dc4c2529
commit eabe6474de

View File

@ -137,7 +137,7 @@ function DynReply(existingElem) {
this.elem.appendChild(this.form); this.elem.appendChild(this.form);
document.body.appendChild(this.elem); document.body.appendChild(this.elem);
this.board = null; this.board = null;
this.roothash = null; this.rootmsg = null;
this.prefix = null; this.prefix = null;
this.url = null; this.url = null;
this.x = 1; this.x = 1;
@ -152,13 +152,12 @@ DynReply.prototype.update = function() {
if (this.board) { if (this.board) {
// update post form // update post form
var ref = document.getElementById("postform_reference"); var ref = document.getElementById("postform_reference");
if (this.rootmsg) {
if (this.roothash) { ref.setAttribute("value", this.rootmsg);
ref.setAttribute("value", this.roothash);
} else { } else {
ref.setAttribute("value", ""); ref.setAttribute("value", "");
} }
this.url = this.prefix + "post/" + this.board + "?t=json"; this.url = this.prefix + "post/" + this.board + "/json";
} }
} }
} }
@ -243,9 +242,9 @@ DynReply.prototype.setBoard = function(boardname) {
} }
} }
DynReply.prototype.setRoot = function(roothash) { DynReply.prototype.setRoot = function(rootmsg) {
if (roothash) { if (rootmsg) {
this.roothash = roothash; this.rootmsg = rootmsg;
} }
} }
@ -271,12 +270,12 @@ DynReply.prototype.showMessage = function(msg) {
// reply box function // reply box function
function nntpchan_reply(parent, shorthash) { function nntpchan_reply(parent, shorthash) {
if (parent && document.dynreply) { if (parent && document.dynreply) {
var boardname = parent.getAttribute("boardname"); var boardname = parent.dataset.newsgroup;
var roothash = parent.getAttribute("root"); var rootmsg = parent.dataset.rootmsgid;
var replyto = getReplyTo(); var replyto = getReplyTo();
// set target // set target
replyto.setBoard(boardname); replyto.setBoard(boardname);
replyto.setRoot(roothash); replyto.setRoot(rootmsg);
// show it // show it
replyto.show(); replyto.show();
} }
@ -290,7 +289,7 @@ function nntpchan_reply(parent, shorthash) {
// inject post hover behavior // inject post hover behavior
function inject_hover(prefix, el, parent) { function inject_hover(prefix, el, parent) {
if (!prefix) { throw "prefix is not defined"; } if (!prefix) { throw "prefix is not defined"; }
var linkhash = el.getAttribute("backlinkhash"); var linkhash = el.dataset.msgidhash;
if (!linkhash) { throw "linkhash undefined"; } if (!linkhash) { throw "linkhash undefined"; }
console.log("rewrite linkhash "+linkhash); console.log("rewrite linkhash "+linkhash);