Skip to content

Commit

Permalink
tweak board marks js
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Feb 14, 2013
1 parent 3fab53e commit 6f16a6c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions public/javascripts/big.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ var lichess_translations = [];
}, 1000);

if ($board = $('div.with_marks').orNot()) {
$.displayBoardMarks($board.parent(), $('#lichess > div.lichess_player_white').length);
displayBoardMarks($board.parent(), $('#lichess > div.lichess_player_white').length);
}

// themepicker
Expand Down Expand Up @@ -465,22 +465,20 @@ var lichess_translations = [];
return lichess_translations[text] ? lichess_translations[text] : text;
}

$.displayBoardMarks = function($board, isWhite) {
function displayBoardMarks($board, isWhite) {
if (isWhite) {
var factor = 1;
var base = 0;
} else {
var factor = - 1;
var base = 575;
}
$board.find('span.board_mark').remove();
var letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
var marks = '';
var letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], marks = '';
for (i = 1; i < 9; i++) {
marks += '<span class="board_mark vert" style="bottom:' + (factor * i * 64 - 38 + base) + 'px;">' + i + '</span>';
marks += '<span class="board_mark horz" style="left:' + (factor * i * 64 - 35 + base) + 'px;">' + letters[i - 1] + '</span>';
}
$board.append(marks);
$board.remove('span.board_mark').append(marks);
};

function urlToLink(text) {
Expand Down

0 comments on commit 6f16a6c

Please sign in to comment.