| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /**
- * 目标详情页跳转逻辑
- * Centralized logic for target detail page selection
- */
- function getTargetDetail() {
- // 1. Date Check (Holidays) - Top Priority
- const now = new Date();
- const month = now.getMonth() + 1; // 1-12
- const date = now.getDate();
- // Christmas: Dec 18 - Dec 31
- if (month === 12 && date >= 18) {
- return 'detail-christmas.html';
- }
-
- // New Year: Jan 1 - Jan 7
- if (month === 1 && date <= 7) {
- // 增加一点随机性:50% 概率看普通元旦,50% 看烟花版
- return Math.random() < 0.5 ? 'detail-newyear.html' : 'detail-newyear-fireworks.html';
- }
- // 2. Random Logic for Regular Days
- // 50% Chance for default detail.html
- if (Math.random() < 0.5) {
- return 'detail.html';
- }
- // 3. 50% Chance for other random weather/seasonal cards
- const others = [
- 'detail-cloud.html',
- 'detail-rain.html',
- 'detail-snow.html',
- 'detail-sun.html',
- 'detail-windy.html'
- ];
-
- // Random selection from the pool
- const randomIndex = Math.floor(Math.random() * others.length);
- return others[randomIndex];
- }
- /**
- * 目标首页跳转逻辑
- * Centralized logic for target index page selection
- */
- function getTargetIndex() {
- const indexPages = [
- 'index-ori.html',
- 'index-style3.html',
- 'index-style4.html',
- 'index-style5.html',
- 'index-style6.html',
- 'index-style7.html',
- 'index-style8.html'
- ];
- const randomIndex = Math.floor(Math.random() * indexPages.length);
- return indexPages[randomIndex];
- }
|