From c9514733109b39c47b2195b7456be515e38a1112 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 30 Sep 2017 09:00:10 -0400 Subject: [PATCH] focus on our post if posted --- contrib/static/overchan.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/static/overchan.js b/contrib/static/overchan.js index aa14d91..e91ade3 100644 --- a/contrib/static/overchan.js +++ b/contrib/static/overchan.js @@ -46,7 +46,7 @@ var reloadImg = function(el) { return false; }; -var reloadThreadJSON = function() { +var reloadThreadJSON = function(ourPost) { var url = window.location.pathname + "/json"; var ajax = new XMLHttpRequest(); ajax.onreadystatechange = function() { @@ -65,6 +65,10 @@ var reloadThreadJSON = function() { e.innerHTML = posts[idx].PostMarkup; rootelem.appendChild(e.childNodes[0]); 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) { reloadImg(img); } - reloadThreadJSON(); + reloadThreadJSON(j.message_id); } else { // do redirect window.location.pathname = j.url;