-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtense-rules.js
More file actions
66 lines (60 loc) · 2.31 KB
/
Copy pathtense-rules.js
File metadata and controls
66 lines (60 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(() => {
const tenses = [
{
title: "Present Simple 1/5",
rule: "Use it for habits, routines, facts, and regular actions. (I/you/we/they + base verb).",
example: "I go to the gym on Mondays.",
signals: "always, usually, often, sometimes, never, every day/week"
},
{
title: "Past Simple 2/5",
rule: "Use it for finished actions in the past. Time is finished (yesterday, last week...).",
example: "We went to Paris yesterday.",
signals: "yesterday, last night, last week, in 2020, two days ago"
},
{
title: "Present Perfect 3/5",
rule: "Use it for life experience, recent actions with a result now, or actions that started in the past and continue now. (have/has + past participle).",
example: "I have been to London three times.",
signals: "ever, never, already, yet, just, since, for, recently"
},
{
title: "Present Continuous 4/5",
rule: "Use it for actions happening now or temporary situations. (am/is/are + verb-ing).",
example: "I am studying right now.",
signals: "now, right now, at the moment, today"
},
{
title: "Future, will 5/5",
rule: "Use it for quick decisions, predictions, promises, and offers. (will + base verb).",
example: "I will call you later.",
signals: "tomorrow, later, soon, I think..., probably"
}
];
let index = 0;
function renderCard(elements) {
const tense = tenses[index];
elements.title.textContent = `(${tense.title})`;
elements.rule.textContent = tense.rule;
elements.example.textContent = tense.example;
elements.signals.textContent = tense.signals;
}
document.addEventListener("DOMContentLoaded", () => {
const elements = {
title: document.getElementById("tenseTitle"),
rule: document.getElementById("tenseRule"),
example: document.getElementById("tenseExample"),
signals: document.getElementById("tenseSignals"),
nextButton: document.getElementById("nextTense")
};
if (!elements.title || !elements.rule || !elements.example || !elements.signals || !elements.nextButton) {
return;
}
elements.nextButton.addEventListener("click", () => {
index += 1;
if (index >= tenses.length) index = 0;
renderCard(elements);
});
renderCard(elements);
});
})();