Merge branch 'master' into openingexplorer

* master:
  no longer open analysis in mobile app - closes #1600
  upgrade scalachess
  create tournament form does not reset fields
pull/1605/head
Thibault Duplessis 2016-02-15 18:09:44 +07:00
commit 358007de62
1 changed files with 13 additions and 4 deletions

View File

@ -2,13 +2,22 @@ $(function() {
var $check = $('#tournament #isprivate');
var $time = $('#tournament tr.time td');
var $minutes = $('#tournament tr.minutes td');
function replace($el, $paste) {
var prvVal = $el.children().first().val();
$el.html($paste.html());
if (prvVal) {
$el.children().first().val(prvVal);
}
}
function showPrivate() {
if ($check.prop('checked')) {
$time.html($('#tournament .private_time').html());
$minutes.html($('#tournament .private_minutes').html());
replace($time, $('#tournament .private_time'));
replace($minutes, $('#tournament .private_minutes'));
} else {
$time.html($('#tournament .public_time').html());
$minutes.html($('#tournament .public_minutes').html());
replace($time, $('#tournament .public_time'));
replace($minutes, $('#tournament .public_minutes'));
}
};
$check.on('change', showPrivate);