Merge pull request #368 from marktaiwan/highlight-reply

highlightReply: check for linking to external post
This commit is contained in:
Fredrick Brennan 2015-01-29 09:53:56 +08:00
commit cf090aecea

View File

@ -254,6 +254,27 @@ function get_cookie(cookie_name) {
} }
function highlightReply(id, event) { function highlightReply(id, event) {
// check if external post
var post_list, arr, i;
post_list = document.querySelectorAll('a.post_no');
for (i = 0, arr = []; i<post_list.length; i++) {
arr.push(post_list[i]);
}
arr = arr.filter(function (ele) {
if (ele.hasAttribute('id') || ((' '+ ele.parentElement.parentElement.className +' ').indexOf(' hidden ') > -1)) {
return false;
} else {
return true;
}
});
for (i = 0, post_list = []; i < arr.length; i++) {
post_list.push(arr[i].innerHTML);
}
if (post_list.indexOf(id) == -1)
return true;
if (typeof window.event != "undefined") { if (typeof window.event != "undefined") {
// don't highlight on middle click // don't highlight on middle click
var e = event || window.event; var e = event || window.event;