-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (37 loc) · 1.46 KB
/
script.js
File metadata and controls
46 lines (37 loc) · 1.46 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
const slideshow = document.querySelector('.header_img');
const images = document.querySelectorAll('.header_img img');
let currentImageIndex = 0;
function nextImage() {
images[currentImageIndex].style.opacity = 0;
currentImageIndex = (currentImageIndex + 1) % images.length;
images[currentImageIndex].style.opacity = 1;
}
setInterval(nextImage, 5000);
function showAlert()
{
const alertMessage = "本当にこのサイトを開くの?開いてしまったら、あなたの生活が大きく変わるかもしれないよ?";
const redirectUrl = "https://chat.openai.com/chat";
// アラートボックスのスタイルを定義
const alertBoxStyle =
`
background-color: #FFEFD5;
border: 1px solid #FFDAB9;
border-radius: 10px;
padding: 20px;
text-align: center;
margin-top: 10px;
`;
// アラートボックスの要素を作成し、メッセージを設定
const alertBox = document.createElement("div");
alertBox.style.cssText = alertBoxStyle;
alertBox.textContent = alertMessage;
// アラートボックスをリンクの横に表示
const linkElement = event.target;
linkElement.parentNode.appendChild(alertBox);
// OKをクリックしたら ChatGPT のサイトにリダイレクト
if (confirm(alertMessage)) {
window.location.href = redirectUrl;
} else {
alertBox.remove();
}
}