diff --git a/.gitignore b/.gitignore index 41c6e40..21ebe94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ node_modules/ package-lock.json *.afdesign - -_media/css/chota.min.css diff --git a/TODO.md b/TODO.md index 4116f04..f3569c3 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,4 @@ +[ ] Loading page [ ] Localization [ ] Fix GAME tab for not refresh page [ ] Show word if lose diff --git a/_media/img/splash/splash-landscape-1136x640.png b/_media/img/splash/splash-landscape-1136x640.png deleted file mode 100644 index 0759bb9..0000000 Binary files a/_media/img/splash/splash-landscape-1136x640.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-1334x750.png b/_media/img/splash/splash-landscape-1334x750.png deleted file mode 100644 index 39ef73f..0000000 Binary files a/_media/img/splash/splash-landscape-1334x750.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-1792x828.png b/_media/img/splash/splash-landscape-1792x828.png deleted file mode 100644 index 8dd6005..0000000 Binary files a/_media/img/splash/splash-landscape-1792x828.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2048x1536.png b/_media/img/splash/splash-landscape-2048x1536.png deleted file mode 100644 index 6244bb6..0000000 Binary files a/_media/img/splash/splash-landscape-2048x1536.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2208x1242.png b/_media/img/splash/splash-landscape-2208x1242.png deleted file mode 100644 index 256e8f1..0000000 Binary files a/_media/img/splash/splash-landscape-2208x1242.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2224x1668.png b/_media/img/splash/splash-landscape-2224x1668.png deleted file mode 100644 index 4513272..0000000 Binary files a/_media/img/splash/splash-landscape-2224x1668.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2388x1668.png b/_media/img/splash/splash-landscape-2388x1668.png deleted file mode 100644 index 55ce7d7..0000000 Binary files a/_media/img/splash/splash-landscape-2388x1668.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2436x1125.png b/_media/img/splash/splash-landscape-2436x1125.png deleted file mode 100644 index 80ef697..0000000 Binary files a/_media/img/splash/splash-landscape-2436x1125.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2688x1242.png b/_media/img/splash/splash-landscape-2688x1242.png deleted file mode 100644 index 643a1c4..0000000 Binary files a/_media/img/splash/splash-landscape-2688x1242.png and /dev/null differ diff --git a/_media/img/splash/splash-landscape-2732x2048.png b/_media/img/splash/splash-landscape-2732x2048.png deleted file mode 100644 index 08d2448..0000000 Binary files a/_media/img/splash/splash-landscape-2732x2048.png and /dev/null differ diff --git a/_media/fonts/F5.6-Regular.eot b/docs/fonts/F5.6-Regular.eot similarity index 100% rename from _media/fonts/F5.6-Regular.eot rename to docs/fonts/F5.6-Regular.eot diff --git a/_media/fonts/F5.6-Regular.woff b/docs/fonts/F5.6-Regular.woff similarity index 100% rename from _media/fonts/F5.6-Regular.woff rename to docs/fonts/F5.6-Regular.woff diff --git a/_media/fonts/F5.6-Regular.woff2 b/docs/fonts/F5.6-Regular.woff2 similarity index 100% rename from _media/fonts/F5.6-Regular.woff2 rename to docs/fonts/F5.6-Regular.woff2 diff --git a/docs/game.js b/docs/game.js new file mode 100644 index 0000000..cee50d2 --- /dev/null +++ b/docs/game.js @@ -0,0 +1 @@ +"use strict";const pageCredits='\t

Font F5.6 by\t\tDOT COLON\t

\t\t

UI by\t\tchota.css\t

';"use strict";const pageStatistics='\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
User statistics
NameValue
Total games...
Guess words...
% Win...
Total letters clicked...
Correctly guessed letters...
% correctly letters...
\t

\t\tClear statistics\t

';function updateStatsPage(){let stTotalGames=localStorage.getItem("stTotalGames");let stWinWords=localStorage.getItem("stWinWords");let stWinPercentage=localStorage.getItem("stWinPercentage");let stLetterClick=localStorage.getItem("stLetterClick");let stCorrLetter=localStorage.getItem("stCorrLetter");let stWinLetterPercent=localStorage.getItem("stWinLetterPercent");document.querySelector("#stTotalGames").innerHTML=stTotalGames;document.querySelector("#stWinWords").innerHTML=stWinWords;document.querySelector("#stWinPercentage").innerHTML=Math.round(stWinWords/stTotalGames*100);document.querySelector("#stLetterClick").innerHTML=stLetterClick;document.querySelector("#stCorrLetter").innerHTML=stCorrLetter;document.querySelector("#stWinLetterPercent").innerHTML=Math.round(stCorrLetter/stLetterClick*100)}"use strict";function updateStats(statParameter){let stTotalGames=JSON.parse(localStorage.getItem("stTotalGames"));let stWinWords=JSON.parse(localStorage.getItem("stWinWords"));let stLetterClick=JSON.parse(localStorage.getItem("stLetterClick"));let stCorrLetter=JSON.parse(localStorage.getItem("stCorrLetter"));switch(statParameter){case"stTotalGames":localStorage.setItem("stTotalGames",stTotalGames+1);break;case"stWinWords":localStorage.setItem("stTotalGames",stTotalGames+1);localStorage.setItem("stWinWords",stWinWords+1);break;case"stLetterClick":localStorage.setItem("stLetterClick",stLetterClick+1);break;case"stCorrLetter":localStorage.setItem("stLetterClick",stLetterClick+1);localStorage.setItem("stCorrLetter",stCorrLetter+1);break;case"stCheck":if(stTotalGames==null){localStorage.setItem("stTotalGames",0)}if(stWinWords==null){localStorage.setItem("stWinWords",0)}if(stLetterClick==null){localStorage.setItem("stLetterClick",0)}if(stCorrLetter==null){localStorage.setItem("stCorrLetter",0)}break}}"use strict";const keyboardLayouts={usQwertyKeyboard:"abcdefghijklmnopqrstuvwxyz".toUpperCase(),ruQwertyKeyboard:"йцукеёнгшщзхъфывапролджэячсмитьбю".toUpperCase()};const words=["google","speed","design","forest","forever","love","horizon","defect"];let gameWord=words[Math.floor(Math.random()*words.length)].toUpperCase();let gameAnswered=new Array(gameWord.length+1).join("-");let lives=6;function generateKeyboard(layout){let keyboardHtmlStr="";layout.split("").forEach(function(letter){keyboardHtmlStr=keyboardHtmlStr+'"});let keyboard=document.querySelector("#keyboard");keyboard.classList.remove("is-hidden");document.querySelector("#keyboard").innerHTML=keyboardHtmlStr}function letterClick(letter){let charButton=document.getElementById(letter);charButton.disabled=true;let indices=[];let idx=gameWord.split("").indexOf(letter);if(idx==-1){wrongLetter();updateStats("stLetterClick");return}while(idx!=-1){indices.push(idx);idx=gameWord.split("").indexOf(letter,idx+1)}indices.forEach(function(item,indices){let wordArray=gameAnswered.split("");wordArray[item]=letter;gameAnswered=wordArray.join("");document.querySelector("#word").innerHTML=gameAnswered;updateStats("stCorrLetter")});if(gameAnswered.split("").indexOf("-")==-1){updateStats("stWinWords");document.querySelector("#keyboard").innerHTML='\t\t\t\t

Your winner!!

\t\t'}}function wrongLetter(){if(lives<=0){updateStats("stTotalGames");document.querySelector("#keyboard").innerHTML='\t\t\t\t

Your lose!!

\t\t'}lives-=1;document.querySelector("#lives").innerHTML="Lives "+lives}function showPage(element,pageName){["gameButton","statsButton","creditsButton"].forEach(function(item){document.querySelector("#"+item).classList.remove("active")});document.querySelector("#"+element.id).classList.add("active");document.querySelector("#content").innerHTML=pageName;if(pageName==pageStatistics){updateStatsPage()}}window.onload=function(){updateStats("stCheck");generateKeyboard(keyboardLayouts["usQwertyKeyboard"]);document.querySelector("#lives").innerHTML="Lives "+lives;console.log("Word:",gameWord.toLowerCase());document.querySelector("#word").innerHTML=gameAnswered;if(window.screen.availWidth<=599){document.querySelector("#lives").classList.remove("error");document.querySelector("#lives").classList.add("dark")}}; \ No newline at end of file diff --git a/_media/img/apple-launch-icon.png b/docs/images/apple-launch-icon.png similarity index 100% rename from _media/img/apple-launch-icon.png rename to docs/images/apple-launch-icon.png diff --git a/_media/img/apple-touch-icon.png b/docs/images/apple-touch-icon.png similarity index 100% rename from _media/img/apple-touch-icon.png rename to docs/images/apple-touch-icon.png diff --git a/_media/img/favicon.png b/docs/images/favicon.png similarity index 100% rename from _media/img/favicon.png rename to docs/images/favicon.png diff --git a/_media/img/splash/splash-portrait-1125x2436.png b/docs/images/splash/splash-portrait-1125x2436.png similarity index 100% rename from _media/img/splash/splash-portrait-1125x2436.png rename to docs/images/splash/splash-portrait-1125x2436.png diff --git a/_media/img/splash/splash-portrait-1242x2208.png b/docs/images/splash/splash-portrait-1242x2208.png similarity index 100% rename from _media/img/splash/splash-portrait-1242x2208.png rename to docs/images/splash/splash-portrait-1242x2208.png diff --git a/_media/img/splash/splash-portrait-1242x2688.png b/docs/images/splash/splash-portrait-1242x2688.png similarity index 100% rename from _media/img/splash/splash-portrait-1242x2688.png rename to docs/images/splash/splash-portrait-1242x2688.png diff --git a/_media/img/splash/splash-portrait-1536x2048.png b/docs/images/splash/splash-portrait-1536x2048.png similarity index 100% rename from _media/img/splash/splash-portrait-1536x2048.png rename to docs/images/splash/splash-portrait-1536x2048.png diff --git a/_media/img/splash/splash-portrait-1668x2224.png b/docs/images/splash/splash-portrait-1668x2224.png similarity index 100% rename from _media/img/splash/splash-portrait-1668x2224.png rename to docs/images/splash/splash-portrait-1668x2224.png diff --git a/_media/img/splash/splash-portrait-1668x2388.png b/docs/images/splash/splash-portrait-1668x2388.png similarity index 100% rename from _media/img/splash/splash-portrait-1668x2388.png rename to docs/images/splash/splash-portrait-1668x2388.png diff --git a/_media/img/splash/splash-portrait-2048x2732.png b/docs/images/splash/splash-portrait-2048x2732.png similarity index 100% rename from _media/img/splash/splash-portrait-2048x2732.png rename to docs/images/splash/splash-portrait-2048x2732.png diff --git a/_media/img/splash/splash-portrait-640x1136.png b/docs/images/splash/splash-portrait-640x1136.png similarity index 100% rename from _media/img/splash/splash-portrait-640x1136.png rename to docs/images/splash/splash-portrait-640x1136.png diff --git a/_media/img/splash/splash-portrait-750x1334.png b/docs/images/splash/splash-portrait-750x1334.png similarity index 100% rename from _media/img/splash/splash-portrait-750x1334.png rename to docs/images/splash/splash-portrait-750x1334.png diff --git a/_media/img/splash/splash-portrait-828x1792.png b/docs/images/splash/splash-portrait-828x1792.png similarity index 100% rename from _media/img/splash/splash-portrait-828x1792.png rename to docs/images/splash/splash-portrait-828x1792.png diff --git a/index.html b/docs/index.html similarity index 54% rename from index.html rename to docs/index.html index 9017fdc..35b564d 100644 --- a/index.html +++ b/docs/index.html @@ -9,8 +9,8 @@ WORDs - - + + @@ -20,17 +20,17 @@ - - - - - - - - - - - + + + + + + + + + + +
@@ -102,9 +102,6 @@ } - - - - + diff --git a/_media/css/styles.css b/docs/styles.css similarity index 55% rename from _media/css/styles.css rename to docs/styles.css index 73c0f3f..1c69c35 100644 --- a/_media/css/styles.css +++ b/docs/styles.css @@ -1,9 +1,9 @@ @font-face { font-family: 'F5.6'; - src: url('/hgman/_media/fonts/F5.6-Regular.eot'); - src: url('/hgman/_media/fonts/F5.6-Regular.eot?#iefix') format('embedded-opentype'), - url('/hgman/_media/fonts/F5.6-Regular.woff2') format('woff2'), - url('/hgman/_media/fonts/F5.6-Regular.woff') format('woff'); + src: url('fonts/F5.6-Regular.eot'); + src: url('fonts/F5.6-Regular.eot?#iefix') format('embedded-opentype'), + url('fonts/F5.6-Regular.woff2') format('woff2'), + url('fonts/F5.6-Regular.woff') format('woff'); font-weight: normal; font-style: normal; font-display: swap; diff --git a/js/pageCredits.js b/js/_pageCredits.js similarity index 100% rename from js/pageCredits.js rename to js/_pageCredits.js diff --git a/js/pageStatistics.js b/js/_pageStatistics.js similarity index 99% rename from js/pageStatistics.js rename to js/_pageStatistics.js index a31e9b9..c8d9a42 100644 --- a/js/pageStatistics.js +++ b/js/_pageStatistics.js @@ -1,4 +1,4 @@ -'use stheadict'; +'use strict'; const pageStatistics = '\ \ diff --git a/js/statFunction.js b/js/_statFunction.js similarity index 98% rename from js/statFunction.js rename to js/_statFunction.js index c07e719..80d6753 100644 --- a/js/statFunction.js +++ b/js/_statFunction.js @@ -1,3 +1,5 @@ +'use strict'; + function updateStats(statParameter) { let stTotalGames = JSON.parse(localStorage.getItem('stTotalGames')); diff --git a/js/game.js b/js/index.js similarity index 100% rename from js/game.js rename to js/index.js diff --git a/package.json b/package.json index 08892d2..648d5e3 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,10 @@ "chota": "0.8.0" }, "scripts": { - "server": "python3.7 -m http.server --directory ." + "build": "uglifyjs js/_* js/index.js -o docs/game.js", + "server": "python3.7 -m http.server --directory ./docs/" + }, + "devDependencies": { + "uglify-js": "^3.12.8" } }