forked from Strongleong/Paintle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
182 lines (146 loc) · 6.1 KB
/
index.php
File metadata and controls
182 lines (146 loc) · 6.1 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
$lang = $_COOKIE['lang'] ?? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
if (!in_array($lang, ['en', 'ru'])) {
$lang = 'en';
}
if ($_GET['lang'] && in_array($_GET['lang'], ['en', 'ru'])) {
$lang = $_GET['lang'];
setcookie('lang', $lang, [
'expires' => time() + 86400,
'path' => '/',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);
}
$translations = require_once __DIR__ . '/translations.php';
?>
<!DOCTYPE html>
<html lang="<?= $lang ?>">
<head>
<title><?= i18n('title') ?></title>
<link rel="icon" type="image/x-icon" sizes="50x50" href="/favicon.ico">
<link rel="canonical" href="https://paintle.strongleong.ru">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?= i18n('description') ?>">
<meta name="og:title" property="og:title" content="<?= i18n('title') ?>">
<meta name="og:description" property="og:description" content="<?= i18n('description') ?>">
<meta name="og:image" property="og:image" content="https://paintle.strongleong.ru/img/logo.png">
<meta name="og:url" property="og:url" content="https://paintle.strongleong.ru">
<meta name="og:type" property="og:type" content="website">
<meta name="robots" content="index, nofollow">
<link href="css/style.css" rel="stylesheet">
<link href="css/nerdfonts.css" rel="stylesheet">
<script>
window.lang = "<?= $lang ?>";
window.errorMessages = {
jsonIsNotAnArray: "<?= i18n('errorMessagesJsonIsNotAnArray') ?>",
jsonIsNotValid: "<?= i18n('errorMessagesJsonIsNotValid') ?>",
uploadedFileWrongFile: "<?= i18n('errorMessagesUploadedFileWrongFile') ?>",
uploadedFileBadWord: "<?= i18n('errorMessagesUploadedFileBadWord') ?>",
};
</script>
</head>
<body>
<header>
<select title="<?= i18n('langSwitcher') ?>" id="lang-switcher">
<?php foreach($translations['langs'] as $key => $label) { ?>
<option value="<?= $key ?>" <?= $lang === $key ? 'selected' : '' ?>><?= $label ?></option>
<?php } ?>
</select>
<h1><?= i18n('appName') ?></h1>
<div class="icons">
<i title="<?= i18n('darkmodeTooltip') ?>" id="dark-mode" class="nf nf-oct-moon"></i>
<a title="<?= i18n('githubLinkTooltip') ?>" id="github-link" rel="nofollow" target="_blank" href="https://github.com/strongleong/paintle"
class="nf nf-md-github"></a>
</div>
</header>
<div class="content flex flex-col">
<section class="block flex flex-col">
<h3><?= i18n('wordleSolutionText') ?></h3>
<input id="solution" type="text" placeholder="<?= i18n('worldeSampleAnswer') ?>" maxlength="5" />
<button id="load-solution-button" class="button">
<span class="button-text"><?= i18n('loadSolutionButton') ?></span>
</button>
</section>
<section class="block flex flex-col">
<h3 id="heading-language"><?= i18n('wordlistLanguageSelectionText') ?></h3>
<select id="language">
<option id="wordlist-lang-en" value="en" <?= $lang === 'en' ? 'selected' : ''?>>
<?= i18n('wordlistLanguageEn') ?>
</option>
<option id="wordlist-lang-ru" value="ru" <?= $lang === 'ru' ? 'selected' : ''?>>
<?= i18n('wordlistLanguageRu') ?>
</option>
<option id="wordlist-lang-custom" value="own">
<?= i18n('wordlistLanguageCustom') ?>
</option>
</select>
</section>
<section class="block nodisplay flex flex-col" id="wordlist-input-block">
<div id="wordlist-input-heading" class="row"><?= i18n('wordlistInputText') ?></div>
<div class="row wordlist-hint">
<div class="grid">
<h4>JSON</h4>
<div></div>
<h4>TXT</h4>
<div><?= i18n('wordlistInputJson') ?></div>
<div class="or"><?= i18n('wordlistInputOr') ?></div>
<div><?= i18n('wordlistInputTxt') ?></div>
<code>
<div class="paren">[</div>
<div class="string">"word1",</div>
<div class="string">"word2",</div>
<div class="string">"word3"</div>
<div class="paren">]</div>
</code>
<div></div>
<code>
<div>word1</div>
<div>word2</div>
<div>word3</div>
</code>
</div>
</div>
<button id="wordlist-upload"><?= i18n('wordlistInputUpload') ?></button>
<input type="file" accept=".json,.txt" id="wordlist-input" class="nodisplay" />
<div id="wordlist-error" class="error"></div>
</section>
<main id="board" class="block flex flex-col">
<h2><?= i18n('mainText') ?></h2>
<?php for ($i = 0; $i < 6; $i++) { ?>
<div class="row flex">
<?php for ($j = 0; $j < 5; $j++) { ?>
<div class="cell noselect" style="--animation-order: <?= ($i * 6) + $j ?>;"></div>
<?php } ?>
</div>
<?php } ?>
<button id="board-reset-button"><?= i18n('boardResetButton') ?></button>
</main>
<section class="block flex flex-col">
<h3><?= i18n('colorPickerText') ?></h3>
<div class="row flex pallete">
<div class="cell noselect correct active" id="correct"></div>
<div class="cell noselect present" id="present"></div>
<div class="cell noselect absent" id="absent"></div>
</div>
</section>
<section class="block">
<label class="toggle">
<input class="toggle-checkbox" type="checkbox" id="colorblind-mode">
<div class="toggle-switch"></div>
<span class="toggle-label"><?= i18n('colorblindMode') ?></span>
</label>
</section>
<section class="row flex">
<button id="solve"><?= i18n('solveButton') ?></button>
</section>
</div>
<footer class="row flex">
<a title="<?= i18n('githubLinkTooltip') ?>" class="footer-link" rel="nofollow" href="https://github.com/strongleong/paintle"><?= i18n('footerSourceCode') ?></a>
<a title="MIT" class="footer-link" rel="nofollow" href="https://github.com/Strongleong/Paintle/blob/master/LICENSE"><?= i18n('footerLicense') ?></a>
</footer>
</body>
<script defer src="scripts/script.js"></script>
</html>