Repository navigation
Expand file tree
/
Copy pathredirect.html
More file actions
91 lines (83 loc) · 3.79 KB
/
Copy pathredirect.html
File metadata and controls
91 lines (83 loc) · 3.79 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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<link rel="alternate" hreflang="ja" href="https://www.otoho.me/">
<title>Redirecting...</title>
<link rel="stylesheet" href="style.css">
<!-- Meta Description -->
<meta name="description" content="Convenience for everyone.">
<meta name="keywords" content="oto home,otohome,音猫,otoneko,rin_pineapple,λ_sorarin,profile,docs,bio,discord,twitter,instagram,youtube,github">
<meta name="theme-color" content="#cfcfcf">
<!-- Open Graph (OG) Tags -->
<meta property="og:title" content="Redirecting...">
<meta property="og:description" content="Convenience for everyone.">
<meta property="og:image" content="https://otoho.me/img/logo.png">
<meta property="og:url" content="https://otoho.me/">
<meta property="og:type" content="website">
<!-- Twitter Card Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Redirecting...">
<meta name="twitter:description" content="Convenience for everyone.">
<meta name="twitter:image" content="https://otoho.me/img/logo.png">
<meta name="twitter:site" content="@rin_pineapple">
<!-- Viewport for Responsiveness -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1 id="redirecting-msg"></h1>
<div id="redirecting-description"></div>
<div id="confirmation-box">
<p id="confirmation-text">
以下のURLにリダイレクトします。<br>
<strong id="url-placeholder"></strong><br>
よろしいですか?
</p>
<button class="btn confirm" id="confirm-yes">はい</button>
<button class="btn cancel" id="confirm-no">いいえ</button>
</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const redirectUrl = urlParams.get('url');
const confirmationText = document.getElementById('confirmation-text');
const urlPlaceholder = document.getElementById('url-placeholder');
if (redirectUrl) {
const urlWithoutHttp = redirectUrl.replace(/^https?:\/\//, '').endsWith('/') ? redirectUrl.replace(/^https?:\/\//, '').slice(0, -1) : redirectUrl.replace(/^https?:\/\//, '');
console.log(urlWithoutHttp)
urlPlaceholder.textContent = `${urlWithoutHttp}`;
document.getElementById('confirm-yes').addEventListener('click', function() {
document.getElementById('confirmation-box').style.display = 'none';
document.getElementById('redirecting-msg').textContent = 'Redirecting...';
document.getElementById('redirecting-description').innerHTML = `
<p>
リダイレクトしない場合、<a href="${redirectUrl}">コチラ</a>をクリックしてください。
<p>
`;
setTimeout(() => {
window.location.href = redirectUrl;
}, 3000);
});
document.getElementById('confirm-no').addEventListener('click', function() {
document.getElementById('confirmation-box').style.display = 'none';
document.getElementById('redirecting-msg').textContent = 'Cancelled.';
document.getElementById('redirecting-description').innerHTML = `
<p>
ウィンドウを閉じます。
<p>
`;
setTimeout(() => {
window.close();
}, 3000);
});
} else {
document.getElementById('confirm-yes').style.display = 'none';
document.getElementById('confirm-no').style.display = 'none';
confirmationText.textContent = 'リダイレクト先のURLがありません。';
setTimeout(() => {
window.close();
}, 3000);
}
</script>
<script src="script.js"></script>
</body>
</html>