Merge branch 'master' into fix-vendors

This commit is contained in:
Julian Lam
2016-04-04 18:46:24 -04:00
610 changed files with 7299 additions and 3194 deletions

View File

@@ -61,12 +61,12 @@ define('forum/topic', [
addParentHandler();
handleBookmark(tid);
handleKeys();
navigator.init('[component="post/anchor"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
handleBookmark(tid);
$(window).on('scroll', updateTopicTitle);
handleTopicSearch();
@@ -82,6 +82,9 @@ define('forum/topic', [
function onKeyDown(ev) {
if (ev.target.nodeName === 'BODY') {
if (ev.shiftKey || ev.ctrlKey || ev.altKey) {
return;
}
if (ev.which === 36) { // home key
Topic.toTop();
return false;
@@ -141,6 +144,7 @@ define('forum/topic', [
return navigator.scrollToPostIndex(postIndex, true);
}
} else if (bookmark && (!config.usePagination || (config.usePagination && ajaxify.data.pagination.currentPage === 1)) && ajaxify.data.postcount > 5) {
navigator.update(0);
app.alert({
alert_id: 'bookmark',
message: '[[topic:bookmark_instructions]]',
@@ -156,6 +160,8 @@ define('forum/topic', [
setTimeout(function() {
app.removeAlert('bookmark');
}, 10000);
} else {
navigator.update(0);
}
}
@@ -216,12 +222,14 @@ define('forum/topic', [
function updateTopicTitle() {
var span = components.get('navbar/title').find('span');
if ($(window).scrollTop() > 50) {
span.html(ajaxify.data.title).show();
} else {
span.html('').hide();
if ($(window).scrollTop() > 50 && span.hasClass('hidden')) {
span.html(ajaxify.data.title).removeClass('hidden');
} else if ($(window).scrollTop() <= 50 && !span.hasClass('hidden')) {
span.html('').addClass('hidden');
}
if ($(window).scrollTop() > 300) {
app.removeAlert('bookmark');
}
app.removeAlert('bookmark');
}
Topic.calculateIndex = function(index, elementCount) {
@@ -231,7 +239,7 @@ define('forum/topic', [
return index;
};
Topic.navigatorCallback = function(index, elementCount) {
Topic.navigatorCallback = function(index, elementCount, threshold) {
var path = ajaxify.removeRelativePath(window.location.pathname.slice(1));
if (!path.startsWith('topic')) {
return 1;
@@ -246,13 +254,13 @@ define('forum/topic', [
newUrl += '/' + index;
}
posts.loadImages(threshold);
if (newUrl !== currentUrl) {
if (Topic.replaceURLTimeout) {
clearTimeout(Topic.replaceURLTimeout);
}
Topic.replaceURLTimeout = setTimeout(function() {
updateUserBookmark(index);
Topic.replaceURLTimeout = 0;