highlightReply no longer requires jQuery

Also accidentally converted a bunch of space to tabs
This commit is contained in:
marktaiwan 2015-01-28 21:55:15 +08:00
parent 61bd5c648e
commit f484d28e05

View File

@ -254,16 +254,26 @@ function get_cookie(cookie_name) {
}
function highlightReply(id, event) {
if (typeof $ != 'undefined') {
// check if external post
// TODO: Don't use jQuery
var post_list = $('a.post_no').filter(':not([id])').filter(function(){
if (!$(this).parent().parent().hasClass('hidden')) return true;
});
post_list = $.map($.makeArray(post_list), function(ele) {return $(ele).html()});
if (post_list.indexOf(id) == -1)
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") {
// don't highlight on middle click