From 686bdf8ee15c75de56cddc897bf91773b4779fd9 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Sun, 8 Nov 2015 02:56:46 +0400 Subject: [PATCH] Online chess tips redesign. --- manifest.json | 2 +- scripts/chess_controller.js | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index 12e235f..57c2719 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/scripts/chess_controller.js b/scripts/chess_controller.js index a9bb1dc..9fa610f 100644 --- a/scripts/chess_controller.js +++ b/scripts/chess_controller.js @@ -262,6 +262,8 @@ $(document).ready(function() { // eChess version $('.title.bottom-4') + .before('
'); + $('#robot_text') .before($('', { 'id': 'robot_icon', 'style': 'float: left; cursor: pointer;', @@ -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);