forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
187 changed files
with
15,515 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
logs | ||
project/project | ||
project/target | ||
public/trans | ||
target | ||
RUNNING_PID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
jQuery(function() { | ||
SetImagePath("/vendor/pgn4web/lichess/64"); // use "" path if images are in the same folder as this javascript file | ||
SetImageType("png"); | ||
}); | ||
|
||
function customFunctionOnPgnGameLoad() { | ||
var $text = $('#ShowPgnText'); | ||
var html = '<table><tbody><tr>'; | ||
$text.find('span.move').remove(); | ||
$text.find('>span').each(function(it) { | ||
if (0 == it%2) { | ||
html += '</tr><tr><th>' + (it/2+1) + '.</th>'; | ||
} | ||
html += '<td>' + this.innerHTML + '</td>'; | ||
}); | ||
html += '</tr></tbody></table>'; | ||
$text.html(html).find('tr:empty').remove(); | ||
|
||
$('div.lichess_goodies a.rotate_board').click(function() { | ||
$('#GameBoard').toggleClass('flip'); | ||
$('#player_links div:first').appendTo($('#player_links')); | ||
redrawBoardMarks(); | ||
return false; | ||
}); | ||
redrawBoardMarks(); | ||
} | ||
|
||
function redrawBoardMarks() { | ||
jQuery.displayBoardMarks($('#GameBoard'), ! $('#GameBoard').hasClass('flip')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
if (typeof google.visualization == "undefined" ) { | ||
google.load("visualization", "1", {packages:["corechart"]}); | ||
} | ||
|
||
google.elemToData = function(elem) { | ||
var data = new google.visualization.DataTable(); | ||
$.each($(elem).data('columns'), function() { | ||
data.addColumn(this[0], this[1]); | ||
}); | ||
data.addRows($(elem).data('rows')); | ||
|
||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
$.widget("lichess.clock", { | ||
_create: function() { | ||
var self = this; | ||
this.options.time = parseFloat(this.options.time) * 1000; | ||
$.extend(this.options, { | ||
duration: this.options.time, | ||
state: 'ready' | ||
}); | ||
this.element.addClass('clock_enabled'); | ||
}, | ||
destroy: function() { | ||
this.stop(); | ||
$.Widget.prototype.destroy.apply(this); | ||
}, | ||
start: function() { | ||
var self = this; | ||
self.options.state = 'running'; | ||
self.element.addClass('running'); | ||
var end_time = new Date().getTime() + self.options.time; | ||
self.options.interval = setInterval(function() { | ||
if (self.options.state == 'running') { | ||
var current_time = Math.round(end_time - new Date().getTime()); | ||
if (current_time <= 0) { | ||
clearInterval(self.options.interval); | ||
current_time = 0; | ||
} | ||
|
||
self.options.time = current_time; | ||
self._show(); | ||
|
||
//If the timer completed, fire the buzzer callback | ||
current_time == 0 && $.isFunction(self.options.buzzer) && self.options.buzzer(self.element); | ||
} else { | ||
clearInterval(self.options.interval); | ||
} | ||
}, | ||
1000); | ||
}, | ||
|
||
setTime: function(time) { | ||
this.options.time = parseFloat(time) * 1000; | ||
this._show(); | ||
}, | ||
|
||
stop: function() { | ||
clearInterval(this.options.interval); | ||
this.options.state = 'stop'; | ||
this.element.removeClass('running'); | ||
}, | ||
|
||
_show: function() { | ||
this.element.text(this._formatDate(new Date(this.options.time))); | ||
}, | ||
|
||
_formatDate: function(date) { | ||
minutes = this._prefixInteger(date.getMinutes(), 2); | ||
seconds = this._prefixInteger(date.getSeconds(), 2); | ||
return minutes + ':' + seconds; | ||
}, | ||
|
||
_prefixInteger: function (num, length) { | ||
return (num / Math.pow(10, length)).toFixed(length).substr(2); | ||
} | ||
}); |
Oops, something went wrong.