Archived
1
0

focus on our post if posted

This commit is contained in:
Jeff Becker 2017-09-30 09:00:10 -04:00
parent 23b4f11e6d
commit c951473310
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -46,7 +46,7 @@ var reloadImg = function(el) {
return false; return false;
}; };
var reloadThreadJSON = function() { var reloadThreadJSON = function(ourPost) {
var url = window.location.pathname + "/json"; var url = window.location.pathname + "/json";
var ajax = new XMLHttpRequest(); var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function() { ajax.onreadystatechange = function() {
@ -65,6 +65,10 @@ var reloadThreadJSON = function() {
e.innerHTML = posts[idx].PostMarkup; e.innerHTML = posts[idx].PostMarkup;
rootelem.appendChild(e.childNodes[0]); rootelem.appendChild(e.childNodes[0]);
e.remove(); e.remove();
if(ourPost && posts[idx].Message_id == ourPost) {
// focus on our post
window.location.href = window.location.href.replace("#", "") + "#"+id;
}
} }
} }
} }
@ -135,7 +139,7 @@ onready(function() {
if (img) { if (img) {
reloadImg(img); reloadImg(img);
} }
reloadThreadJSON(); reloadThreadJSON(j.message_id);
} else { } else {
// do redirect // do redirect
window.location.pathname = j.url; window.location.pathname = j.url;