mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 05:55:48 +01:00
updated scrollToPost behaviour to no longer ajaxify loudly. Also updated call to checkPagePresence to fire before the topicDOM events begin, so if an in-topic search is conducted on a different topic from the current topic, the topicDOM behaviour continues. closes #3040
This commit is contained in:
@@ -58,9 +58,12 @@ $(document).ready(function() {
|
||||
require(['translator', 'search'], function(translator, search) {
|
||||
translator.load(config.defaultLang, data.template.name);
|
||||
renderTemplate(url, data.template.name, data, callback);
|
||||
});
|
||||
});
|
||||
|
||||
if (!quiet) {
|
||||
search.topicDOM.end();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -191,7 +191,7 @@ define('navigator', ['forum/pagination', 'components'], function(pagination, com
|
||||
} else {
|
||||
navigator.scrollActive = false;
|
||||
postIndex = parseInt(postIndex, 10) + 1;
|
||||
ajaxify.go(generateUrl(postIndex));
|
||||
ajaxify.go(generateUrl(postIndex), undefined, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -88,13 +88,15 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
|
||||
term: term
|
||||
};
|
||||
|
||||
Search.checkPagePresence(tid, function() {
|
||||
Search.topicDOM.update(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Search.checkPagePresence = function(tid, callback) {
|
||||
if (!ajaxify.currentPage.match(new RegExp('^topic/' + tid))) {
|
||||
if (parseInt(ajaxify.variables.get('topic_id'), 10) !== parseInt(tid, 10)) {
|
||||
ajaxify.go('topic/' + tid, callback);
|
||||
} else {
|
||||
callback();
|
||||
@@ -119,7 +121,6 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
|
||||
|
||||
Search.topicDOM.start();
|
||||
|
||||
Search.checkPagePresence(Search.current.tid, function() {
|
||||
if (Search.current.results.length > 0) {
|
||||
topicSearchEl.find('.count').html((index+1) + ' / ' + Search.current.results.length);
|
||||
topicSearchEl.find('.prev, .next').removeAttr('disabled');
|
||||
@@ -132,7 +133,6 @@ define('search', ['navigator', 'translator'], function(nav, translator) {
|
||||
});
|
||||
topicSearchEl.removeClass('hidden').find('.prev, .next').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Search.topicDOM.start = function() {
|
||||
|
||||
Reference in New Issue
Block a user