remove old analyse JS code
This commit is contained in:
parent
d3276524b1
commit
8f503b779c
|
@ -1954,111 +1954,6 @@ var storage = {
|
|||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
if (true || !$("#GameBoard").length) return;
|
||||
|
||||
$('div.game_control a').filter('.continue').click(function() {
|
||||
$('div.board_wrap div.continue').toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// override to remove word boundaries (\b)
|
||||
// required to match e2e4 and highlight the moves on the board
|
||||
chessMovesRegExp = new RegExp("((\\d+(\\.{1,3}|\\s)\\s*)?((([KQRBN][a-h1-8]?)|[a-h])?x?[a-h][1-8](=[QRNB])?|O-O-O|O-O)[!?+#]*)", "g");
|
||||
|
||||
SetImagePath($('body').data('static-url') + '/piece/' + $('body').data('piece-set'));
|
||||
SetImageType("svg");
|
||||
SetShortcutKeysEnabled(true);
|
||||
$('input').on('focus', function() {
|
||||
SetShortcutKeysEnabled(false);
|
||||
}).on('blur', function() {
|
||||
SetShortcutKeysEnabled(true);
|
||||
});
|
||||
var $game = $("#GameBoard");
|
||||
$game.mousewheel(function(event) {
|
||||
if (event.deltaY == -1) {
|
||||
$('#forwardButton').click();
|
||||
} else if (event.deltaY == 1) {
|
||||
$('#backButton').click();
|
||||
}
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
var $chat = $('#chat');
|
||||
if ($chat.length) $chat.chat({
|
||||
messages: lichess_chat
|
||||
});
|
||||
var $watchers = $("div.watchers").watchers();
|
||||
|
||||
var $panels = $('div.analysis_panels > div');
|
||||
$('div.analysis_menu').on('click', 'a', function() {
|
||||
var panel = $(this).data('panel');
|
||||
if (!panel) return;
|
||||
$(this).siblings('.active').removeClass('active').end().addClass('active');
|
||||
$panels.removeClass('active').filter('.' + panel).addClass('active');
|
||||
if (panel == 'move_times') try {
|
||||
$.renderMoveTimesChart();
|
||||
} catch (e) {}
|
||||
}).find('a:first').click();
|
||||
|
||||
var pgnLoader = function() {
|
||||
$panels.find('.loader span').each(function() {
|
||||
var t = this;
|
||||
var moves = _.filter(_.values(
|
||||
$('#ShowPgnText a').map(function() {
|
||||
return $(this).text();
|
||||
})
|
||||
), function(x) {
|
||||
return typeof x == 'string';
|
||||
});
|
||||
var len = moves.length,
|
||||
it = 0;
|
||||
setInterval(function() {
|
||||
t.innerHTML = moves[it++ % len] || '';
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
setTimeout(pgnLoader, 500);
|
||||
|
||||
$panels.find('form.future_game_analysis').submit(function() {
|
||||
if ($(this).hasClass('must_login')) {
|
||||
if (confirm($.trans('You need an account to do that') + '.')) {
|
||||
location.href = '/signup';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: $(this).attr('action'),
|
||||
success: function(html) {
|
||||
$panels.filter('.panel.computer_analysis').html(html);
|
||||
pgnLoader();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
lichess.socket = new lichess.StrongSocket(
|
||||
$game.data("socket-url"),
|
||||
parseInt($game.data("version"), 10), {
|
||||
options: {
|
||||
name: "analyse",
|
||||
ignoreUnknownMessages: true
|
||||
},
|
||||
events: {
|
||||
analysisAvailable: function() {
|
||||
$.sound.dong();
|
||||
location.href = location.href.split('#')[0] + '#' + CurrentPly;
|
||||
location.reload();
|
||||
},
|
||||
crowd: function(event) {
|
||||
$watchers.watchers("set", event.watchers);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/////////////// forum.js ////////////////////
|
||||
|
||||
$('#lichess_forum').on('click', 'a.delete', function() {
|
||||
|
|
Loading…
Reference in a new issue