Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mourhafkz authored Jul 30, 2024
1 parent 41dd922 commit e8537ba
Show file tree
Hide file tree
Showing 9 changed files with 409 additions and 0 deletions.
19 changes: 19 additions & 0 deletions flashcards/data/articles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"data": [
{
"task": "Hund",
"solution": "<div class=\"masculine line\">der</div><div class=\"line-break\"></div><div class=\"plural line\">die Hunde</div>",
"status": "0"
},
{
"task": "Katze",
"solution": "<div class=\"feminine line\">die</div><div class=\"line-break\"></div><div class=\"plural line\">die Katzen</div>",
"status": "0"
},
{
"task": "Haus",
"solution": "<div class=\"neuter line\">das</div><div class=\"line-break\"></div><div class=\"plural line\">die Häuser</div>",
"status": "0"
}
]
}
14 changes: 14 additions & 0 deletions flashcards/data/conjugates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"data": [
{
"verb": "sein <p class=\"tense\">present</p><p class=\"verb_meaning\">to be</p>",
"ich": "bi<span class=\"ending\">n</span>",
"du": "bis<span class=\"ending\">t</span>",
"er;sie;es": "is<span class=\"ending\">t</span>",
"wir": "sin<span class=\"ending\">d</span>",
"ihr": "sei<span class=\"ending\">d</span>",
"sie;Sie": "sin<span class=\"ending\">d</span>",
"status": "0"
}
]
}
1 change: 1 addition & 0 deletions flashcards/data/endings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data": [{"task": "ei", "solution": "<p>Feminine</p><p>die B\u00e4ckerei</p><p>die B\u00fccherei</p>", "status": "0"}, {"task": "in", "solution": "<p>Feminine</p><p>die Lehrerin</p><p>die Sch\u00fclerin</p>", "status": "0"}, {"task": "keit", "solution": "<p>Feminine</p><p>die \u00c4hnlichkeit</p><p>die M\u00f6glichkeit</p>", "status": "0"}, {"task": "heit", "solution": "<p>Feminine</p><p>die Gesundheit</p><p>die Freiheit</p>", "status": "0"}, {"task": "schaft", "solution": "<p>Feminine</p><p>die Wirtschaft</p><p>die Landschaft</p>", "status": "0"}, {"task": "ung", "solution": "<p>Feminine</p><p>die Heizung</p><p>die Meinung</p>", "status": "0"}, {"task": "a", "solution": "<p>Feminine</p><p>die Kamera</p><p>die Liga</p>", "status": "0"}, {"task": "ade", "solution": "<p>Feminine</p><p>die Parade</p><p>die Schokolade</p>", "status": "0"}, {"task": "ette", "solution": "<p>Feminine</p><p>die Toilette</p><p>die Zigarette</p>", "status": "0"}, {"task": "ie", "solution": "<p>Feminine</p><p>die Theorie</p><p>die Serie</p>", "status": "0"}, {"task": "ik", "solution": "<p>Feminine</p><p>die Musik</p><p>die Physik</p>", "status": "0"}, {"task": "ine", "solution": "<p>Feminine</p><p>die Maschine</p><p>die Blondine</p>", "status": "0"}, {"task": "ion", "solution": "<p>Feminine</p><p>die Kommunikation</p><p>die Produktion</p>", "status": "0"}, {"task": "t\u00e4t", "solution": "<p>Feminine</p><p>die Spezialit\u00e4t</p><p>die Qualit\u00e4t</p>", "status": "0"}, {"task": "ive", "solution": "<p>Feminine</p><p>die Alternative</p><p>die Perspektive</p>", "status": "0"}, {"task": "sis", "solution": "<p>Feminine</p><p>die Dosis</p><p>die Skepsis</p>", "status": "0"}, {"task": "ur", "solution": "<p>Feminine</p><p>die Natur</p><p>die Literatur</p>", "status": "0"}, {"task": "ig", "solution": "<p>m\u00e4nnlisch</p><p>der Honig</p><p>der K\u00f6nig</p>", "status": "0"}, {"task": "ling", "solution": "<p>m\u00e4nnlisch</p><p>der Zwilling</p><p>der Fr\u00fchling</p>", "status": "0"}, {"task": "ent", "solution": "<p>m\u00e4nnlisch</p><p>der Student</p><p>der Agent</p>", "status": "0"}, {"task": "ier", "solution": "<p>m\u00e4nnlisch</p><p>der Indonesier</p><p>der Juwelier</p>", "status": "0"}, {"task": "ismus", "solution": "<p>m\u00e4nnlisch</p><p>der Kapitalismus</p><p>der Optimismus</p>", "status": "0"}, {"task": "ist", "solution": "<p>m\u00e4nnlisch</p><p>der Buddhist</p><p>der Pianist</p>", "status": "0"}, {"task": "or", "solution": "<p>m\u00e4nnlisch</p><p>der Motor</p><p>der Chor</p>", "status": "0"}, {"task": "\u00f6r", "solution": "<p>m\u00e4nnlisch</p><p>der Fris\u00f6r</p><p>der Lik\u00f6r</p>", "status": "0"}, {"task": "iker", "solution": "<p>m\u00e4nnlisch</p><p>der Romantiker</p><p>der Chemiker</p>", "status": "0"}, {"task": "ast", "solution": "<p>m\u00e4nnlisch</p><p>der Gast</p><p>der Palast</p>", "status": "0"}, {"task": "eur", "solution": "<p>m\u00e4nnlisch</p><p>der Redakteur</p><p>der Ingenieur</p>", "status": "0"}, {"task": "chen", "solution": "<p>neutrale</p><p>das M\u00e4dchen</p><p>das Fl\u00e4schchen</p>", "status": "0"}, {"task": "lein", "solution": "<p>neutrale</p><p>das Fr\u00e4ulein</p><p>das B\u00e4chlein</p>", "status": "0"}, {"task": "tel", "solution": "<p>neutrale</p><p>das Hotel</p><p>das Viertel</p>", "status": "0"}, {"task": "tum", "solution": "<p>neutrale</p><p>das Eigentum</p><p>das Datum</p>", "status": "0"}, {"task": "in", "solution": "<p>neutrale</p><p>das Benzin</p><p>das Bewusstsein</p>", "status": "0"}, {"task": "o", "solution": "<p>neutrale</p><p>das Radio</p><p>das Auto</p>", "status": "0"}, {"task": "ing", "solution": "<p>neutrale</p><p>das Ding</p><p>das Meeting</p>", "status": "0"}, {"task": "um", "solution": "<p>neutrale</p><p>das Zentrum</p><p>das Museum</p>", "status": "0"}, {"task": "ma", "solution": "<p>neutrale</p><p>das Klima</p><p>das Drama</p>", "status": "0"}, {"task": "ment", "solution": "<p>neutrale</p><p>das Element</p><p>das Experiment</p>", "status": "0"}, {"task": "ett", "solution": "<p>neutrale</p><p>das Bett</p><p>das Omelett</p>", "status": "0"}, {"task": "Ge-", "solution": "<p>neutrale</p><p>das Geschlecht</p><p>das Gewitter</p>", "status": "0"}]}
14 changes: 14 additions & 0 deletions flashcards/data/phrases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"data": [
{
"task": "shcon",
"solution": "already",
"status": "0"
},
{
"task": "already",
"solution": "shcon",
"status": "0"
}
]
}
44 changes: 44 additions & 0 deletions flashcards/data/words.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"data": [
{
"task": "dog",
"solution": "<span class=\"masculine\">der</span> Hund",
"status": "0"
},
{
"task": "<span class=\"masculine\">der</span> Hund",
"solution": "dog",
"status": "0"
},
{
"task": "cat",
"solution": "<span class=\"feminine\">die</span> Katze",
"status": "0"
},
{
"task": "<span class=\"feminine\">die</span> Katze",
"solution": "cat",
"status": "0"
},
{
"task": "house",
"solution": "<span class=\"neuter\">das</span> Haus",
"status": "0"
},
{
"task": "<span class=\"neuter\">das</span> Haus",
"solution": "house",
"status": "0"
},
{
"task": "shcon",
"solution": "already",
"status": "0"
},
{
"task": "already",
"solution": "shcon",
"status": "0"
}
]
}
37 changes: 37 additions & 0 deletions flashcards/flashcards.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="script.js"></script>
<title>Flashcards</title>
<link rel="stylesheet" href="style.css">

</head>
<body>

<!-- <h1>My German Flashcards</h1> -->

<div class="card">
<div class="face front" id="front">
<p>Choose a task and hover here</p>
</div>
<div class="face back" id="back">
<p><img src="smiley.png" width="150" height="150"></p>
</div>
</div>

<div class="buttons_area">
<div class="buttons">
<input class="button" type = "button" id = "article_question" value = "Articles" /><br/>
<input class="button" type = "button" id = "phrase_question" value = "Phrases" /><br/>
<input class="button" type = "button" id = "word_question" value = "Meanings" /><br/>
<input class="button" type = "button" id = "conjugate_question" value = "Verb Conj" /><br/>
<input class="button" type = "button" id = "conjugation_table" value = "Verb Table" /><br/>
<input class="button" type = "button" id = "ending_table" value = "Endings" /><br/>
</div>
</div>


</body>
</html>
126 changes: 126 additions & 0 deletions flashcards/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
$(document).ready(function () {



function convert(obj) {
return Object.keys(obj).map(key => ({
field: key,
value: obj[key],
}));
}

function load_json(filename) {
var res = []
$.ajax({
url: filename,
async: false,
dataType: 'json',
success: function (json) {
res = json.data;
}
});
return res
}

function containsObject(obj, list) {
var i;
for (i = 0; i < list.length; i++) {
if (list[i] === obj) {
return true;
}
}

return false;
}

var articles = load_json('data/articles.json');
var phrases = load_json('data/phrases.json');
var words = load_json('data/words.json');
var conjugates = load_json('data/conjugates.json');
var conjugations = load_json('data/conjugates.json');
var endings = load_json('data/endings.json');


$("#article_question, #phrase_question, #word_question, #conjugate_question, #conjugation_table, #ending_table").click(function (event) {

expected_filename = $(this).attr('id').split('_')[0] + 's' //article_question to articles.json

var filename;
if (expected_filename == 'articles') { filename = articles; }
else if (expected_filename == 'phrases') { filename = phrases; }
else if (expected_filename == 'words') { filename = words; }
else if (expected_filename == 'conjugates') { filename = conjugates; }
else if (expected_filename == 'endings') { filename = endings; }
else if (expected_filename == 'conjugations') { filename = conjugations; }

if (filename.length == 0) {
$('#front').html('<p>No more cards for this task</p>');
$('#back').html('<p>Choose some other task</p>');
return false;
}

// pick random word
var random_entry = filename[Math.floor(Math.random() * filename.length)]


// if appeared before reclick
if (filename != conjugates) {
const index = filename.indexOf(random_entry);
if (index > -1) { // only splice array when item is found
filename.splice(index, 1); // 2nd parameter means remove one item only
}
// change button caption
caption = $(this).val().split('-')[0]
new_caption = caption + '-' + filename.length
$(this).val(new_caption)
}


// status 0 means not learned yet
if (random_entry.status == 0) {
if (filename == conjugates) {
// random pronoun from conjugation table
new_obj = convert(random_entry)
var random_key = new_obj[Math.floor(Math.random() * new_obj.length)]

if (random_key.field != "verb" && random_key.field != "status") {
$('#front').html('<div class="p_area"><p>' + random_key.field + ' ____</p><p class="tense_display">' + random_entry.verb + '</p></div>');
$('#back').html('<div class="p_area"><p>' + random_key.field + ' ' + random_key.value + '</p></div>');
} else {
// reclick the button if no a pronoun field
$("#conjugate_question").trigger('click');
}

} else if (filename == conjugations) {
$('#front').html('<div class="p_area"><p class="tense_display">' + random_entry.verb + '</p></div>');
html = '<div class="p_area">'
for (key in random_entry) {
if (key != "verb" && key != "status") {
html += "<p>" + key + " " + random_entry[key] + "</p>"
}
// console.log(random_entry[key])
}
$('#back').html(html + "</div>");
}
else if (filename == endings) {

$('#front').html('<p>' + random_entry.task + '</p>');

$('#back').html('<div class="p_area">' + random_entry.solution + "</div>");

}
else if (filename == articles) {

$('#front').html('<p>' + random_entry.task + '</p>');
$('#back').html(random_entry.solution);
}
else {
$('#front').html('<p>' + random_entry.task + '</p>');
$('#back').html('<p>' + random_entry.solution + '</p>');
}

}

});

});
Binary file added flashcards/smiley.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e8537ba

Please sign in to comment.