├── _config.yml
├── static
├── image
│ ├── ab.jpg
│ ├── cn.jpg
│ ├── mimi.jpg
│ ├── wh.png
│ ├── ClickBefore.png
│ └── AfterClicking.png
├── music
│ ├── end.mp3
│ ├── err.mp3
│ └── tap.mp3
├── index-ab.css
├── index-cn.css
├── index-wh.css
├── index-mimi.css
├── index.css
└── index.js
├── kano.sql
├── README.md
├── index.html
├── index-ab.html
├── index-cn.html
├── index-mimi.html
└── index-wh.html
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
--------------------------------------------------------------------------------
/static/image/ab.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/ab.jpg
--------------------------------------------------------------------------------
/static/image/cn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/cn.jpg
--------------------------------------------------------------------------------
/static/image/mimi.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/mimi.jpg
--------------------------------------------------------------------------------
/static/image/wh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/wh.png
--------------------------------------------------------------------------------
/static/music/end.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/music/end.mp3
--------------------------------------------------------------------------------
/static/music/err.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/music/err.mp3
--------------------------------------------------------------------------------
/static/music/tap.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/music/tap.mp3
--------------------------------------------------------------------------------
/static/image/ClickBefore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/ClickBefore.png
--------------------------------------------------------------------------------
/static/image/AfterClicking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/EatRui/main/static/image/AfterClicking.png
--------------------------------------------------------------------------------
/kano.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `kano_rank`;
2 | CREATE TABLE `kano_rank` (
3 | `id` int(11) NOT NULL AUTO_INCREMENT,
4 | `score` int(11) NOT NULL,
5 | `name` varchar(255) NOT NULL,
6 | `time` datetime NOT NULL,
7 | `system` varchar(255) NOT NULL,
8 | `area` varchar(255) NOT NULL,
9 | `message` varchar(255) NOT NULL,
10 | `attempts` int(11) NOT NULL,
11 | PRIMARY KEY (`id`),
12 | UNIQUE (`name`)
13 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Welcome to GitHub Pages
2 |
3 | You can use the [editor on GitHub](https://github.com/Deyi233/EatRui/edit/main/README.md) to maintain and preview the content for your website in Markdown files.
4 |
5 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
6 |
7 | ### Markdown
8 |
9 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
10 |
11 | ```markdown
12 | Syntax highlighted code block
13 |
14 | # Header 1
15 | ## Header 2
16 | ### Header 3
17 |
18 | - Bulleted
19 | - List
20 |
21 | 1. Numbered
22 | 2. List
23 |
24 | **Bold** and _Italic_ and `Code` text
25 |
26 | [Link](url) and 
27 | ```
28 |
29 | For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
30 |
31 | ### Jekyll Themes
32 |
33 | Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/Deyi233/EatRui/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
34 |
35 | ### Support or Contact
36 |
37 | Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out.
38 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ');
9 | var body, blockSize, GameLayer = [],
10 | GameLayerBG, touchArea = [],
11 | GameTimeLayer;
12 | var transform, transitionDuration;
13 |
14 | function init() {
15 | showWelcomeLayer();
16 | body = document.getElementById('gameBody') || document.body;
17 | body.style.height = window.innerHeight + 'px';
18 | transform = typeof (body.style.webkitTransform) != 'undefined' ? 'webkitTransform' : (typeof (body.style.msTransform) !=
19 | 'undefined' ? 'msTransform' : 'transform');
20 | transitionDuration = transform.replace(/ransform/g, 'ransitionDuration');
21 | GameTimeLayer = document.getElementById('GameTimeLayer');
22 | GameLayer.push(document.getElementById('GameLayer1'));
23 | GameLayer[0].children = GameLayer[0].querySelectorAll('div');
24 | GameLayer.push(document.getElementById('GameLayer2'));
25 | GameLayer[1].children = GameLayer[1].querySelectorAll('div');
26 | GameLayerBG = document.getElementById('GameLayerBG');
27 | if (GameLayerBG.ontouchstart === null) {
28 | GameLayerBG.ontouchstart = gameTapEvent;
29 | } else {
30 | GameLayerBG.onmousedown = gameTapEvent;
31 | }
32 | gameInit();
33 | var username = cookie("username");
34 | var message = cookie("message");
35 | if (username){
36 | document.getElementById("username").value = username;
37 | }
38 | if (message){
39 | document.getElementById("message").value = message;
40 | }
41 | window.addEventListener('resize', refreshSize, false);
42 | var btn = document.getElementById('ready-btn');
43 | btn.className = 'btn btn-primary btn-lg';
44 | btn.onclick = function () {
45 | closeWelcomeLayer();
46 | }
47 | }
48 |
49 | function winOpen() {
50 | window.open(location.href + '?r=' + Math.random(), 'nWin', 'height=500,width=320,toolbar=no,menubar=no,scrollbars=no');
51 | var opened = window.open('about:blank', '_self');
52 | opened.opener = null;
53 | opened.close();
54 | }
55 | var refreshSizeTime;
56 |
57 | function refreshSize() {
58 | clearTimeout(refreshSizeTime);
59 | refreshSizeTime = setTimeout(_refreshSize, 200);
60 | }
61 |
62 | function _refreshSize() {
63 | countBlockSize();
64 | for (var i = 0; i < GameLayer.length; i++) {
65 | var box = GameLayer[i];
66 | for (var j = 0; j < box.children.length; j++) {
67 | var r = box.children[j],
68 | rstyle = r.style;
69 | rstyle.left = (j % 4) * blockSize + 'px';
70 | rstyle.bottom = Math.floor(j / 4) * blockSize + 'px';
71 | rstyle.width = blockSize + 'px';
72 | rstyle.height = blockSize + 'px';
73 | }
74 | }
75 | var f, a;
76 | if (GameLayer[0].y > GameLayer[1].y) {
77 | f = GameLayer[0];
78 | a = GameLayer[1];
79 | } else {
80 | f = GameLayer[1];
81 | a = GameLayer[0];
82 | }
83 | var y = ((_gameBBListIndex) % 10) * blockSize;
84 | f.y = y;
85 | f.style[transform] = 'translate3D(0,' + f.y + 'px,0)';
86 | a.y = -blockSize * Math.floor(f.children.length / 4) + y;
87 | a.style[transform] = 'translate3D(0,' + a.y + 'px,0)';
88 | }
89 |
90 | function countBlockSize() {
91 | blockSize = body.offsetWidth / 4;
92 | body.style.height = window.innerHeight + 'px';
93 | GameLayerBG.style.height = window.innerHeight + 'px';
94 | touchArea[0] = window.innerHeight - blockSize * 0;
95 | touchArea[1] = window.innerHeight - blockSize * 3;
96 | }
97 | var _gameBBList = [],
98 | _gameBBListIndex = 0,
99 | _gameOver = false,
100 | _gameStart = false,
101 | _gameTime, _gameTimeNum, _gameScore;
102 |
103 | function gameInit() {
104 | createjs.Sound.registerSound({
105 | src: "./static/music/err.mp3",
106 | id: "err"
107 | });
108 | createjs.Sound.registerSound({
109 | src: "./static/music/end.mp3",
110 | id: "end"
111 | });
112 | createjs.Sound.registerSound({
113 | src: "./static/music/tap.mp3",
114 | id: "tap"
115 | });
116 | gameRestart();
117 | }
118 |
119 | function gameRestart() {
120 | _gameBBList = [];
121 | _gameBBListIndex = 0;
122 | _gameScore = 0;
123 | _gameOver = false;
124 | _gameStart = false;
125 | _gameTimeNum = 20;
126 | GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
127 | countBlockSize();
128 | refreshGameLayer(GameLayer[0]);
129 | refreshGameLayer(GameLayer[1], 1);
130 | }
131 |
132 | function gameStart() {
133 | _date1 = new Date();
134 | _gameStart = true;
135 | _gameTime = setInterval(gameTime, 1000);
136 | }
137 |
138 | function gameOver() {
139 | _gameOver = true;
140 | clearInterval(_gameTime);
141 | setTimeout(function () {
142 | GameLayerBG.className = '';
143 | showGameScoreLayer();
144 | }, 1500);
145 | }
146 |
147 |
148 | function encrypt(text){
149 | var encrypt = new JSEncrypt();
150 | encrypt.setPublicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTzGwX6FVKc7rDiyF3H+jKpBlRCV4jOiJ4JR33qZPVXx8ahW6brdBF9H1vdHBAyO6AeYBumKIyunXP9xzvs1qJdRNhNoVwHCwGDu7TA+U4M7G9FArDG0Y6k4LbS0Ks9zeRBMiWkW53yQlPshhtOxXCuZZOMLqk1vEvTCODYYqX5QIDAQAB");
151 | var data = encrypt.encrypt(text);
152 | return data;
153 | }
154 |
155 | function SubmitResults() {
156 | var system = "其他操作系统";
157 | var area = "异世界";
158 | if (document.getElementById("username").value) {
159 | if (navigator.appVersion.indexOf("Win") != -1) system = "Windows";
160 | if (navigator.appVersion.indexOf("Mac") != -1) system = "Macintosh";
161 | if (navigator.appVersion.indexOf("Linux") != -1) system = "Linux";
162 | if (navigator.appVersion.indexOf("Android") != -1) system = "Android";
163 | if (navigator.appVersion.indexOf("like Mac") != -1) system = "iOS";
164 | if (returnCitySN['cname']) { area = returnCitySN['cname'] };
165 | var httpRequest = new XMLHttpRequest();
166 | httpRequest.open('POST', './SubmitResults.php', true);
167 | httpRequest.setRequestHeader("Content-type", "application/json");
168 | var name = document.getElementById("username").value;
169 | var message = document.getElementById("message").value;
170 | var test="|_|";
171 | httpRequest.send(encrypt(_gameScore + test + name + test + tj + test + system + test + area + test + message));
172 | }
173 | }
174 |
175 | function gameTime() {
176 | _gameTimeNum--;
177 | if (_gameTimeNum <= 0) {
178 | GameTimeLayer.innerHTML = ' 时间到!';
179 | gameOver();
180 | GameLayerBG.className += ' flash';
181 | createjs.Sound.play("end");
182 | } else {
183 | GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
184 | }
185 | }
186 |
187 | function creatTimeText(n) {
188 | return ' TIME:'+n;
189 | }
190 | var _ttreg = / t{1,2}(\d+)/,
191 | _clearttClsReg = / t{1,2}\d+| bad/;
192 |
193 | function refreshGameLayer(box, loop, offset) {
194 | var i = Math.floor(Math.random() * 1000) % 4 + (loop ? 0 : 4);
195 | for (var j = 0; j < box.children.length; j++) {
196 | var r = box.children[j],
197 | rstyle = r.style;
198 | rstyle.left = (j % 4) * blockSize + 'px';
199 | rstyle.bottom = Math.floor(j / 4) * blockSize + 'px';
200 | rstyle.width = blockSize + 'px';
201 | rstyle.height = blockSize + 'px';
202 | r.className = r.className.replace(_clearttClsReg, '');
203 | if (i == j) {
204 | _gameBBList.push({
205 | cell: i % 4,
206 | id: r.id
207 | });
208 | r.className += ' t' + (Math.floor(Math.random() * 1000) % 5 + 1);
209 | r.notEmpty = true;
210 | i = (Math.floor(j / 4) + 1) * 4 + Math.floor(Math.random() * 1000) % 4;
211 | } else {
212 | r.notEmpty = false;
213 | }
214 | }
215 | if (loop) {
216 | box.style.webkitTransitionDuration = '0ms';
217 | box.style.display = 'none';
218 | box.y = -blockSize * (Math.floor(box.children.length / 4) + (offset || 0)) * loop;
219 | setTimeout(function () {
220 | box.style[transform] = 'translate3D(0,' + box.y + 'px,0)';
221 | setTimeout(function () {
222 | box.style.display = 'block';
223 | }, 100);
224 | }, 200);
225 | } else {
226 | box.y = 0;
227 | box.style[transform] = 'translate3D(0,' + box.y + 'px,0)';
228 | }
229 | box.style[transitionDuration] = '150ms';
230 | }
231 |
232 | function gameLayerMoveNextRow() {
233 | for (var i = 0; i < GameLayer.length; i++) {
234 | var g = GameLayer[i];
235 | g.y += blockSize;
236 | if (g.y > blockSize * (Math.floor(g.children.length / 4))) {
237 | refreshGameLayer(g, 1, -1);
238 | } else {
239 | g.style[transform] = 'translate3D(0,' + g.y + 'px,0)';
240 | }
241 | }
242 | }
243 |
244 | function gameTapEvent(e) {
245 | if (_gameOver) {
246 | return false;
247 | }
248 | var tar = e.target;
249 | var y = e.clientY || e.targetTouches[0].clientY,
250 | x = (e.clientX || e.targetTouches[0].clientX) - body.offsetLeft,
251 | p = _gameBBList[_gameBBListIndex];
252 | if (y > touchArea[0] || y < touchArea[1]) {
253 | return false;
254 | }
255 | if ((p.id == tar.id && tar.notEmpty) || (p.cell == 0 && x < blockSize) || (p.cell == 1 && x > blockSize && x < 2 *
256 | blockSize) || (p.cell == 2 && x > 2 * blockSize && x < 3 * blockSize) || (p.cell == 3 && x > 3 * blockSize)) {
257 | if (!_gameStart) {
258 | gameStart();
259 | }
260 | createjs.Sound.play("tap");
261 | tar = document.getElementById(p.id);
262 | tar.className = tar.className.replace(_ttreg, ' tt$1');
263 | _gameBBListIndex++;
264 | _gameScore++;
265 | gameLayerMoveNextRow();
266 | } else if (_gameStart && !tar.notEmpty) {
267 | createjs.Sound.play("err");
268 | gameOver();
269 | tar.className += ' bad';
270 | }
271 | return false;
272 | }
273 |
274 | function createGameLayer() {
275 | var html = '
';
276 | for (var i = 1; i <= 2; i++) {
277 | var id = 'GameLayer' + i;
278 | html += '
';
279 | for (var j = 0; j < 10; j++) {
280 | for (var k = 0; k < 4; k++) {
281 | html += '
';
283 | }
284 | }
285 | html += '
';
286 | }
287 | html += '
';
288 | html += '
';
289 | return html;
290 | }
291 |
292 | function closeWelcomeLayer() {
293 | var l = document.getElementById('welcome');
294 | l.style.display = 'none';
295 | }
296 |
297 | function showWelcomeLayer() {
298 | var l = document.getElementById('welcome');
299 | l.style.display = 'block';
300 | }
301 |
302 | function showGameScoreLayer() {
303 | var l = document.getElementById('GameScoreLayer');
304 | var c = document.getElementById(_gameBBList[_gameBBListIndex - 1].id).className.match(_ttreg)[1];
305 | l.className = l.className.replace(/bgc\d/, 'bgc' + c);
306 | document.getElementById('GameScoreLayer-text').innerHTML = shareText(_gameScore);
307 | var score_text='得分 ';
308 | score_text+=deviation_time<23000?_gameScore:"
"+_gameScore+"";
309 | document.getElementById('GameScoreLayer-score').innerHTML = score_text;
310 | var bast = cookie('bast-score');
311 | if(deviation_time<23000){
312 | if (!bast || _gameScore > bast) {
313 | bast = _gameScore;
314 | cookie('bast-score', bast, 100);
315 | }
316 | }
317 | document.getElementById('GameScoreLayer-bast').innerHTML = '最佳 ' + bast;
318 | l.style.display = 'block';
319 | }
320 |
321 | function hideGameScoreLayer() {
322 | var l = document.getElementById('GameScoreLayer');
323 | l.style.display = 'none';
324 | }
325 |
326 | function replayBtn() {
327 | gameRestart();
328 | hideGameScoreLayer();
329 | }
330 |
331 | function backBtn() {
332 | gameRestart();
333 | hideGameScoreLayer();
334 | showWelcomeLayer();
335 | }
336 |
337 | function shareText(score) {
338 | var date2 = new Date();
339 | deviation_time = (date2.getTime() - _date1.getTime())
340 | if (deviation_time > 23000) {
341 | return '倒计时多了' + ((deviation_time / 1000) - 20).toFixed(2) + "s";
342 | }
343 | SubmitResults();
344 | if (score <= 49) return '叔叔很生气';
345 | if (score <= 99) return '你所热爱的就是你的生活';
346 | if (score <= 149) return '您就是蒙古上单?';
347 | if (score <= 199) return '您马什么时候4啊?';
348 | return '人?';
349 | }
350 |
351 | function toStr(obj) {
352 | if (typeof obj == 'object') {
353 | return JSON.stringify(obj);
354 | } else {
355 | return obj;
356 | }
357 | return '';
358 | }
359 |
360 | function cookie(name, value, time) {
361 | if (name) {
362 | if (value) {
363 | if (time) {
364 | var date = new Date();
365 | date.setTime(date.getTime() + 864e5 * time), time = date.toGMTString();
366 | }
367 | return document.cookie = name + "=" + escape(toStr(value)) + (time ? "; expires=" + time + (arguments[3] ?
368 | "; domain=" + arguments[3] + (arguments[4] ? "; path=" + arguments[4] + (arguments[5] ? "; secure" : "") : "") :
369 | "") : ""), !0;
370 | }
371 | return value = document.cookie.match("(?:^|;)\\s*" + name.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") + "=([^;]*)"),
372 | value = value && "string" == typeof value[1] ? unescape(value[1]) : !1, (/^(\{|\[).+\}|\]$/.test(value) ||
373 | /^[0-9]+$/g.test(value)) && eval("value=" + value), value;
374 | }
375 | var data = {};
376 | value = document.cookie.replace(/\s/g, "").split(";");
377 | for (var i = 0; value.length > i; i++) name = value[i].split("="), name[1] && (data[name[0]] = unescape(name[1]));
378 | return data;
379 | }
380 | document.write(createGameLayer());
381 |
382 |
383 | function show_btn() {
384 | document.getElementById("btn_group").style.display = "block"
385 | document.getElementById("setting").style.display = "none"
386 | }
387 | function show_setting() {
388 | document.getElementById("btn_group").style.display = "none"
389 | document.getElementById("setting").style.display = "block"
390 | }
391 | function save_cookie() {
392 | cookie('username', document.getElementById("username").value, 100);
393 | cookie('message', document.getElementById("message").value, 100);
394 | }
395 | function isnull(val) {
396 | var str = val.replace(/(^\s*)|(\s*$)/g, '');
397 | if (str == '' || str == undefined || str == null) {
398 | return true;
399 | } else {
400 | return false;
401 | }
402 | }
403 | function goRank() {
404 | var name=document.getElementById("username").value;
405 | var link='./rank.php';
406 | if(!isnull(name)){
407 | link+="?name="+name;
408 | }
409 | window.location.href=link;
410 | }
411 | console.log("不修改,好嘛?乱传又有什么用呢?(ˉ▽ˉ;)...")
412 | document.onkeydown = function (e) {
413 | if (e.keyCode == 123) {
414 | return false
415 | }
416 | };
417 |
--------------------------------------------------------------------------------