悄悄话改为广场信息流置顶笔记(首页不放);?wh=1 直接盖上星空页、关掉回广场;v26110608

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-11-07 01:52:11 +00:00
parent 884732c0a9
commit aee7371535
7 changed files with 98 additions and 97 deletions

View File

@@ -3,7 +3,7 @@
(function () {
'use strict';
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
var VER = '26110607';
var VER = '26110608';
const $ = (s, c) => (c || document).querySelector(s);
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
@@ -4806,6 +4806,7 @@
function closePage() {
stopAll();
drawer(false);
if (fromPlaza) { fromPlaza = false; history.back(); return; } /* 从广场置顶笔记来的:回广场 */
page.classList.remove('show');
page.setAttribute('aria-hidden', 'true');
}
@@ -4826,7 +4827,7 @@
.then(r => (r.ok ? r.json() : null))
.then(j => {
const r = j && j.code === 200 && j.result;
if (!r || !r.show || !(r.list || []).length) { data = null; show(false); return; }
if (!r || !r.show || !(r.list || []).length) { data = null; show(false); autoFail(); return; }
data = r;
const ns = r.list.map(x => x.id + ':' + x.hugs + (x.hugged ? 'h' : '')).join('|');
if (ns !== sig) {
@@ -4838,13 +4839,30 @@
show(true);
if (autoOpen) { autoOpen = false; openPage(); }
})
.catch(() => { if (!silent) show(false); });
.catch(() => { if (!silent) show(false); autoFail(); });
}
/* 2026-11-07 孕妈广场页的悄悄话条点了跳回首页带 ?wh=1 → 数据回来直接打开星空页;参数用完就去掉,刷新不再弹 */
let autoOpen = /[?&]wh=1(?:&|$)/.test(location.search);
if (autoOpen && history.replaceState) {
const q = new URLSearchParams(location.search); q.delete('wh');
history.replaceState(history.state, '', location.pathname + (q.toString() ? '?' + q : '') + location.hash);
/* 2026-11-07 孕妈广场信息流的置顶笔记「孕妈悄悄话」点了跳到首页带 ?wh=1 → 直接打开星空页:
· 星空页先空着盖上来(不露首页),孕周取广场也在用的 mmbox.gcwk.v1,马上拉数据,不等「此刻」;
· 参数用完就去掉,刷新不再弹;从广场来的,关掉星空页 = 浏览器返回,回到广场;
· 拉不到 → 提示一句再回广场。 */
let autoOpen = /[?&]wh=1(?:&|$)/.test(location.search), fromPlaza = false;
if (autoOpen) {
fromPlaza = /\/guangchang\//.test(document.referrer || '') && history.length > 1;
if (history.replaceState) {
const q = new URLSearchParams(location.search); q.delete('wh');
history.replaceState(history.state, '', location.pathname + (q.toString() ? '?' + q : '') + location.hash);
}
page.classList.add('show');
page.setAttribute('aria-hidden', 'false');
let gw = 0;
try { const g = JSON.parse(localStorage.getItem('mmbox.gcwk.v1') || 'null'); gw = g && !g.pp && g.w ? +g.w : 0; } catch (e) {}
if (gw >= 4) setTimeout(() => load(gw), 0); else setTimeout(autoFail, 0);
}
function autoFail() {
if (!autoOpen) return;
autoOpen = false;
toast('悄悄话暂时打不开,稍后再试');
setTimeout(closePage, 1500);
}
whLoad = w => load(w, w === wk); /* 同一孕周的重拉(「此刻」每 60 秒一次)按静默刷新走:失败不收入口 */
setInterval(() => { if (wk && !document.hidden && !busy) load(wk, true); }, 300000);