minor clean up to categories.js

v1.18.x
Baris Soner Usakli 11 years ago
parent eac201cae9
commit eea677655f

@ -38,9 +38,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
var clickedTid = $(this).parents('li.category-item[data-tid]').attr('data-tid');
$('#topics-container li.category-item').each(function(index, el) {
if($(el).offset().top - $(window).scrollTop() > 0) {
tid = $(el).attr('data-tid');
localStorage.setItem('category:bookmark', tid);
localStorage.setItem('category:bookmark', $(el).attr('data-tid'));
localStorage.setItem('category:bookmark:clicked', clickedTid);
return false;
}
@ -133,8 +131,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
if(!loadingMoreTopics && $('#topics-container').children().length) {
var after = 0;
var el = null;
var after = 0,
offset = 0,
el = null;
if(direction > 0) {
el = $('#topics-container .category-item[data-tid]').last();
@ -146,10 +145,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
if(after < 0) {
after = 0;
}
offset = el.offset().top - $('#header-menu').offset().top + $('#header-menu').height();
}
var offset = el.offset().top - $('#header-menu').offset().top + $('#header-menu').height();
Category.loadMoreTopics(templates.get('category_id'), after, function() {
if(direction < 0 && el) {
Category.scrollToTopic(el.attr('data-tid'), null, 0, offset);
@ -199,7 +197,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
pagination.recreatePaginationLinks(newPageCount);
});
$('#topics-container span.timeago').timeago();
topic.find('span.timeago').timeago();
app.createUserTooltips();
$(window).trigger('action:categories.new_topic.loaded');
@ -264,7 +262,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
}
}
$('#topics-container span.timeago').timeago();
html.find('span.timeago').timeago();
app.createUserTooltips();
app.makeNumbersHumanReadable(html.find('.human-readable-number'));

Loading…
Cancel
Save