auto refresh public chat mod page WIP
This commit is contained in:
parent
2e39821733
commit
db8c4f6d6f
|
@ -35,7 +35,6 @@ object Mod extends LilaController {
|
||||||
val tourChats = tourApi.fetchVisibleTournaments.flatMap {
|
val tourChats = tourApi.fetchVisibleTournaments.flatMap {
|
||||||
visibleTournaments =>
|
visibleTournaments =>
|
||||||
val tournamentList = sortTournamentsByRelevance(visibleTournaments.all)
|
val tournamentList = sortTournamentsByRelevance(visibleTournaments.all)
|
||||||
|
|
||||||
val ids = tournamentList.map(_.id)
|
val ids = tournamentList.map(_.id)
|
||||||
|
|
||||||
chatApi.userChat.findAll(ids).map {
|
chatApi.userChat.findAll(ids).map {
|
||||||
|
|
|
@ -2,7 +2,19 @@
|
||||||
simulChats: List[(lila.simul.Simul, lila.chat.UserChat)])(implicit ctx: Context)
|
simulChats: List[(lila.simul.Simul, lila.chat.UserChat)])(implicit ctx: Context)
|
||||||
|
|
||||||
@moreJs= {
|
@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(
|
@mod.layout(
|
||||||
|
|
Loading…
Reference in a new issue