move simul socket message handler to ui/round

pull/3486/merge
Thibault Duplessis 2017-08-19 11:00:52 -05:00
parent 42e8ffe9c3
commit a05e6f0711
3 changed files with 10 additions and 11 deletions

View File

@ -1,13 +1,13 @@
/// <reference types="types/lichess" />
import { GameData, GameView, Player, Status, Source } from './interfaces';
import { GameData, GameView, Player, Status, Source, Simul } from './interfaces';
import * as game from './game';
import * as status from './status';
import * as router from './router';
import viewStatus from './view/status';
export { GameData, Player, Status, Source, game, status, router };
export { GameData, Player, Status, Source, Simul, game, status, router };
export const view: GameView = {
status: viewStatus

View File

@ -4,6 +4,7 @@ import * as xhr from './xhr';
import * as sound from './sound';
import RoundController from './ctrl';
import { Untyped, ApiEnd } from './interfaces';
import { Simul } from 'game';
const li = window.lichess;
@ -123,6 +124,12 @@ export function make(send: SocketSend, ctrl: RoundController): RoundSocket {
li.hasToReload = true;
location.href = '/' + gameId;
}
},
simulEnd(simul: Simul) {
$.modal($(
'<p>Simul complete!</p><br /><br />' +
'<a class="button" href="/simul/' + simul.id + '">Back to ' + simul.name + ' simul</a>'
));
}
};

View File

@ -120,20 +120,12 @@ lichess.topMenuIntent = function() {
'<div class="actions">' +
'<a class="withdraw text" href="' + url + '/withdraw" data-icon="Z">Pause</a>' +
'<a class="text" href="' + url + '" data-icon="G">Join</a>' +
'</div>' +
'</div>' +
'</div>'
'</div></div></div>'
).find("a.withdraw").click(function() {
$.post($(this).attr("href"));
$('#tournament_reminder').remove();
return false;
});
},
simulEnd: function(simul) {
$.modal($(
'<p>Simul complete!</p><br /><br />' +
'<a class="button" href="/simul/' + simul.id + '">Back to ' + simul.name + ' simul</a>'
));
}
},
params: {},