This commit is contained in:
Barış Soner Uşaklı
2015-03-19 12:32:05 -04:00
parent 0bbebbe4b1
commit 0cc900bdcf
4 changed files with 23 additions and 15 deletions

View File

@@ -90,18 +90,26 @@ define('navigator', ['forum/pagination'], function(pagination) {
navigator.update = function() {
toggle(!!count);
$($(navigator.selector).get().reverse()).each(function() {
var topIndex = 0;
var bottomIndex = 0;
$(navigator.selector).each(function() {
var el = $(this);
if (elementInView(el)) {
if (typeof navigator.callback === 'function') {
index = navigator.callback(el, count);
navigator.updateTextAndProgressBar();
if (!topIndex) {
topIndex = parseInt(el.attr('data-index'), 10) + 1;
} else {
bottomIndex = parseInt(el.attr('data-index'), 10) + 1;
}
} else if (topIndex && bottomIndex) {
return false;
}
});
if (typeof navigator.callback === 'function' && topIndex && bottomIndex) {
index = navigator.callback(topIndex, bottomIndex, count);
navigator.updateTextAndProgressBar();
}
};
navigator.updateTextAndProgressBar = function() {