悄悄话转发落地:星空页开着时地址带 ?wh=1,求赞带 &wc=;深链不被恢复上次应用跳走 (v26110632)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1053,7 +1053,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
var CMD = null, CMERR = false;
|
||||
/* 头像编码:数字 = av/NNNN.webp(旧代码头像);'av:c012' = av/c012.webp(卡通/可爱卡通);'/…' = 站内绝对路径(内置头像库 /_bridge/avatars/);其余 = assets/img/mom/xxx.jpg */
|
||||
var avP = function (a) { return typeof a === 'number' ? 'av/' + ('000' + a).slice(-4) + '.webp' : a.indexOf('av:') === 0 ? 'av/' + a.slice(3) + '.webp' : a.charAt(0) === '/' ? a : '../assets/img/mom/' + a + '.jpg'; };
|
||||
fetch('cm.json?v=26110631').then(function (r) { return r.json(); }).then(function (j) {
|
||||
fetch('cm.json?v=26110632').then(function (r) { return r.json(); }).then(function (j) {
|
||||
CMD = j; if (openId && NBY[openId]) { renderComments(NBY[openId]); syncBar(NBY[openId]); }
|
||||
}).catch(function () { CMERR = true; if (openId && NBY[openId]) renderComments(NBY[openId]); });
|
||||
function commentsOf(n) {
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<title>兜爸心选 · 孕育陪伴</title>
|
||||
<!-- 11-04 UGC 总开关(孕妈广场 + 测一测,后台 /box_bm/plaza 顶部切换),见 js/ugc.js -->
|
||||
<script src="js/ugc.js?v=26110487"></script>
|
||||
<!-- V:26110631 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26110632 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<link rel="stylesheet" href="mama-box.css">
|
||||
<link rel="stylesheet" href="night.css?v=26110608">
|
||||
<link rel="stylesheet" href="js/wh-cm.css?v=26110631">
|
||||
<link rel="stylesheet" href="js/wh-cm.css?v=26110632">
|
||||
<!-- 11-04 用户:「顶部图片上的倒计时先删除掉」→ 不加载 hero-cd.css / hero-cd.js(文件留着,加回这两行即恢复),头图回到原样式 -->
|
||||
<!-- 夜晚模式:首屏绘制前就按上次的选择加 class,避免先白后黑闪一下(开关在首页右上角 #nightBtn,逻辑见 app.js) -->
|
||||
<script>try{if(localStorage.getItem('mmbox.night.v1')==='1'){document.documentElement.classList.add('night');document.querySelector('meta[name=theme-color]').content='#2A2340'}}catch(e){}</script>
|
||||
@@ -2680,7 +2680,7 @@ html.night .rs-pan .rp-card{background:rgba(255,255,255,.06);border-color:rgba(2
|
||||
<script src="guangchang/topics.js?v=26110487"></script>
|
||||
<script src="js/ava-pool.js?v=26110487"></script> <!-- 11-05 装饰头像分配表(各模块互不重复) -->
|
||||
<script src="js/wh-themes.js?v=26110609"></script>
|
||||
<script src="js/wh-cm.js?v=26110631" defer></script>
|
||||
<script src="js/wh-cm.js?v=26110632" defer></script>
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/kit.js?v=26110605"></script>
|
||||
<!-- 11-05 用户:孕期百问加上跟趣味小测试一样的底部 Tab(孕期百问 / 记一下 / 返回首页)。挂在 #detailQA 里,面板关着时跟着滑出屏外;
|
||||
|
||||
23
js/app.js
23
js/app.js
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26110631';
|
||||
var VER = '26110632';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -202,6 +202,8 @@
|
||||
/* 预览页(/mama-box-preview/)是直接发链接给人看的,不在小程序里冷启动 —— 不恢复上次应用,
|
||||
否则一打开就被送去上次进过的应用(2026-10-01 用户反馈:打开预览链接直接跳到孕检日历)。 */
|
||||
if (location.pathname.indexOf('/mama-box-preview/') === 0) return;
|
||||
/* 11-07:转发来的悄悄话卡片(?wh=1 / ?wc=<留言id>)是要直接看星空页的,不能被「恢复上次应用」跳走 */
|
||||
if (/[?&](wh|wc)=/.test(location.search)) { sessionStorage.setItem(RESUME_DONE_KEY, '1'); return; }
|
||||
const oid = hashParam('openid');
|
||||
if (!oid) return; // 无身份不跳(宿主拿不到 openid 时也不会加载本页)
|
||||
/* 先置闸门再请求/再判 norestore:
|
||||
@@ -4838,7 +4840,21 @@
|
||||
drawer(false);
|
||||
launch(g.dataset.next ? nextStar() : +g.dataset.go);
|
||||
});
|
||||
/* 11-07 用户:小程序里转发「本周话题」,对方点进来要直接到星空页 —— 宿主转发好友用的是 web-view 当前真实地址
|
||||
(onShareAppMessage 的 webViewUrl),不看上报的 href,所以星空页开着时地址里要一直带 ?wh=1,关掉再去掉。 */
|
||||
function whQs(on) {
|
||||
try {
|
||||
const q = new URLSearchParams(location.search);
|
||||
if (on) q.set('wh', '1'); else { q.delete('wh'); q.delete('wc'); }
|
||||
const u = location.pathname + (q.toString() ? '?' + q : '') + location.hash;
|
||||
if (u === location.pathname + location.search + location.hash) return;
|
||||
history.replaceState(history.state, '', u);
|
||||
const th = window.MB_WH_THEME ? window.MB_WH_THEME() : null;
|
||||
if (window.wxAuth && wxAuth.reportLocation) wxAuth.reportLocation(on ? { title: th ? '本周话题:' + th.name : '孕妈悄悄话' } : {});
|
||||
} catch (e) {}
|
||||
}
|
||||
function openPage() {
|
||||
whQs(true);
|
||||
stopAll();
|
||||
cur = 0;
|
||||
card.classList.remove('show');
|
||||
@@ -4854,6 +4870,7 @@
|
||||
stopAll();
|
||||
drawer(false);
|
||||
if (fromPlaza) { fromPlaza = false; history.back(); return; } /* 从广场置顶笔记来的:回广场 */
|
||||
whQs(false);
|
||||
page.classList.remove('show');
|
||||
page.setAttribute('aria-hidden', 'true');
|
||||
}
|
||||
@@ -4896,10 +4913,6 @@
|
||||
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;
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
function repOf(c, me) { return { p: c.parent, n: me ? '我' : (c.nickname || '孕妈'), me: me, to: c.parentName, t: c.text, ts: c.at, st: me ? c.status : '' }; }
|
||||
function load() {
|
||||
if (loading || SIM) return; loading = true;
|
||||
fetch('guangchang/cm.json?v=26110631').then(function (r) { return r.json(); }).then(function (j) {
|
||||
fetch('guangchang/cm.json?v=26110632').then(function (r) { return r.json(); }).then(function (j) {
|
||||
var PP = j.p;
|
||||
SIM = (j.c[PID] || []).map(function (c, k) {
|
||||
var p = PP[c[0]];
|
||||
@@ -124,6 +124,8 @@
|
||||
var href = location.origin + location.pathname + '?wh=1&wc=' + encodeURIComponent(id);
|
||||
var title = '帮我点个赞吧!被赞 ' + STAR_N + ' 次,我对宝宝说的话就能变成一颗星星';
|
||||
var img = new URL('assets/share/g/home.jpg', document.baseURI).href;
|
||||
/* 宿主转发好友取 web-view 当前真实地址,不看上报的 href —— 地址栏里也要带上这条留言 */
|
||||
try { var q = new URLSearchParams(location.search); q.set('wh', '1'); q.set('wc', id); history.replaceState(history.state, '', location.pathname + '?' + q + location.hash); } catch (e) {}
|
||||
if (window.wxAuth && wxAuth.reportLocation) wxAuth.reportLocation({ href: href, title: title, imageUrl: img });
|
||||
var g = document.createElement('div');
|
||||
g.className = 'wsh-g';
|
||||
|
||||
Reference in New Issue
Block a user