-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
170 lines (146 loc) · 5.21 KB
/
Copy pathindex.html
File metadata and controls
170 lines (146 loc) · 5.21 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
<!DOCTYPE html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background: #000;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Arial', sans-serif;
}
#startButton {
padding: 25px 50px;
font-size: 2.5em;
background: linear-gradient(135deg, #8A2BE2 0%, #4B0082 100%);
color: white;
border: none;
border-radius: 50px;
cursor: pointer;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
box-shadow: 0 0 50px rgba(138, 43, 226, 0.5);
text-transform: uppercase;
letter-spacing: 3px;
animation: pulse 2s infinite;
}
#startButton:hover {
transform: scale(1.05);
box-shadow: 0 0 70px rgba(138, 43, 226, 0.8);
}
#startButton::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
transparent 25%,
rgba(255,255,255,0.1) 50%,
transparent 75%);
animation: shine 3s infinite;
}
#videoContainer {
padding: 25px 50px;
border: none;
border-radius: 50px;
display: none;
position: fixed;
overflow: hidden;
}
#myVideo {
width: 100%;
height: 100%;
object-fit: contain;
}
#skipButton {
position: fixed;
bottom: 40px;
right: 40px;
padding: 15px 30px;
background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
color: white;
border: none;
border-radius: 25px;
cursor: pointer;
display: none;
font-size: 1.2em;
box-shadow: 0 0 30px rgba(255,107,107,0.5);
transition: all 0.3s ease;
}
#skipButton:hover {
transform: scale(1.05);
box-shadow: 0 0 50px rgba(255,107,107,0.8);
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
@keyframes shine {
0% { transform: translate(-50%, -50%) rotate(45deg); }
100% { transform: translate(50%, 50%) rotate(45deg); }
}
</style>
</head>
<body>
<button id="startButton">ARE YOU READY?</button>
<div id="videoContainer">
<video id="myVideo" src="chess.mp4"></video>
<button id="skipButton">SKIP</button>
</div>
<script>
const startButton = document.getElementById('startButton');
const videoContainer = document.getElementById('videoContainer');
const video = document.getElementById('myVideo');
const skipButton = document.getElementById('skipButton');
// مدیریت کلیک روی دکمه شروع
startButton.addEventListener('click', async () => {
try {
// پنهان کردن دکمه شروع
startButton.style.display = 'none';
// نمایش ویدیو
videoContainer.style.display = 'block';
// درخواست مجوز پخش صدا
await video.play();
// نمایش دکمه SKIP بعد از 4 ثانیه
setTimeout(() => {
skipButton.style.display = 'block';
}, 4000);
} catch (error) {
alert('برای پخش ویدیو نیاز به مجوز دارید!');
startButton.style.display = 'block';
}
});
// مدیریت پایان ویدیو یا کلیک SKIP
const redirect = () => {
video.pause();
window.location.href = 'chess.html';
};
video.addEventListener('ended', redirect);
skipButton.addEventListener('click', redirect);
// تنظیم سایز ویدیو
const setVideoSize = () => {
const videoRatio = video.videoWidth / video.videoHeight;
const windowRatio = window.innerWidth / window.innerHeight;
if (windowRatio > videoRatio) {
video.style.width = 'auto';
video.style.height = '100vh';
} else {
video.style.width = '100vw';
video.style.height = 'auto';
}
};
video.addEventListener('loadedmetadata', setVideoSize);
window.addEventListener('resize', setVideoSize);
</script>
</body>
</html>