From dd38b4f5f63172b543fa6f2dee624f72312e582b Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 26 Feb 2017 02:04:29 +0300 Subject: [PATCH] added keyboard generation --- html/Play/play.css | 13 +++++++++++++ html/game.js | 21 +++++++++++++++++++++ html/index.html | 8 ++++---- html/styles.css | 4 ++-- 4 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 html/Play/play.css diff --git a/html/Play/play.css b/html/Play/play.css new file mode 100644 index 0000000..f1c8caa --- /dev/null +++ b/html/Play/play.css @@ -0,0 +1,13 @@ +@font-face { + font-family: 'Play'; + src: url('Play-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'Play'; + src: url('Play-Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; +} diff --git a/html/game.js b/html/game.js index 4863081..edd8b6b 100644 --- a/html/game.js +++ b/html/game.js @@ -4,8 +4,29 @@ var lives = 6; var gameWord = words[Math.floor(Math.random() * words.length)].toUpperCase(); var gameAnswered = new Array(gameWord.length + 1).join('-'); +var keyboardLayouts = { + 'usQwertyKeyboard' : 'abcdefghijklmnopqrstuvwxyz'.toUpperCase(), + 'ruQwertyKeyboard' : 'йцукеёнгшщзхъфывапролджэячсмитьбю'.toUpperCase() +} + +// Функция генерации html кода клавиатуры +function generateKeyboard(layout) +{ + var htmlKeyboardStr = ''; + + keyboardLayouts[layout].split('').forEach(function(word) + { + htmlKeyboardStr = htmlKeyboardStr + ''; + }) + + document.getElementById("keyboard").innerHTML = htmlKeyboardStr; +} + window.onload = function() { + generateKeyboard('usQwertyKeyboard'); + console.log(gameWord) // for DEBUG document.getElementById("WORD").innerHTML = gameAnswered; document.getElementById("lives").innerHTML = 'Lives ' + lives; diff --git a/html/index.html b/html/index.html index 7e1fc9e..bbbfd10 100644 --- a/html/index.html +++ b/html/index.html @@ -10,7 +10,7 @@ hgman - + @@ -23,11 +23,11 @@ ... -
- +
+ ...
-
2017 by iiiypuk
+
2017 by iiiypuk
ver: 0.2.0
diff --git a/html/styles.css b/html/styles.css index 6b60d55..00a7a95 100644 --- a/html/styles.css +++ b/html/styles.css @@ -7,7 +7,7 @@ body { color: #032137; background-color: #29516D; - font-family: 'Vegur'; + font-family: 'Play'; font-size: 32px; } @@ -35,7 +35,7 @@ div.keyboard { div.keyboard button { color: #032137; - font-family: 'Vegur'; + font-family: 'Play'; border-radius: 4px; font-size: 16px; background-color: #708EA4;