ui/simul doesn't depend on chessground at all

pull/2707/head^2
Thibault Duplessis 2017-02-27 17:26:20 +01:00
parent 85bd9e7fee
commit 2c24b65f21
7 changed files with 12 additions and 22 deletions

View File

@ -26,7 +26,6 @@ title = sim.fullName,
side = simul.side(sim).some,
underchat = underchat.some,
chat = chat.dom().some,
moreJs = moreJs,
chessground = false) {
moreJs = moreJs) {
<div id="simul"></div>
}

View File

@ -28,9 +28,7 @@
"watchify": "~3.7"
},
"dependencies": {
"chessground": "github:ornicar/chessground#v4.4.0",
"game": "file:../game",
"lodash": "~3.7.0",
"mithril": "github:ornicar/mithril.js#v1.0.1"
}
}

View File

@ -18,7 +18,3 @@ module.exports = function(element, opts) {
socketReceive: controller.socket.receive
};
};
// lol, that's for the rest of lichess to access mithril
// without having to include it a second time
window.Chessground = require('chessground');

View File

@ -1,19 +1,18 @@
var m = require('mithril');
var partial = require('chessground').util.partial;
var simul = require('../simul');
var xhr = require('../xhr');
function withdraw(ctrl) {
return m('button.button.right.text', {
'data-icon': 'b',
onclick: partial(xhr.withdraw, ctrl)
onclick: lichess.partial(xhr.withdraw, ctrl)
}, ctrl.trans('withdraw'));
}
function join(ctrl) {
return m('button.button.right.text', {
'data-icon': 'G',
onclick: partial(xhr.join, ctrl)
onclick: lichess.partial(xhr.join, ctrl)
}, ctrl.trans('join'));
}

View File

@ -1,5 +1,4 @@
var m = require('mithril');
var partial = require('chessground').util.partial;
var simul = require('../simul');
var util = require('./util');
var xhr = require('../xhr');
@ -22,7 +21,7 @@ function startOrCancel(ctrl, accepted) {
return accepted.length > 1 ?
m('a.button.top_right.text.active', {
'data-icon': 'G',
onclick: partial(xhr.start, ctrl)
onclick: lichess.partial(xhr.start, ctrl)
}, 'Start') : m('a.button.top_right.text', {
'data-icon': 'L',
onclick: function() {
@ -42,7 +41,7 @@ module.exports = function(ctrl) {
randomButton(ctrl, candidates)
] : (
simul.containsMe(ctrl) ? m('a.button.top_right', {
onclick: partial(xhr.withdraw, ctrl)
onclick: lichess.partial(xhr.withdraw, ctrl)
}, ctrl.trans('withdraw')) : m('a.button.top_right.text', {
'data-icon': 'G',
onclick: function() {

View File

@ -1,5 +1,4 @@
var m = require('mithril');
var partial = require('chessground').util.partial;
var xhrConfig = function(xhr) {
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
@ -18,16 +17,16 @@ function simulAction(action, ctrl) {
}
module.exports = {
start: partial(simulAction, 'start'),
abort: partial(simulAction, 'abort'),
start: lichess.partial(simulAction, 'start'),
abort: lichess.partial(simulAction, 'abort'),
join: function(variantKey) {
return partial(simulAction, 'join/' + variantKey);
return lichess.partial(simulAction, 'join/' + variantKey);
},
withdraw: partial(simulAction, 'withdraw'),
withdraw: lichess.partial(simulAction, 'withdraw'),
accept: function(user) {
return partial(simulAction, 'accept/' + user)
return lichess.partial(simulAction, 'accept/' + user)
},
reject: function(user) {
return partial(simulAction, 'reject/' + user)
return lichess.partial(simulAction, 'reject/' + user)
}
};

View File

@ -28,7 +28,7 @@
"watchify": "~3.7"
},
"dependencies": {
"chessground": "^v6.0.10",
"chessground": "^v6.0.13",
"common": "file:../common",
"game": "file:../game",
"mithril": "github:ornicar/mithril.js#v1.0.1"