-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
503 lines (439 loc) · 14.2 KB
/
Copy pathindex.html
File metadata and controls
503 lines (439 loc) · 14.2 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="initial-scale=1">
<meta name="keywords" content="扫雷, HTML游戏">
<meta name="description" content="本网页游戏为经典扫雷游戏,并略作改进,在电脑或手机上打开网页就可以玩,无需下载安装。增加了满屏级别,自适应屏幕大小。成绩榜实时显示大家的扫雷成绩。">
<link rel="icon" href="images/微信截图_20250327223546.png" type="image/png">
<title>扫雷</title>
<style>
input{height:1.5rem;font-size:1.1rem;width:4rem; border-radius: 4px; border: 1px solid #ccc; transition: all 0.3s;}
input:hover{border-color: #999;}
input[type="button"]{background: #4CAF50; color: white; border: none; cursor: pointer;}
input[type="button"]:hover{background: #45a049;}
#face{
border:2px solid #808080;
border-left-color: #fff;
border-top-color: #fff;
width:21px;
height:21px;
border-radius: 50%;
transition: all 0.2s;
}
#face:active{
border:2px solid #808080;
border-bottom:1px solid #808080;
border-right:1px solid #808080;
}
#face:hover{
transform: scale(1.05);
}
.game-btn {
display: inline-block;
padding: 6px 12px;
margin: 0 5px;
font-weight: 500;
text-decoration: none;
background-color: #4a76a8;
color: white;
border-radius: 4px;
transition: all 0.3s;
}
.game-btn:hover {
background-color: #3a5b85;
transform: translateY(-2px);
}
.game-btn:active {
transform: translateY(0);
}
table{
border-collapse:collapse;
}
.pad{
border:2px solid #808080;
border-right-color: #fff;
border-bottom-color: #fff;
border-radius: 4px;
}
.title-container {
display: flex;
align-items: center;
justify-content: center;
margin-top: 0.8rem;
}
.title-container img {
height: 32px;
margin: 0 10px;
}
.title-container b {
margin: 0 5px;
}
.win-popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(255, 255, 255, 0.95);
border: 2px solid #4a76a8;
border-radius: 8px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
z-index: 1000;
text-align: center;
max-width: 90%;
width: 320px;
animation: popup-fade 0.5s ease-in-out;
}
.win-popup h2 {
color: #4CAF50;
margin-top: 0;
font-size: 1.5rem;
}
.win-popup p {
margin-bottom: 15px;
font-size: 1rem;
line-height: 1.4;
}
.win-popup button {
background-color: #4a76a8;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s;
}
.win-popup button:hover {
background-color: #3a5b85;
transform: translateY(-2px);
}
@keyframes popup-fade {
0% { opacity: 0; transform: translate(-50%, -60%); }
100% { opacity: 1; transform: translate(-50%, -50%); }
}
.win-popup-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.3);
z-index: 999;
}
.fail-popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(255, 255, 255, 0.95);
border: 2px solid #e74c3c;
border-radius: 8px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
z-index: 1000;
text-align: center;
max-width: 90%;
width: 320px;
animation: popup-fade 0.5s ease-in-out;
}
.fail-popup h2 {
color: #e74c3c;
margin-top: 0;
font-size: 1.5rem;
}
.fail-popup p {
margin-bottom: 15px;
font-size: 1rem;
line-height: 1.4;
}
.fail-popup button {
background-color: #e74c3c;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s;
}
.fail-popup button:hover {
background-color: #c0392b;
transform: translateY(-2px);
}
</style>
<base target="_top">
</head>
<body bgcolor="f7f7f0" style="margin:0;" onload="start(); _123(1);">
<center>
<div class="title-container">
<b>扫雷</b>
</div>
<div style="margin-top:0.8rem;">
<a href="javascript:_123(1)" class="game-btn">简单</a>
<a href="javascript:_123(2)" class="game-btn">中等</a>
<a href="javascript:_123(3)" class="game-btn">困难</a>
<a href="javascript:_123(4)" class="game-btn">铺满屏幕</a>
<a href="javascript:_123(5)" class="game-btn">自定义</a>
</div>
<div id="custom" style="display:none; margin-top: 10px;">
横向:<input id="hm" type="number" value="40">
竖向:<input id="vm" type="number" value="24">
雷数:<input id="mm" type="number" value="199">
<input type="button" onclick="udf()" value="确定">
</div>
<table style="margin-top:0.8rem;border-radius:6px;background:#cccccc">
<tr>
<td style="padding:9px;">
<table id="p42" class="pad" style="height:34px">
<tr>
<td width="50%"><canvas id="rm" height="23" width="39"></canvas>
<!--img><img><img-->
</td>
<td align="center">
<img onmouseup="_45()" id="face">
</td>
<td width="50%" align="right"><canvas id="es" height="23" width="39"></canvas>
<!--img><img><img-->
</td>
</tr>
</table>
<!--table style="margin-top:6px;" class=pad id=paf></table-->
<canvas id="paf" class="pad" style="margin-top:6px;" width="0" height="0"></canvas>
</td>
</tr>
<tr><td align="right"></td></tr>
</table>
<!-- 游戏胜利统计区域 -->
<div style="margin-top:1rem; padding: 8px 12px; background: #f0f0f0; border-radius: 6px; display: inline-block;">
<p style="margin: 0; font-size: 1rem;">全球玩家已取得 <span id="total-wins" style="font-weight: bold; color: #4a76a8;">加载中...</span> 次胜利</p>
</div>
<div style="margin-top:2rem;"></div>
<div style="width:90%;text-align:left;margin-top:3rem;">
扫雷游戏规则:格子里的数字表示周围有几个雷。目标是在最短时间内找出所有雷。点击表情可重新开始。
<br><br>
<b>电脑操作:</b>左键点击打开方块,右键标记雷。<a href="mouse2.html" class="game-btn" style="padding: 2px 5px; font-size: 0.8em;">设置</a>
<br><br>
<b>触屏操作:</b>点击标记雷,长按打开方块。<a href="touch2.html" class="game-btn" style="padding: 2px 5px; font-size: 0.8em;">设置</a>
</div>
<div id="zz" style="margin-top:4rem;"></div>
<div style="margin-top:5rem;">
<br>
<span id="uid" style="color:#f7f7f0"></span>
<!--a href=setting.htm>改名</a-->
</div>
<script src="static/js/gfs.js"></script>
<script src="static/js/ms3.5.js"></script>
<script src="static/js/zz4.js"></script>
<div id="win-popup-overlay" class="win-popup-overlay"></div>
<div id="win-popup" class="win-popup">
<h2>恭喜,你赢了!</h2>
<p>点击笑脸或者选择难度即可开始新游戏</p>
<button onclick="closeWinPopup()">关闭</button>
</div>
<div id="fail-popup" class="fail-popup">
<h2>很遗憾,踩雷了!</h2>
<p>点击笑脸或者选择难度即可重新开始游戏</p>
<button onclick="closeFailPopup()">关闭</button>
</div>
<script>
// 等待页面和游戏脚本完全加载
window.addEventListener('load', function() {
// 定义全局变量
var winPopupShown = false;
var failPopupShown = false;
var gameFinished = false; // 标记游戏是否结束
var originalF17 = null;
var originalUp = null;
var checkInterval = null;
// 检测游戏状态的函数
function checkGameStatus() {
// 如果游戏已结束且弹窗已关闭,停止检测
if (gameFinished && !winPopupShown && !failPopupShown) {
clearInterval(checkInterval);
return;
}
// 检查游戏状态
if (typeof window['_gs'] !== 'undefined') {
// _gs = 1 表示胜利, _gs = 2 表示失败
if (window['_gs'] === 1 && !winPopupShown && !failPopupShown && !gameFinished) {
gameFinished = true;
showWinPopup();
return;
} else if (window['_gs'] === 2 && !failPopupShown && !winPopupShown && !gameFinished) {
gameFinished = true;
showFailPopup();
return;
}
}
// 检查剩余方块数量是否为0(胜利条件)
if (typeof window['RB'] !== 'undefined' && window['RB'] === 0 &&
!winPopupShown && !failPopupShown && typeof window['_gs'] !== 'undefined' && window['_gs'] !== 2 && !gameFinished) {
gameFinished = true;
showWinPopup();
return;
}
}
// 开始游戏状态检测
function startGameCheck() {
gameFinished = false;
clearInterval(checkInterval); // 清除之前的定时器
checkInterval = setInterval(checkGameStatus, 300);
}
// 初始启动检测
startGameCheck();
// 显示胜利弹窗
function showWinPopup() {
winPopupShown = true;
failPopupShown = false; // 确保两个弹窗不会同时显示
document.getElementById('win-popup').style.display = 'block';
document.getElementById('win-popup-overlay').style.display = 'block';
// 记录胜利并更新统计数据
recordWin();
}
// 显示失败弹窗
function showFailPopup() {
failPopupShown = true;
winPopupShown = false; // 确保两个弹窗不会同时显示
document.getElementById('fail-popup').style.display = 'block';
document.getElementById('win-popup-overlay').style.display = 'block';
}
// 关闭胜利弹窗
function closeWinPopup() {
document.getElementById('win-popup').style.display = 'none';
document.getElementById('win-popup-overlay').style.display = 'none';
winPopupShown = false;
}
// 关闭失败弹窗
function closeFailPopup() {
document.getElementById('fail-popup').style.display = 'none';
document.getElementById('win-popup-overlay').style.display = 'none';
failPopupShown = false;
}
// 记录胜利到服务器
function recordWin() {
fetch('/api/record-win')
.then(response => response.json())
.then(data => {
if (data.success) {
updateWinCount(data.total_wins);
}
})
.catch(err => {
console.error('记录胜利失败:', err);
});
}
// 更新胜利计数显示
function updateWinCount(count) {
document.getElementById('total-wins').textContent = count;
}
// 获取当前胜利统计
function fetchStats() {
fetch('/api/stats')
.then(response => response.json())
.then(data => {
updateWinCount(data.total_wins);
})
.catch(err => {
console.error('获取统计数据失败:', err);
document.getElementById('total-wins').textContent = '获取失败';
});
}
// 页面加载时获取统计信息
fetchStats();
// 把弹窗关闭函数添加到全局作用域
window.closeWinPopup = closeWinPopup;
window.closeFailPopup = closeFailPopup;
// 重置游戏
function resetGame() {
closeWinPopup();
closeFailPopup();
gameFinished = false;
startGameCheck();
}
// 拦截胜利函数f17
if (typeof window.f17 === 'function') {
originalF17 = window.f17;
window.f17 = function() {
var result = originalF17.apply(this, arguments);
if (!gameFinished) {
gameFinished = true;
setTimeout(function() {
if (!failPopupShown && !winPopupShown) showFailPopup();
}, 500);
}
return result;
};
}
// 监听o0o函数,这个函数在打开方块时调用
if (typeof window.o0o === 'function') {
var originalO0o = window.o0o;
window.o0o = function(x, y) {
var result = originalO0o.apply(this, arguments);
// 如果返回1,说明点到了雷,游戏结束
if (result === 1 && !gameFinished) {
gameFinished = true;
setTimeout(function() {
if (!failPopupShown && !winPopupShown) showFailPopup();
}, 500);
}
// 如果游戏胜利(RB === 0),游戏结束
if (typeof window['RB'] !== 'undefined' && window['RB'] === 0 &&
typeof window['_gs'] !== 'undefined' && window['_gs'] !== 2 && !gameFinished) {
gameFinished = true;
setTimeout(function() {
if (!winPopupShown && !failPopupShown) showWinPopup();
}, 500);
}
return result;
};
}
// 重置游戏的函数,用于监听重置相关事件
if (typeof window._45 === 'function') {
var original_45 = window._45;
window._45 = function() {
var result = original_45.apply(this, arguments);
resetGame();
return result;
};
}
// 点击笑脸重置游戏时重置弹窗状态
document.addEventListener('click', function(e) {
if (e.target && e.target.id === 'face') {
resetGame();
}
});
// 点击弹窗背景关闭弹窗
document.getElementById('win-popup-overlay').addEventListener('click', function() {
closeWinPopup();
closeFailPopup();
});
// 选择难度时重置弹窗状态
var difficultyLinks = document.querySelectorAll('a[href^="javascript:_123"]');
for(var i = 0; i < difficultyLinks.length; i++) {
difficultyLinks[i].addEventListener('click', function() {
resetGame();
});
}
// 监听_123函数(选择难度)
if (typeof window._123 === 'function') {
var original_123 = window._123;
window._123 = function() {
var result = original_123.apply(this, arguments);
resetGame();
return result;
};
}
});
</script>
</center>
</div>
<script language="javascript" type="text/javascript" src=".\static\js\18759442.js"></script>
<div style="display: none">
<script type="text/javascript" src=".\static\js\z_stat.js"></script>
</div>
</body>
</html>