fix board coord color settes

This commit is contained in:
Thibault Duplessis 2020-09-05 17:41:34 +02:00
parent 0839903703
commit b90b0484d0
2 changed files with 49 additions and 49 deletions

View file

@ -19,7 +19,7 @@ import * as pgnExport from './pgnExport';
import forecastView from './forecast/forecastView';
import { view as cevalView } from 'ceval';
import crazyView from './crazy/crazyView';
import { view as keyboardView} from './keyboard';
import { view as keyboardView } from './keyboard';
import explorerView from './explorer/explorerView';
import retroView from './retrospect/retroView';
import practiceView from './practice/practiceView';
@ -178,7 +178,7 @@ function repeater(ctrl: AnalyseCtrl, action: 'prev' | 'next', e: Event) {
let timeout = setTimeout(repeat, 500);
control[action](ctrl);
const eventName = e.type == 'touchstart' ? 'touchend' : 'mouseup';
document.addEventListener(eventName, () => clearTimeout(timeout), {once: true});
document.addEventListener(eventName, () => clearTimeout(timeout), { once: true });
}
function controls(ctrl: AnalyseCtrl) {
@ -209,29 +209,29 @@ function controls(ctrl: AnalyseCtrl) {
}
})
] : [
h('button.fbt', {
attrs: {
title: noarg('openingExplorerAndTablebase'),
'data-act': 'explorer',
'data-icon': ']'
},
class: {
hidden: menuIsOpen || !ctrl.explorer.allowed() || !!ctrl.retro,
active: ctrl.explorer.enabled()
}
}),
ctrl.ceval.possible && ctrl.ceval.allowed() && !ctrl.isGamebook() ? h('button.fbt', {
attrs: {
title: noarg('practiceWithComputer'),
'data-act': 'practice',
'data-icon': ''
},
class: {
hidden: menuIsOpen || !!ctrl.retro,
active: !!ctrl.practice
}
}) : null
]),
h('button.fbt', {
attrs: {
title: noarg('openingExplorerAndTablebase'),
'data-act': 'explorer',
'data-icon': ']'
},
class: {
hidden: menuIsOpen || !ctrl.explorer.allowed() || !!ctrl.retro,
active: ctrl.explorer.enabled()
}
}),
ctrl.ceval.possible && ctrl.ceval.allowed() && !ctrl.isGamebook() ? h('button.fbt', {
attrs: {
title: noarg('practiceWithComputer'),
'data-act': 'practice',
'data-icon': ''
},
class: {
hidden: menuIsOpen || !!ctrl.retro,
active: !!ctrl.practice
}
}) : null
]),
h('div.jumps', [
jumpButton('W', 'first', canJumpPrev),
jumpButton('Y', 'prev', canJumpPrev),
@ -250,7 +250,7 @@ function controls(ctrl: AnalyseCtrl) {
}
function forceInnerCoords(ctrl: AnalyseCtrl, v: boolean) {
if (ctrl.data.pref.coords == 2){
if (ctrl.data.pref.coords == 2) {
$('body').toggleClass('coords-in', v).toggleClass('coords-out', !v);
changeColorHandle();
}
@ -333,26 +333,26 @@ export default function(ctrl: AnalyseCtrl): VNode {
intro ? null : acplView(ctrl),
ctrl.embed ? null : (
ctrl.studyPractice ? studyPracticeView.side(study!) :
h('aside.analyse__side', {
hook: onInsert(elm => {
ctrl.opts.$side && ctrl.opts.$side.length && $(elm).replaceWith(ctrl.opts.$side);
$(elm).append($('.streamers').clone().removeClass('none'));
})
},
ctrl.studyPractice ? [studyPracticeView.side(study!)] : (
study ? [studyView.side(study)] : [
ctrl.forecast ? forecastView(ctrl, ctrl.forecast) : null,
(!ctrl.synthetic && playable(ctrl.data)) ? h('div.back-to-game',
h('a.button.button-empty.text', {
attrs: {
href: router.game(ctrl.data, ctrl.data.player.color),
'data-icon': 'i'
}
}, ctrl.trans.noarg('backToGame'))
) : null
]
h('aside.analyse__side', {
hook: onInsert(elm => {
ctrl.opts.$side && ctrl.opts.$side.length && $(elm).replaceWith(ctrl.opts.$side);
$(elm).append($('.streamers').clone().removeClass('none'));
})
},
ctrl.studyPractice ? [studyPracticeView.side(study!)] : (
study ? [studyView.side(study)] : [
ctrl.forecast ? forecastView(ctrl, ctrl.forecast) : null,
(!ctrl.synthetic && playable(ctrl.data)) ? h('div.back-to-game',
h('a.button.button-empty.text', {
attrs: {
href: router.game(ctrl.data, ctrl.data.player.color),
'data-icon': 'i'
}
}, ctrl.trans.noarg('backToGame'))
) : null
]
)
)
)
),
study && study.relay && relayManager(study.relay),
ctrl.opts.chat && h('section.mchat', {

View file

@ -28,11 +28,11 @@ const changeColorHandle = (): void => {
for (const theme of document.body.className.split(' ')) {
if (theme in dict) {
const set = document.documentElement.style.setProperty,
const style = document.documentElement.style,
colors = dict[theme].split(' ');
set('--cg-coord-color-white', colors[0]);
set('--cg-coord-color-black', colors[1]);
set('--cg-coord-shadow', 'none');
style.setProperty('--cg-coord-color-white', colors[0]);
style.setProperty('--cg-coord-color-black', colors[1]);
style.setProperty('--cg-coord-shadow', 'none');
}
}
}