auto refresh public chat mod page WIP

This commit is contained in:
Gordon Martin 2016-09-04 17:43:23 +01:00
parent 2e39821733
commit db8c4f6d6f
2 changed files with 12 additions and 1 deletions

View file

@ -35,7 +35,6 @@ object Mod extends LilaController {
val tourChats = tourApi.fetchVisibleTournaments.flatMap {
visibleTournaments =>
val tournamentList = sortTournamentsByRelevance(visibleTournaments.all)
val ids = tournamentList.map(_.id)
chatApi.userChat.findAll(ids).map {

View file

@ -2,7 +2,19 @@
simulChats: List[(lila.simul.Simul, lila.chat.UserChat)])(implicit ctx: Context)
@moreJs= {
var reloadTimer = null;
var startAutoRefresh = function () {
reloadTimer = setTimeout(function() {
$("#communication").load("@routes.Mod.publicChats" #public_communication"
}, 3000);
};
var stopAutoRefresh = function () {
if (reloadTimer) {
clearTimeout(reloadTimer);
}
};
}
@mod.layout(