mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
closes #2051
This commit is contained in:
@@ -212,6 +212,10 @@ define('forum/topic', dependencies, function(pagination, infinitescroll, threadT
|
||||
};
|
||||
|
||||
Topic.navigatorCallback = function(element, elementCount) {
|
||||
var path = ajaxify.removeRelativePath(window.location.pathname.slice(1));
|
||||
if (!path.startsWith('topic')) {
|
||||
return 1;
|
||||
}
|
||||
var postIndex = parseInt(element.attr('data-index'), 10);
|
||||
var index = postIndex + 1;
|
||||
if (config.topicPostSort !== 'oldest_to_newest') {
|
||||
|
||||
@@ -24,6 +24,12 @@ define('navigator', ['forum/pagination'], function(pagination) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$('.pagination-block').off('shown.bs.dropdown', '.dropdown').on('shown.bs.dropdown', '.dropdown', function() {
|
||||
setTimeout(function() {
|
||||
$('.pagination-block input').focus();
|
||||
}, 100);
|
||||
});
|
||||
|
||||
$('.pagination-block .pageup').off('click').on('click', navigator.scrollUp);
|
||||
$('.pagination-block .pagedown').off('click').on('click', navigator.scrollDown);
|
||||
$('.pagination-block .pagetop').off('click').on('click', toTop);
|
||||
@@ -72,6 +78,11 @@ define('navigator', ['forum/pagination'], function(pagination) {
|
||||
};
|
||||
|
||||
function toggle(flag) {
|
||||
var path = ajaxify.removeRelativePath(window.location.pathname.slice(1));
|
||||
if (flag && (!path.startsWith('topic') && !path.startsWith('category'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.pagination-block').toggleClass('hidden', !flag);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,6 +359,16 @@
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof String.prototype.startsWith != 'function') {
|
||||
String.prototype.startsWith = function (prefix){
|
||||
if (this.length < prefix.length)
|
||||
return false;
|
||||
for (var i = prefix.length - 1; (i >= 0) && (this[i] === prefix[i]); --i)
|
||||
continue;
|
||||
return i < 0;
|
||||
};
|
||||
}
|
||||
|
||||
if ('undefined' !== typeof window) {
|
||||
window.utils = module.exports;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user