disable replybox on thread and board pages, default to overchan.random for livechand ukko pages
This commit is contained in:
parent
faf5071740
commit
85ce14091a
@ -146,10 +146,15 @@ DynReply.prototype.update = function() {
|
||||
if (this.prefix) {
|
||||
// update captcha
|
||||
this.updateCaptcha();
|
||||
if (this.board && this.roothash) {
|
||||
if (this.board) {
|
||||
// update post form
|
||||
var ref = document.getElementById("postform_reference");
|
||||
ref.setAttribute("value", this.roothash);
|
||||
|
||||
if (this.roothash) {
|
||||
ref.setAttribute("value", this.roothash);
|
||||
} else {
|
||||
ref.setAttribute("value", "");
|
||||
}
|
||||
this.url = this.prefix + "post/" + this.board + "?t=json";
|
||||
}
|
||||
}
|
||||
@ -346,63 +351,70 @@ function inject_hover_for_element(elem) {
|
||||
function init(prefix) {
|
||||
// inject posthover ...
|
||||
inject_hover_for_element(document);
|
||||
// initialize replyto widget
|
||||
var rpl = getReplyTo();
|
||||
rpl.setPrefix(prefix);
|
||||
if ( /\.html$/.test(document.location.pathname) ) {
|
||||
// board / thread page
|
||||
} else {
|
||||
// ukko / livechan page
|
||||
var rpl = getReplyTo();
|
||||
rpl.setPrefix(prefix);
|
||||
// set livechan
|
||||
rpl.setBoard("overchan.random");
|
||||
rpl.update();
|
||||
rpl.updateCaptcha();
|
||||
|
||||
// position replyto widget
|
||||
var e = rpl.elem;
|
||||
var mouseDownX, mouseDownY;
|
||||
|
||||
var $dragging = null;
|
||||
|
||||
// position replyto widget
|
||||
var e = rpl.elem;
|
||||
var mouseDownX, mouseDownY;
|
||||
|
||||
var $dragging = null;
|
||||
$(rpl.elem).on("mousemove", function(ev) {
|
||||
if ($dragging) {
|
||||
var x = ev.pageX - $(this).width() / 2,
|
||||
y = ev.pageY - $(this).height() / 2;
|
||||
$dragging.offset({
|
||||
top: y,
|
||||
left: x
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(rpl.elem).on("mousemove", function(ev) {
|
||||
if ($dragging) {
|
||||
var x = ev.pageX - $(this).width() / 2,
|
||||
y = ev.pageY - $(this).height() / 2;
|
||||
$dragging.offset({
|
||||
top: y,
|
||||
left: x
|
||||
|
||||
$(rpl.elem).on("mousedown", e, function (ev) {
|
||||
$dragging = $(rpl.elem);
|
||||
});
|
||||
|
||||
$(rpl.elem).on("mouseup", function (e) {
|
||||
$dragging = null;
|
||||
});
|
||||
|
||||
// add replyto post handlers
|
||||
e = document.getElementById("postform_submit");
|
||||
var postit = function() {
|
||||
var f = document.querySelector("form");
|
||||
// do ajax request to post data
|
||||
var r = getReplyTo();
|
||||
r.showMessage("posting... ");
|
||||
r.post(function(j) {
|
||||
if(j.error) {
|
||||
// an error happened
|
||||
r.showError(j.error);
|
||||
} else {
|
||||
// we're good
|
||||
r.showMessage("posted :^)");
|
||||
r.updateCaptcha();
|
||||
r.clear();
|
||||
}
|
||||
}, function(err) {
|
||||
r.showError(err);
|
||||
r.clearSolution();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(rpl.elem).on("mousedown", e, function (ev) {
|
||||
$dragging = $(rpl.elem);
|
||||
});
|
||||
|
||||
$(rpl.elem).on("mouseup", function (e) {
|
||||
$dragging = null;
|
||||
});
|
||||
|
||||
// add replyto post handlers
|
||||
e = document.getElementById("postform_submit");
|
||||
var postit = function() {
|
||||
var f = document.querySelector("form");
|
||||
// do ajax request to post data
|
||||
var r = getReplyTo();
|
||||
r.showMessage("posting... ");
|
||||
r.post(function(j) {
|
||||
if(j.error) {
|
||||
// an error happened
|
||||
r.showError(j.error);
|
||||
} else {
|
||||
// we're good
|
||||
r.showMessage("posted :^)");
|
||||
r.updateCaptcha();
|
||||
r.clear();
|
||||
}
|
||||
}, function(err) {
|
||||
r.showError(err);
|
||||
r.clearSolution();
|
||||
});
|
||||
}
|
||||
var f = document.querySelector("form");
|
||||
f.onsubmit = function() {
|
||||
postit();
|
||||
return false;
|
||||
}
|
||||
|
||||
f.onsubmit = function() {
|
||||
postit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,8 @@ function DynReply(existingElem){if(existingElem){this.elem=existingElem;this.for
|
||||
var elem=document.createElement("div");elem.setAttribute("id","postform_container");this.elem=elem;this.form=document.createElement("form");this.form.enctype="multipart/form-data";this.form.name="post";this.form.method="post";elem=document.createElement("input");elem.setAttribute("id","postform_reference");elem.name="reference";elem.type="hidden";this.form.appendChild(elem);var table=document.createElement("table");table.setAttribute("class","postform");var tbody=document.createElement("tbody");var span=document.createElement("span");elem=document.createElement("input");elem.setAttribute("name","name");elem.setAttribute("value","Anonymous");elem.setAttribute("id","postform_name");span.appendChild(elem);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"),[span])
|
||||
elem=document.createElement("input");elem.setAttribute("name","subject");elem.setAttribute("value","");elem.setAttribute("id","postform_subject");var submit=document.createElement("input");submit.setAttribute("value","reply");submit.setAttribute("class","button");submit.setAttribute("type","submit");submit.setAttribute("id","postform_submit");table_insert_row(tbody,document.createTextNode("Subject"),[elem,submit]);elem=document.createElement("textarea");elem.setAttribute("id","postform_message");elem.setAttribute("name","message");elem.setAttribute("cols","40");elem.setAttribute("rows","5");table_insert_row(tbody,document.createTextNode("Comment"),[elem]);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");table_insert_row(tbody,document.createTextNode("Files"),[elem]);elem=document.createElement("input");elem.setAttribute("type","checkbox");elem.setAttribute("name","dubs");table_insert_row(tbody,document.createTextNode("Get Dubs"),[elem]);elem=document.createElement("img");elem.setAttribute("id","captcha_img");elem.alt="captcha";table_insert_row(tbody,document.createTextNode("Captcha"),[elem]);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.board=null;this.roothash=null;this.prefix=null;this.url=null;this.x=1;this.y=1;}
|
||||
DynReply.prototype.update=function(){if(this.prefix){this.updateCaptcha();if(this.board&&this.roothash){var ref=document.getElementById("postform_reference");ref.setAttribute("value",this.roothash);this.url=this.prefix+"post/"+this.board+"?t=json";}}}
|
||||
DynReply.prototype.update=function(){if(this.prefix){this.updateCaptcha();if(this.board){var ref=document.getElementById("postform_reference");if(this.roothash){ref.setAttribute("value",this.roothash);}else{ref.setAttribute("value","");}
|
||||
this.url=this.prefix+"post/"+this.board+"?t=json";}}}
|
||||
DynReply.prototype.show=function(){console.log("show dynreply");this.update();this.elem.style.display='inline';}
|
||||
DynReply.prototype.hide=function(){console.log("hide dynreply");this.elem.style.display="none";}
|
||||
DynReply.prototype.clear=function(){this.clearSolution();this.clearPostbox();}
|
||||
@ -687,8 +688,8 @@ parent.appendChild(wrapper);parent.backlink=false;},function(msg){var wrapper=do
|
||||
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);}
|
||||
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;var mouseDownX,mouseDownY;var $dragging=null;$(rpl.elem).on("mousemove",function(ev){if($dragging){var x=ev.pageX-$(this).width()/2,y=ev.pageY-$(this).height()/2;$dragging.offset({top:y,left:x});}});$(rpl.elem).on("mousedown",e,function(ev){$dragging=$(rpl.elem);});$(rpl.elem).on("mouseup",function(e){$dragging=null;});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 :^)");r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});}
|
||||
var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}}
|
||||
function init(prefix){inject_hover_for_element(document);if(/\.html$/.test(document.location.pathname)){}else{var rpl=getReplyTo();rpl.setPrefix(prefix);rpl.setBoard("overchan.random");rpl.update();rpl.updateCaptcha();var e=rpl.elem;var mouseDownX,mouseDownY;var $dragging=null;$(rpl.elem).on("mousemove",function(ev){if($dragging){var x=ev.pageX-$(this).width()/2,y=ev.pageY-$(this).height()/2;$dragging.offset({top:y,left:x});}});$(rpl.elem).on("mousedown",e,function(ev){$dragging=$(rpl.elem);});$(rpl.elem).on("mouseup",function(e){$dragging=null;});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 :^)");r.updateCaptcha();r.clear();}},function(err){r.showError(err);r.clearSolution();});}
|
||||
var f=document.querySelector("form");f.onsubmit=function(){postit();return false;}}}
|
||||
/* local file: ./contrib/js/theme.js */
|
||||
function enable_theme(prefix,name){if(prefix&&name){var theme=document.getElementById("current_theme");if(theme){theme.href=prefix+"static/"+name+".css";var st=get_storage();st.nntpchan_prefix=prefix;st.nntpchan_theme=name;}}}
|
||||
var st=get_storage();enable_theme(st.nntpchan_prefix,st.nntpchan_theme);
|
Reference in New Issue
Block a user