Skip to content

Commit

Permalink
feat: 名刺QRからアクセス時、特定条件下で別サイトへリダイレクトするようにした
Browse files Browse the repository at this point in the history
今回はジョジ会の日にXに飛ぶように
  • Loading branch information
hyouhyan committed Oct 18, 2024
1 parent 5fc5d44 commit ea859b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<link rel="stylesheet" href="/css/style.css" media="screen and (min-width: 768px)">
<link rel="stylesheet" href="/css/stylemobile.css" media="screen and (max-width: 767px)">

<!-- 名刺リダイレクト用js -->
<script src="/js/meishi_redirect.js"></script>

<!-- フォント関連 -->
<script async>
(function (d) {
Expand Down
12 changes: 12 additions & 0 deletions js/meishi_redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// 現在のURLのパラメーターを取得
const urlParams = new URLSearchParams(window.location.search);
const meishiParam = urlParams.get('meishi');

// 今日の日付を取得
const today = new Date();
const targetDate = new Date('2024-10-20');

// パラメーターが「meishi=2」で、今日が2024年10月20日である場合、リダイレクト
if (meishiParam === '2' && today.toDateString() === targetDate.toDateString()) {
window.location.href = "https://x.com/hyouhyan";
}

0 comments on commit ea859b4

Please sign in to comment.