From 9b0c0cc2ae5189d929e011878895886fe7bb7f88 Mon Sep 17 00:00:00 2001 From: Stephanie Gage Date: Wed, 8 Mar 2017 09:03:38 -0600 Subject: [PATCH] attempted the challenge using jQuery and CSS3 --- .gitignore | 4 +++ backend/templates/index.html | 9 ----- tic-tac-toe/css/styles.css | 65 ++++++++++++++++++++++++++++++++++ tic-tac-toe/index.html | 44 +++++++++++++++++++++++ tic-tac-toe/js/main.js | 67 ++++++++++++++++++++++++++++++++++++ ui/src/index.scss | 6 ---- ui/src/main.js | 8 ----- 7 files changed, 180 insertions(+), 23 deletions(-) delete mode 100644 backend/templates/index.html create mode 100644 tic-tac-toe/css/styles.css create mode 100644 tic-tac-toe/index.html create mode 100644 tic-tac-toe/js/main.js delete mode 100644 ui/src/index.scss delete mode 100644 ui/src/main.js diff --git a/.gitignore b/.gitignore index 3bb08fa..32b10dc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ __conda_version__.txt ui/node_modules/ ui/static/ +ui +backend +environment.yml +run.py diff --git a/backend/templates/index.html b/backend/templates/index.html deleted file mode 100644 index f16725b..0000000 --- a/backend/templates/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - Continuum UI Coding Challenge - - - - - + + + Continuum UI Coding Challenge + + + + + +
+

Tic Tac Toe

+

Current Player:

+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + += maxTurns) { + $('#alert').append("We have a Cat's Game!"); + return; + } + + // Switch to the other player + switchPlayer(); + } + + // Removes the event handler so they can't click it again + $(this).off('click'); + }); + + function isWinner(square1, square2, square3) { + return $(square1).text() && $(square1).text() === $(square2).text() && $(square2).text() === $(square3).text(); + } + + function switchPlayer() { + if (currentPlayer === playerOne) { + currentPlayer = playerTwo; + $('#playerNumber').text(currentPlayer); + + } else { + currentPlayer = playerOne; + $('#playerNumber').text(currentPlayer); + } + } + + // Reload page + $('#reset-btn').on('click', function(){ + window.location.reload(true); + // $('#board')location.reload(true); + }); + +}); // End of dom diff --git a/ui/src/index.scss b/ui/src/index.scss deleted file mode 100644 index b379756..0000000 --- a/ui/src/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -html { - background-color: #EFEFEF; - color: #222; - font-size: 1em; - line-height: 1.4; -} diff --git a/ui/src/main.js b/ui/src/main.js deleted file mode 100644 index eaa1c1d..0000000 --- a/ui/src/main.js +++ /dev/null @@ -1,8 +0,0 @@ -import './index.scss'; - -import { alertHello } from './hello'; - -document.addEventListener('DOMContentLoaded', function(event) { - let name = window.prompt('Who would you like to greet?'); - alertHello(name); -});