-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathayarlar.html
executable file
·72 lines (64 loc) · 2.51 KB
/
ayarlar.html
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
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Hoop settings page">
<meta name="author" content="Emre Pişkin">
<title>Hoop — Emre Pişkin</title>
<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=Pangolin&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body style="padding: 1rem">
<button type="button" onclick="saveSentences()">Kaydet</button>
<button type="button" onclick="restoreSentences()">Tüm değişiklikleri geri al</button>
<br/>
<textarea id="text-1" rows="5"></textarea><br/>
<textarea id="text-2" rows="5"></textarea><br/>
<textarea id="text-3" rows="5"></textarea><br/>
<textarea id="text-4" rows="5"></textarea><br/>
<textarea id="text-5" rows="5"></textarea><br/>
<textarea id="text-6" rows="5"></textarea><br/>
<textarea id="text-7" rows="5"></textarea>
<script type="text/javascript" src="cumle-kaliplari.js"></script>
<script type="text/javascript">
const loadSentences = () => {
let groups = JSON.parse(localStorage.getItem('groups'))
if (!groups) {
console.log('"groups" local storage not found. Loading from groupsInitial...')
groups = groupsInitial
} else {
console.log('"groups" is loaded from local storage:', groups)
}
Array.prototype.forEach.call(groups, function (group, index) {
document.querySelector('#text-' + ++index).innerHTML = group.join('\n')
})
}
const restoreSentences = () => {
if (confirm('Tüm cümle kalıplarınızı silmek istediğinize emin misiniz? Bu işlemden sonra ön tanımlı kalıplar kullanılacak.')) {
localStorage.removeItem('groups')
console.log('Restoration is completed.')
loadSentences()
} else {
console.log('Restoration is cancelled.')
}
}
const saveSentences = () => {
let groups = []
for (let i = 1; i < 8; i++) {
let group = document.querySelector('#text-' + i).value
group = group.split('\n')
console.log('Pushing group:', i, group)
groups.push(group)
}
localStorage.setItem('groups', JSON.stringify(groups))
console.log('Saved "groups" into local storage.')
alert('Hoop! Kalıplarınız kaydedildi.')
}
loadSentences()
</script>
</body>
</html>