Skip to content

Commit

Permalink
revert commits from #4657 to fix team pages
Browse files Browse the repository at this point in the history
The "more" button breaks the two column layout on team pages like
https://lichess.org/team/crazyhouse-world-championship.

This reverts commits efbd9f3, e24b01a, cbb430a, 1b56c33, 143e98d.
  • Loading branch information
niklasf committed Oct 24, 2018
1 parent 00a28bf commit 10e1e94
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 39 deletions.
1 change: 0 additions & 1 deletion ui/site/src/index.ts
Expand Up @@ -2,5 +2,4 @@ import './standalones/util';
import './timeago';
import './standalones/trans';
import './socket';
import './infinite-scroll';
import './main';
38 changes: 0 additions & 38 deletions ui/site/src/infinite-scroll.js

This file was deleted.

30 changes: 30 additions & 0 deletions ui/site/src/main.js
Expand Up @@ -507,6 +507,36 @@ lichess.topMenuIntent = function() {
});
});

lichess.loadInfiniteScroll = function(el) {
$(el).each(function() {
if (!$('.pager a', this).length) return;
var $scroller = $(this).infinitescroll({
navSelector: ".pager",
nextSelector: ".pager a",
itemSelector: ".infinitescroll .paginated_element",
errorCallback: function() {
$("#infscr-loading").remove();
},
loading: {
msg: $('<div id="infscr-loading">').html(lichess.spinnerHtml)
}
}, function() {
$("#infscr-loading").remove();
lichess.pubsub.emit('content_loaded')();
var ids = [];
$(el).find('.paginated_element[data-dedup]').each(function() {
var id = $(this).data('dedup');
if (id) {
if (lichess.fp.contains(ids, id)) $(this).remove();
else ids.push(id);
}
});
}).find('div.pager').hide().end();
$scroller.parent().append($('<button class="inf-more">More</button>').on('click', function() {
$scroller.infinitescroll('retrieve');
}));
});
}
lichess.loadInfiniteScroll('.infinitescroll');

$('#top').on('click', 'a.toggle', function() {
Expand Down

0 comments on commit 10e1e94

Please sign in to comment.