Skip to content

Commit

Permalink
Added 'Short Form Adjectives' exercise type
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletimmermans authored Aug 7, 2024
1 parent 937f9e0 commit 3f74574
Show file tree
Hide file tree
Showing 9 changed files with 758 additions and 44 deletions.
14 changes: 9 additions & 5 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@

<head>
<title>Ошибка 404</title>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google" content="notranslate">
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg">
<meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">
<meta name="author" content="Kyle Timmermans">
<meta name="description" content="Practice Russian grammar with exercises!">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#dc2f44">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="theme-color" content="#ffffff">
<link rel="manifest" href="/site.webmanifest">

<link rel="icon" type="image/svg+xml" href="/assets/img/favicon/favicon.svg">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/assets/img/favicon/safari-pinned-tab.svg" color="#dc2f44">
<link rel="manifest" href="/site.webmanifest">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P" rel="stylesheet">
</head>

<style>
Expand Down
77 changes: 74 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Keep track of JSON information
var jsonVerb, jsonNoun, jsonAdj, jsonPronoun;
var jsonPossess, jsonDemonst, jsonQuestion;
var jsonCompare,
correctAnswer,
fetchList = [];
var jsonCompare, jsonShortFormAdj;
var correctAnswer, fetchList = [];


// Start with verbs on site load
Expand Down Expand Up @@ -349,6 +348,34 @@ const randomComparative = (data) => {
};


const randomShortFormAdj = (data) => {
let randomShortFormAdj =
data.shortformadjective[getRandomInt(0, data.shortformadjective.length - 1)];

let gender = randomGender(true)[0];
let cyrillicPronoun;
switch (gender) {
case "m":
cyrillicPronoun = "Он";
break;
case "f":
cyrillicPronoun = "Она";
break;
case "n":
cyrillicPronoun = "Оно";
break;
case "p":
cyrillicPronoun = "Они";
break;
}

return [cyrillicPronoun,
randomShortFormAdj.name,
randomShortFormAdj.translation,
randomShortFormAdj.shortforms[gender]];
};


// Split point from random generators to fetchers \\


Expand Down Expand Up @@ -802,6 +829,47 @@ const comparative = () => {
};


const shortFormAdj = () => {
document.querySelector("#centered-title").textContent = "Short Form Adjectives";
var isError = false;

if (fetchList.includes("shortFormAdj") == false) {
fetch("/wordbank/short-form-adjectives.json")
.then((response) => response.json())
.then((data) => {
jsonShortFormAdj = data;
})
.catch((error) => {
isError = true;
console.error("Fetch error: ", error);
document.getElementsByClassName("alert-holder")[0].style.display = "block";
document.getElementById("question").textContent = "....";
setTimeout(() => {
shortFormAdj();
}, 3000);
})
.finally(() => {
if (!isError) {
fetchList.push("shortFormAdj");
document.getElementsByClassName("alert-holder")[0].style.display = "none";
let q = randomShortFormAdj(jsonShortFormAdj);
document.getElementById("question").innerHTML = q[0]+" <b>"+q[1]+"</b>"
+" (\""+q[2]+"\")";
correctAnswer = q[3];
}
});
} else {
let q = randomShortFormAdj(jsonShortFormAdj);
document.getElementById("question").innerHTML = q[0]+" <b>"+q[1]+"</b>"
+" (\""+q[2]+"\")";
correctAnswer = q[3];
}
};


// Breakpoint from fetchers to extra \\


const checkAnswer = () => {
let answer = document.getElementById("inputAnswer").value.toLowerCase();
if (answer.replace(/\s/g, "") == correctAnswer.toLowerCase()) {
Expand Down Expand Up @@ -885,6 +953,9 @@ const resetForm = (newQuestion) => {
case "Comparative Creation":
comparative();
break;
case "Short Form Adjectives":
shortFormAdj();
break;
default:
verb();
console.error("Something went wrong in resetForm()!");
Expand Down
10 changes: 5 additions & 5 deletions browserconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<browserconfig>
<msapplication>
<tile>
<square310x310logo src="/favicon/mstile-310x310.png"/>
<square310x150logo src="/favicon/mstile-310x150.png"/>
<square150x150logo src="/favicon/mstile-150x150.png"/>
<square144x144logo src="/favicon/mstile-144x144.png"/>
<square70x70logo src="/favicon/mstile-70x70.png"/>
<square310x310logo src="/assets/img/favicon/mstile-310x310.png"/>
<square310x150logo src="/assets/img/favicon/mstile-310x150.png"/>
<square150x150logo src="/assets/img/favicon/mstile-150x150.png"/>
<square144x144logo src="/assets/img/favicon/mstile-144x144.png"/>
<square70x70logo src="/assets/img/favicon/mstile-70x70.png"/>
<TileColor>#2b5797</TileColor>
</tile>
</msapplication>
Expand Down
40 changes: 27 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,45 @@
<html lang="en" translate="no">

<head>

<script type="text/javascript" src="/redirect.js" fetchpriority="high"></script>

<title>Russian Grammar Practice</title>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg">
<meta name="description" content="Practice Russian grammar with exercises!">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#dc2f44">
<meta name="author" content="Kyle Timmermans">
<meta name="description" content="A site for practicing Russian grammar with exercises. Поехали!">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="theme-color" content="#ffffff">

<meta property="og:title" content="Russian Grammar Practice">
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<meta property="og:url" content="https://www.russiangrammarpractice.com/">
<meta property="og:description" content="A site for practicing Russian grammar with exercises. Поехали!">
<meta property="og:image" content="https://www.russiangrammarpractice.com/assets/img/favicon/android-chrome-512x512.png">

<link rel="icon" type="image/svg+xml" href="/assets/img/favicon/favicon.svg">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/assets/img/favicon/safari-pinned-tab.svg" color="#dc2f44">
<link rel="manifest" href="/site.webmanifest">
<script>if(window.innerWidth<=768){window.location.replace("/mobile/");}</script>
<script src="/app.js"></script>
<link rel="stylesheet" href="/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<script type="text/javascript" src="/app.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
</head>

<style>
@font-face {
font-family: 'Regular';
src: url("/assets/fonts/regular.woff2") format('woff2');
}

body {
background-color: rgb(46, 56, 66); /* Putting this line in main.css breaks bootstrap color variables */
font-family: "Roboto", sans-serif !important;
font-family: 'Regular';
}

#centered-title { font-size: 2.95vw; }
Expand Down Expand Up @@ -74,6 +87,7 @@
<li><button class="dropdown-item" type="button" onclick="resetForm(false); demonstrative();">Demonstrative + Весь Cases</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); questionWord();">Question Word Cases</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); comparative();">Comparative Creation</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); shortFormAdj();">Short Form Adjectives</button></li>
</ul>
</div>

Expand Down
41 changes: 29 additions & 12 deletions mobile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,48 @@
<html lang="en" translate="no">

<head>

<script type="text/javascript" src="/redirect.js" fetchpriority="high"></script>

<title>Russian Grammar Practice</title>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg">
<meta name="description" content="Practice Russian grammar with exercises!">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#dc2f44">
<meta name="author" content="Kyle Timmermans">
<meta name="description" content="A site for practicing Russian grammar with exercises. Поехали!">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="theme-color" content="#ffffff">
<meta name="robots" content="noindex">
<meta name="googlebot" content="noindex">

<meta property="og:title" content="Russian Grammar Practice">
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<meta property="og:url" content="https://www.russiangrammarpractice.com/">
<meta property="og:description" content="A site for practicing Russian grammar with exercises. Поехали!">
<meta property="og:image" content="https://www.russiangrammarpractice.com/assets/img/favicon/android-chrome-512x512.png">

<link rel="icon" type="image/svg+xml" href="/assets/img/favicon/favicon.svg">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="mask-icon" href="/assets/img/favicon/safari-pinned-tab.svg" color="#dc2f44">
<link rel="manifest" href="/site.webmanifest">
<script>if(window.innerWidth>768){window.location.replace("/");}</script>
<script src="/app.js"></script>
<link rel="stylesheet" href="/main.css">

<link rel="canonical" href="https://www.russiangrammarpractice.com/">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<script type="text/javascript" src="/app.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
</head>

<style>
@font-face {
font-family: 'Regular';
src: url("/assets/fonts/regular.woff2") format('woff2');
}

body {
background-color: rgb(46, 56, 66); /* Putting this line in main.css breaks bootstrap color variables */
font-family: "Roboto", sans-serif !important;
font-family: 'Regular';
}

#centered-title {
Expand Down Expand Up @@ -89,6 +105,7 @@
<li><button class="dropdown-item" type="button" onclick="resetForm(false); demonstrative();">Demonstrative + Весь Cases</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); questionWord();">Question Word Cases</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); comparative();">Comparative Creation</button></li>
<li><button class="dropdown-item" type="button" onclick="resetForm(false); shortFormAdj();">Short Form Adjectives</button></li>
</ul>
</div>

Expand Down
16 changes: 16 additions & 0 deletions redirect.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@

User-agent: *
Allow: /$
Disallow: /favicon/
Disallow: /assets/
Disallow: /media/
Disallow: /mobile/
Disallow: /resources/
Disallow: /wordbank/
Disallow: /.gitignore
Disallow: /404.html
Disallow: /LICENSE
Disallow: /README.md
Disallow: /app.js
Expand Down
6 changes: 3 additions & 3 deletions site.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"short_name": "Russian Grammar Practice",
"icons": [
{
"src": "/favicon/android-chrome-192x192.png",
"src": "/assets/img/favicon/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/favicon/android-chrome-512x512.png",
"src": "/assets/img/favicon/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/favicon/maskable_icon.png",
"src": "/assets/img/favicon/maskable_icon.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
Expand Down
Loading

0 comments on commit 3f74574

Please sign in to comment.