Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
Online chess tips redesign.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkz committed Nov 7, 2015
1 parent cd176f4 commit 686bdf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_appName__",
"version": "0.4.1",
"version": "0.4.2",
"description": "__MSG_appDescription__",
"homepage_url": "http://re-coders.com/chessbot",
"default_locale": "en",
Expand Down
30 changes: 16 additions & 14 deletions scripts/chess_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ $(document).ready(function() {

// eChess version
$('.title.bottom-4')
.before('<div id="robot_notice" title="Click me to enable/disable bot suggestions." class="notice bottom-8" style="cursor: pointer; height: 20px;"><span id="robot_text"></span></div>');
$('#robot_text')
.before($('<img>', {
'id': 'robot_icon',
'style': 'float: left; cursor: pointer;',
Expand All @@ -270,37 +272,37 @@ $(document).ready(function() {
'title': 'Click me to enable/disable bot suggestions.'
}));

$('#robot_icon')
$('#robot_notice')
.on('click', function(e) {
$('.title.bottom-4').toggle();
$('#robot_text').toggle();
var $this = $(this);
if ($this.hasClass('norobot')) {
$this.attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/robot-20.png');
$this.removeClass('norobot');
$this.children('img').attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/robot-20.png');
$this.removeClass('norobot').addClass('success');
cookie.set(eChessCookie, '1');
} else {
$this.attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/norobot-20.png');
$this.addClass('norobot');
$this.children('img').attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/norobot-20.png');
$this.addClass('norobot').removeClass('success');
cookie.set(eChessCookie, '0');
}
return false;
});

(function(){
var $this = $('#robot_icon');
var $this = $('#robot_notice');
if (cookie.get(eChessCookie) == '0') {
$this.attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/norobot-20.png');
$this.addClass('norobot');
$('.title.bottom-4').hide();
$this.children('img').attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/norobot-20.png');
$this.addClass('norobot').removeClass('success');
$('#robot_text').hide();
} else {
$this.attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/robot-20.png');
$this.removeClass('norobot');
$('.title.bottom-4').show();
$this.children('img').attr('src', 'https://raw.githubusercontent.com/recoders/chessbot/master/images/robot-20.png');
$this.removeClass('norobot').addClass('success');
$('#robot_text').show();
}
})();

bot.moveFound = function (move) {
$('.title.bottom-4').text('I suggest: ' + move);
$('#robot_text').text('I suggest: ' + move);
};
var fen = bot.getCurrentFen();
bot.makeMove(fen);
Expand Down

0 comments on commit 686bdf8

Please sign in to comment.