Compare commits
3 Commits
06edf9de62
...
a9f57b4807
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9f57b4807 | ||
|
|
60ba9d1655 | ||
|
|
dc54a29748 |
@@ -235,6 +235,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
@media (prefers-reduced-motion:reduce){.fade,.stage,.view.on,.mask.on{opacity:1;transform:none;transition:none;animation:none}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../topic/_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -397,6 +398,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (views.quiz.classList.contains('on') && cur > 0) { goPrev(); return; }
|
||||
if (!views.start.classList.contains('on')) { renderStart(); show('start'); return; }
|
||||
if (window.MBHost && MBHost.back(function () { location.href = plazaURL(); })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
location.href = plazaURL();
|
||||
});
|
||||
sc.addEventListener('scroll', function () { $('#bar').classList.toggle('sh', sc.scrollTop > 4); }, { passive: true });
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!-- 11-04 UGC 总开关关着时本页不展示,直接回首页(js/ugc.js) -->
|
||||
<script src="../js/host-nav.js?v=26110902"></script>
|
||||
<script src="../js/login-gate.js?v=26110610"></script>
|
||||
<script src="../js/ugc.js?v=26110702" data-guard></script>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
|
||||
@@ -1311,7 +1312,9 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
}
|
||||
if (window.wxAuth && wxAuth.reportLocation) wxAuth.reportLocation({ href: target });
|
||||
} catch (e) {}
|
||||
haptic(); location.href = target;
|
||||
haptic();
|
||||
if (window.MBHost && MBHost.open(url, function () { location.href = target; })) return;
|
||||
location.href = target;
|
||||
}
|
||||
/* 11-02 v2 用户:「测一测放到『经验』后边;孕妈广场上现在那个测一测删掉;『大家在聊』里穿插几个测一测,点了进对应的测试」
|
||||
→ CATS 加第 5 个分类 ceshi;选中时 #head 放说明卡、#fh 放分组胶囊、#wf 瀑布流放 25 张测试卡;「全部」信息流每 8 张帖子穿插 1 张测试卡(先 CS_MIX 再按热度)。
|
||||
@@ -1321,6 +1324,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
var TG = { quiz: '常识小测', psy: '趣味心理', game: '趣味闯关', shop: '花钱风格' }, tGrp = '';
|
||||
var CS_MIX = ['t11', 't29', 't01', 't24', 't26', 't16', 't03', 't27', 't14', 't21', 't30', 't18'];
|
||||
function csDone() { try { return (JSON.parse(localStorage.getItem('mmbox.gcts.v1') || '{}')[param('openid') || '_guest']) || {}; } catch (e) { return {}; } }
|
||||
function goCeshi(u) { if (!(window.MBHost && MBHost.open(u))) location.href = u; } /* 11-09 小程序里开容器页,复制链接直达这个测试 */
|
||||
function ceshiURL(id, fromTab) {
|
||||
var q = new URLSearchParams(location.search); ['t', 'n', 'c', 'id', 'mine', 'write', 'fav'].forEach(function (k) { q.delete(k); });
|
||||
if (fromTab) q.set('c', 'ceshi');
|
||||
@@ -1567,7 +1571,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
}, 260);
|
||||
}
|
||||
ov.addEventListener('click', function (e) {
|
||||
if (e.target.closest('.lko-go')) { SFX.tap(); location.href = ceshiURL(pk.id, true); return; }
|
||||
if (e.target.closest('.lko-go')) { SFX.tap(); goCeshi(ceshiURL(pk.id, true)); return; }
|
||||
if (e.target.closest('.lko-re')) { if (!ov.classList.contains('done')) return; haptic(); roll(); return; }
|
||||
if (e.target.closest('.lko-x')) { close(); return; }
|
||||
var sb = e.target.closest('.lko-snd');
|
||||
@@ -1951,11 +1955,11 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
$('#more').addEventListener('click', function (e) { if (e.target.closest('[data-t]')) { haptic(); selectTopic(''); } });
|
||||
$('#head').addEventListener('click', function (e) {
|
||||
if (e.target.closest('#qfBanner')) { goQifu(); return; }
|
||||
var cb = e.target.closest('.cbn[data-test], .csv-i[data-test]'); if (cb) { haptic(); location.href = ceshiURL(cb.dataset.test, true); return; }
|
||||
var cb = e.target.closest('.cbn[data-test], .csv-i[data-test]'); if (cb) { haptic(); goCeshi(ceshiURL(cb.dataset.test, true)); return; }
|
||||
var dc = e.target.closest('#csvGo'); if (dc) { csdRoll(dc); return; }
|
||||
var j = e.target.closest('[data-join]'); if (j) { haptic(); openRule(j.dataset.join); return; }
|
||||
if (e.target.closest('[data-rule]')) { openRule(''); return; }
|
||||
var rw = e.target.closest('.rwi[data-id]'); if (rw) { haptic(); openNote(rw.dataset.id, true); return; }
|
||||
var rw = e.target.closest('.rwi[data-id]'); if (rw) { haptic(); openNoteNav(rw.dataset.id); return; }
|
||||
if (e.target.closest('[data-all]')) { openTopics(); return; }
|
||||
var b = e.target.closest('[data-t]'); if (b) { haptic(); selectTopic(b.dataset.t); }
|
||||
});
|
||||
@@ -2017,17 +2021,17 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
}
|
||||
$('#more').addEventListener('click', function (e) {
|
||||
var ts = e.target.closest('[data-test]');
|
||||
if (ts) { e.stopPropagation(); haptic(); location.href = ceshiURL(ts.dataset.test, true); }
|
||||
if (ts) { e.stopPropagation(); haptic(); goCeshi(ceshiURL(ts.dataset.test, true)); }
|
||||
}, true);
|
||||
$('#wf').addEventListener('click', function (e) {
|
||||
if (e.target.closest('[data-mine]')) { haptic(); location.href = mineURL(); return; }
|
||||
if (e.target.closest('[data-fav]')) { haptic(); openFav(false); return; }
|
||||
var ts = e.target.closest('[data-test]');
|
||||
if (ts) { haptic(); location.href = ceshiURL(ts.dataset.test, catF === 'ceshi'); return; }
|
||||
if (ts) { haptic(); goCeshi(ceshiURL(ts.dataset.test, catF === 'ceshi')); return; }
|
||||
var lk = e.target.closest('[data-like]');
|
||||
if (lk) { e.stopPropagation(); toggleLike(lk.dataset.like); syncCardLike(lk.dataset.like); return; }
|
||||
var c = e.target.closest('.nc');
|
||||
if (c) openNote(c.dataset.id, true);
|
||||
if (c) openNoteNav(c.dataset.id);
|
||||
});
|
||||
|
||||
/* ---------- 详情 ---------- */
|
||||
@@ -2084,6 +2088,13 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
try { history.replaceState(null, '', location.pathname + (qs ? '?' + qs : '') + location.hash); } catch (e) {}
|
||||
q.set('wh', '1'); location.href = '../?' + q + location.hash;
|
||||
}
|
||||
/* 11-09 用户:笔记详情里点小程序「复制链接」要直达这篇 —— 小程序里点开笔记改开容器页(js/host-nav.js),
|
||||
开不了(不在小程序 / 页面栈满)照旧在本页弹详情层 */
|
||||
function openNoteNav(id) {
|
||||
var n = NBY[id];
|
||||
if (n && !n.pin && window.MBHost && MBHost.open(setQuery(cur, id), function () { openNote(id, true); })) return;
|
||||
openNote(id, true);
|
||||
}
|
||||
function openNote(id, push) {
|
||||
var n = NBY[id]; if (!n) return;
|
||||
if (n.pin) return goStar(); /* 11-07 用户:点置顶笔记直接进星空页,留言在星空页下面(openPin 详情页不再用) */
|
||||
@@ -2148,7 +2159,9 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
function closeNote() {
|
||||
if (!openId) return;
|
||||
if (pushed) { history.back(); return; } /* popstate 里 hideNote */
|
||||
hideNote(); history.replaceState(history.state, '', setQuery(cur, ''));
|
||||
var off = function () { hideNote(); history.replaceState(history.state, '', setQuery(cur, '')); };
|
||||
if (window.MBHost && MBHost.back(off)) return; /* 11-09 容器页直接开的这篇:回上一页(广场列表 / 首页);复制链接打开、没有上一页时照旧关层 */
|
||||
off();
|
||||
}
|
||||
window.addEventListener('popstate', function () {
|
||||
if (sheetOn) closeSheet();
|
||||
@@ -2311,7 +2324,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
$('#fvBack').addEventListener('click', closeFav);
|
||||
$('#fvw').addEventListener('click', function (e) {
|
||||
var lk = e.target.closest('[data-like]'); if (lk) { toggleLike(lk.dataset.like); syncCardLike(lk.dataset.like); return; }
|
||||
var c = e.target.closest('[data-id]'); if (c) { haptic(); openNote(c.dataset.id, true); }
|
||||
var c = e.target.closest('[data-id]'); if (c) { haptic(); openNoteNav(c.dataset.id); }
|
||||
});
|
||||
function syncMyCard() { var c = $('#myc'); if (c) { c.outerHTML = myCardHTML(); } }
|
||||
function loadMine(cb) {
|
||||
@@ -2444,6 +2457,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
$('#back').addEventListener('click', function () {
|
||||
/* 11-02 用户:「从首页点热门话题进来,左上角返回要回孕妈广场,不是首页」→ 在话题里先退回广场「全部」,再按一次才回首页 */
|
||||
if (cur) { haptic(); catF = ''; selectTopic(''); return; }
|
||||
if (window.MBHost && MBHost.back(function () { location.href = homeURL(); })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
var fromHome = false;
|
||||
try { fromHome = !!document.referrer && new URL(document.referrer).origin === location.origin; } catch (e) {}
|
||||
if (fromHome && history.length > 1) {
|
||||
@@ -2459,7 +2473,7 @@ html.night .gtg button.on{background:#F2725B;border-color:#F2725B;color:#fff}
|
||||
if (cur || catF) { catF = ''; selectTopic(''); }
|
||||
$('#sc').scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
$('#tabHome').addEventListener('click', function () { haptic(); location.href = homeURL(); }); /* 广场就在首页仓里,直接回 ../ 带身份,不走 goHome */
|
||||
$('#tabHome').addEventListener('click', function () { haptic(); if (window.MBHost && MBHost.home(function () { location.href = homeURL(); })) return; location.href = homeURL(); }); /* 广场就在首页仓里,直接回 ../ 带身份,不走 goHome */
|
||||
/* 记一下:和首页「记一下」同一份数据 —— 后台 App 表已上架、category=孕期工具(首页 loadPublishedApps 同规则);
|
||||
数胎动 16 / 数宫缩 20 / 胎儿估重 15 周前灰掉、点了提示(同首页 STAGE_GATE,孕周取首页写的 mmbox.gcwk.v1,拿不准不拦) */
|
||||
var REC_GATE = { taidong: [16, '数胎动'], gongsuopinlv: [20, '数宫缩'], taierguzhong: [15, '胎儿估重'] }, recApps = null;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<title>兜爸心选 · 孕育陪伴</title>
|
||||
<!-- 11-04 UGC 总开关(孕妈广场 + 测一测,后台 /box_bm/plaza 顶部切换),见 js/ugc.js -->
|
||||
<script src="js/ugc.js?v=26110806"></script>
|
||||
<!-- V:26110902 缓存版本标记:改 css/js 时同步 bump 该值(与 js/app.js 的 VER 同源),静态资源按 mtime 走 ETag 自动刷新 -->
|
||||
<!-- V:26110904 缓存版本标记:改 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=26110642">
|
||||
@@ -19,6 +19,7 @@
|
||||
<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
|
||||
<!-- 共享助手:授权/跳商城/位置上报(分享卡片同步,见 docs/h5-auth-standard.md 第四节) -->
|
||||
<script src="/common/wx-auth.js?v=26102601"></script>
|
||||
<script src="js/host-nav.js?v=26110902"></script>
|
||||
<script src="js/login-gate.js?v=26110618"></script>
|
||||
<!-- 11-05 用户:「消消乐的推广 banner 图,不要有外面白色的边框」→ 去掉 .game-promo 外层白底(mama-box.css 里和其他模块共用一条白底规则,这里单独盖掉;夜间同) -->
|
||||
<style>.game-promo,html.night .game-promo{background:none!important;box-shadow:none!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
|
||||
@@ -2689,10 +2690,10 @@ html.night .rs-pan .rp-card{background:rgba(255,255,255,.06);border-color:rgba(2
|
||||
<script src="js/wh-cm.js?v=26110802" defer></script>
|
||||
<script src="js/pv.js?v=26110801" defer></script> <!-- 11-07 页面访问记录(推送效果看板,见 js/pv.js) -->
|
||||
<script src="js/app.js"></script>
|
||||
<script src="js/kit.js?v=26110605"></script>
|
||||
<script src="js/kit.js?v=26110903"></script>
|
||||
<!-- 11-05 用户:孕期百问加上跟趣味小测试一样的底部 Tab(孕期百问 / 记一下 / 返回首页)。挂在 #detailQA 里,面板关着时跟着滑出屏外;
|
||||
「记一下」直接开首页自己的记一下弹层(z 95 盖在百问 z 80 上),「返回首页」= 关掉百问面板 -->
|
||||
<script src="js/mb-tabbar.js?v=26110901"></script>
|
||||
<script src="js/mb-tabbar.js?v=26110903"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var d = document.getElementById('detailQA'); if (!d || !window.MBTab) return;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26110902';
|
||||
var VER = '26110904';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
@@ -181,6 +181,7 @@
|
||||
return u.href;
|
||||
}
|
||||
function openInHost(target) {
|
||||
if (window.MBHost) return window.MBHost.open(target); // js/host-nav.js(加 _hv=1,子页面返回走 navigateBack)
|
||||
const mp = window.wx && window.wx.miniProgram;
|
||||
if (!inMiniProgram() || !mp || typeof mp.navigateTo !== 'function') return false;
|
||||
if (Date.now() - hostNavAt < 1000) return true; // 连点:上一次 navigateTo 还在路上
|
||||
@@ -194,6 +195,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* ================= H5 宿主恢复:冷启动回到上次进入的 H5 应用(2026-09-22) =================
|
||||
需求:在小程序里进入某个 H5 应用后退出小程序,再次进入要恢复那个应用。
|
||||
数据源:box_app GET /api/mp/public/last-app?openid=(Redis,per-openid,7 天 TTL)
|
||||
@@ -4466,6 +4468,7 @@
|
||||
haptic();
|
||||
const url = 'guangchang/' + (id ? '?t=' + encodeURIComponent(id) : '') + location.hash;
|
||||
reportHostLocation(new URL(url, location.href).href);
|
||||
if (openInHost(url)) return;
|
||||
location.href = url;
|
||||
}
|
||||
/* 「全部」:只放热门,四块(家庭/婚姻/职场/母婴)轮流排,别一排全是同一块;选了某块:该块热门在前、其余在后 */
|
||||
@@ -4544,6 +4547,7 @@
|
||||
haptic();
|
||||
const url = 'guangchang/?mine=1' + location.hash;
|
||||
reportHostLocation(new URL(url, location.href).href);
|
||||
if (openInHost(url)) return;
|
||||
location.href = url;
|
||||
});
|
||||
$('.gch-who', sec).before(b);
|
||||
@@ -6048,7 +6052,7 @@
|
||||
const a = document.createElement('div'); a.className = 'qa-a';
|
||||
a.textContent = x.a || '';
|
||||
/* 有专题页的条目(首页那 6 个)点了直接进专题页 */
|
||||
h.addEventListener('click', () => { if (x.href) { haptic(); location.href = qaHref(x.href); return; } it.classList.toggle('open'); haptic(); });
|
||||
h.addEventListener('click', () => { if (x.href) { haptic(); const u = qaHref(x.href); if (!openInHost(u)) location.href = u; return; } it.classList.toggle('open'); haptic(); });
|
||||
it.appendChild(h); it.appendChild(a);
|
||||
L.appendChild(it);
|
||||
});
|
||||
@@ -6913,6 +6917,7 @@
|
||||
haptic();
|
||||
const url = 'guangchang/?fav=1' + location.hash;
|
||||
reportHostLocation(new URL(url, location.href).href);
|
||||
if (openInHost(url)) return;
|
||||
location.href = url;
|
||||
});
|
||||
})();
|
||||
|
||||
76
js/host-nav.js
Normal file
76
js/host-nav.js
Normal file
@@ -0,0 +1,76 @@
|
||||
/* ============================================================
|
||||
host-nav.js · 小程序里换页开「容器页」(2026-11-09 用户)
|
||||
------------------------------------------------------------
|
||||
「在任何一个子页面点小程序『复制链接』,打开应该进到那个子页面,现在都进首页」——
|
||||
「复制链接」复制的是**小程序当前页面**的路径和参数。首页壳里 location.href 换页,小程序页面一直是首页壳,
|
||||
复制出来永远是首页。所以在小程序里进子页面 / 应用 / 广场笔记时,navigateTo 通用容器
|
||||
pages/annex/web_view/index?url=<净地址>(分享卡片落地用的同一个页,容器按打开者自己的身份注入),
|
||||
小程序当前页就是那一页。
|
||||
|
||||
MBHost.open(url, fallback) 小程序里开容器页;不在小程序 → false(调用方照旧 location.href);
|
||||
navigateTo 失败(页面栈满 10 层等)→ 调 fallback,没给就 location.href = url
|
||||
MBHost.back(fallback) 本页是 open() 开出来的容器页(地址带 _hv=1)→ navigateBack 回上一页,返回 true;
|
||||
后退失败(复制链接直接打开、没有上一页)→ 调 fallback
|
||||
MBHost.home(fallback) 同上条件 → switchTab 回小程序首页(首页壳是 tabBar 页,原来停的位置还在)
|
||||
⚠️ url 只放净地址:去掉 openid/unionid/__no_identity/return_url 和 hash 里的身份,复制出去不带分享人身份。
|
||||
⚠️ 加 _hv=1 只为让页面知道「我在容器页里」,返回时用 navigateBack,不用在容器里再开一个首页。
|
||||
============================================================ */
|
||||
(function (g) {
|
||||
'use strict';
|
||||
if (g.MBHost) return;
|
||||
var VIEW = '/pages/annex/web_view/index';
|
||||
var at = 0;
|
||||
function mp() { return g.wx && g.wx.miniProgram; }
|
||||
function inMp() { return g.__wxjs_environment === 'miniprogram' || /miniProgram/i.test(navigator.userAgent); }
|
||||
function inView() { return /[?&]_hv=1(&|$)/.test(location.search); }
|
||||
function clean(url) {
|
||||
var u = new URL(url, location.href);
|
||||
['openid', 'unionid', '__no_identity', 'return_url', 'norestore'].forEach(function (k) { u.searchParams.delete(k); });
|
||||
if (/(^|[#&])(openid|unionid|phone|nickname|avatar|norestore)=/.test(u.hash)) u.hash = '';
|
||||
u.searchParams.set('_hv', '1');
|
||||
return u.href;
|
||||
}
|
||||
var H = {
|
||||
inMp: inMp,
|
||||
inView: inView,
|
||||
open: function (url, fallback) {
|
||||
var m = mp();
|
||||
if (!inMp() || !m || typeof m.navigateTo !== 'function') return false;
|
||||
if (Date.now() - at < 1000) return true; // 连点:上一次 navigateTo 还在路上
|
||||
var c;
|
||||
try { c = clean(url); } catch (e) { return false; }
|
||||
at = Date.now();
|
||||
m.navigateTo({
|
||||
url: VIEW + '?url=' + encodeURIComponent(c),
|
||||
fail: function () { at = 0; if (fallback) fallback(); else location.href = url; }
|
||||
});
|
||||
return true;
|
||||
},
|
||||
back: function (fallback) {
|
||||
var m = mp();
|
||||
if (!inView() || !inMp() || !m || typeof m.navigateBack !== 'function') return false;
|
||||
m.navigateBack({ delta: 1, fail: function () { if (fallback) fallback(); } });
|
||||
return true;
|
||||
},
|
||||
home: function (fallback) {
|
||||
var m = mp();
|
||||
if (!inView() || !inMp() || !m || typeof m.switchTab !== 'function') return false;
|
||||
m.switchTab({ url: '/pages/index/index', fail: function () { if (fallback) fallback(); } });
|
||||
return true;
|
||||
}
|
||||
};
|
||||
g.MBHost = H;
|
||||
|
||||
/* 页面里的 <a href> 指向本站别的页面:小程序里也开容器页(别人已经 preventDefault 的不管) */
|
||||
document.addEventListener('click', function (e) {
|
||||
if (e.defaultPrevented || e.button || e.metaKey || e.ctrlKey || !inMp()) return;
|
||||
var a = e.target && e.target.closest && e.target.closest('a[href]');
|
||||
if (!a || a.target || a.hasAttribute('download')) return;
|
||||
var href = a.getAttribute('href') || '';
|
||||
if (!href || href.charAt(0) === '#' || /^(javascript|mailto|tel):/i.test(href)) return;
|
||||
var u;
|
||||
try { u = new URL(href, location.href); } catch (err) { return; }
|
||||
if (u.origin !== location.origin || u.pathname === location.pathname) return;
|
||||
if (H.open(u.href)) e.preventDefault();
|
||||
});
|
||||
})(window);
|
||||
@@ -264,8 +264,9 @@
|
||||
var b = e.target.closest('.kit-e,.kit-mb'); if (!b) return;
|
||||
try { navigator.vibrate && navigator.vibrate(8); } catch (x) {}
|
||||
var k = b.dataset.k;
|
||||
if (k === 'qz') location.href = 'guangchang/' + cleanQ({ c: 'ceshi' });
|
||||
else if (k === 'js') location.href = 'topic/jisuan/' + cleanQ();
|
||||
var go = function (u) { if (!(window.MBHost && MBHost.open(u))) location.href = u; }; /* 11-09 小程序里开容器页,复制链接直达(js/host-nav.js) */
|
||||
if (k === 'qz') go('guangchang/' + cleanQ({ c: 'ceshi' }));
|
||||
else if (k === 'js') go('topic/jisuan/' + cleanQ());
|
||||
else if (window.__mbOpenQA) window.__mbOpenQA('孕期百问');
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
if (window.wxAuth && wxAuth.reportLocation) wxAuth.reportLocation({ href: target });
|
||||
} catch (e) {}
|
||||
/* 11-09:小程序里开容器页,「复制链接」才能直达这个应用(同 js/app.js openInHost,url 只放净地址) */
|
||||
if (window.MBHost && MBHost.open(url, function () { location.href = target; })) return;
|
||||
var mp = window.wx && window.wx.miniProgram;
|
||||
if ((window.__wxjs_environment === 'miniprogram' || /miniProgram/i.test(navigator.userAgent)) && mp && typeof mp.navigateTo === 'function') {
|
||||
try {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* 自成一页:不引 app.js;返回回 ../../;工具跳转走 ../_shared/tools.js(同源路径 + search + hash)。
|
||||
*/
|
||||
(function () {
|
||||
/* 11-09 小程序「复制链接」直达:加载 js/host-nav.js(容器页返回走 navigateBack、页内链接开容器页) */
|
||||
try { if (!window.MBHost && document.currentScript) { var hs = document.createElement('script'); hs.src = new URL('../../js/host-nav.js?v=26110902', document.currentScript.src).href; document.head.appendChild(hs); } } catch (e) {}
|
||||
'use strict';
|
||||
var D = window.TOPIC;
|
||||
if (!D) return;
|
||||
@@ -131,6 +133,7 @@
|
||||
|
||||
var sc = $('#scroll');
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
页面:<script src="../_shared/calc.js"></script> 之后用 window.CK。 */
|
||||
(function (g) {
|
||||
'use strict';
|
||||
/* 11-09 小程序「复制链接」直达:加载 js/host-nav.js(容器页返回走 navigateBack、页内链接开容器页) */
|
||||
try { if (!window.MBHost && document.currentScript) { var hs = document.createElement('script'); hs.src = new URL('../../js/host-nav.js?v=26110902', document.currentScript.src).href; document.head.appendChild(hs); } } catch (e) {}
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var DAY = 864e5;
|
||||
function today() { var n = new Date(Date.now() + 288e5); return Date.UTC(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate()); }
|
||||
@@ -37,6 +39,7 @@
|
||||
function shell() {
|
||||
var sc = $('#scroll');
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../jisuan/' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../jisuan/' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -171,6 +171,7 @@ b{color:var(--h)}
|
||||
.nu:active,.nc li:active{transform:scale(.98)}
|
||||
@media (prefers-reduced-motion:reduce){.fade,.fade .fi{opacity:1;transform:none;transition:none}}
|
||||
</style>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标,stroke 1.8 -->
|
||||
@@ -332,6 +333,7 @@ b{color:var(--h)}
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -178,6 +178,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
@media (prefers-reduced-motion:reduce){.fade,.stage,.view.on,.mask.on{opacity:1;transform:none;transition:none;animation:none}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标(每题一个场景图标 q-*) -->
|
||||
@@ -338,6 +339,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -179,6 +179,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
@media (prefers-reduced-motion:reduce){.fade,.stage,.view.on,.mask.on{opacity:1;transform:none;transition:none;animation:none}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标(每题一个场景图标 q-*) -->
|
||||
@@ -342,6 +343,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -278,6 +278,7 @@ h1 .mk{background:linear-gradient(transparent 64%,rgba(24,160,88,.24) 0)}
|
||||
.mask .row button,.mask .row a{height:34px;padding:0 18px;border-radius:99px;border:1px solid rgba(255,255,255,.6);color:#fff;font-size:13.5px;line-height:32px;text-decoration:none}
|
||||
@media (prefers-reduced-motion:reduce){.screen.on,.mask.on{animation:none}.fu{opacity:1;transform:none;transition:none}}
|
||||
</style>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -1415,6 +1416,7 @@ h1 .mk{background:linear-gradient(transparent 64%,rgba(24,160,88,.24) 0)}
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -45,6 +45,7 @@ button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
.mb-brand{text-align:center;color:#C29A8F;font-size:11.5px;line-height:1.7}.mb-brand img{display:block;width:86px;height:auto;margin:0 auto 6px;opacity:.6}.mb-brand p{display:flex;align-items:center;justify-content:center;gap:8px;margin:0;letter-spacing:.06em}.mb-brand p::before,.mb-brand p::after{content:'';width:28px;height:1px;background:#EAD3CC}
|
||||
#scroll .mb-brand{margin:20px 0 0;padding-bottom:calc(120px + env(safe-area-inset-bottom))} /* 给底部 Tab 让位 */
|
||||
</style>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="scroll">
|
||||
@@ -133,6 +134,7 @@ button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
});
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
@@ -149,7 +151,7 @@ button{font:inherit;border:0;background:none;color:inherit;cursor:pointer}
|
||||
})();
|
||||
</script>
|
||||
<!-- 11-05 用户:底部加上跟趣味小测试一样的 Tab(孕期计算器 / 记一下 / 返回首页) -->
|
||||
<script src="../../js/mb-tabbar.js?v=26110901"></script>
|
||||
<script src="../../js/mb-tabbar.js?v=26110903"></script>
|
||||
<script>MBTab.init({ root: '../../', first: { t: '孕期计算器', ic: 'calc' } });</script>
|
||||
<script src="../../js/share-card.js?v=26110464"></script>
|
||||
<script>window.mbShare('../../assets/share/t/jisuan.jpg', '孕期计算器:生娃花费、预产期、产假天数,一算就知道'); /* 11-04 微信转发图 */</script>
|
||||
|
||||
@@ -184,6 +184,7 @@ h2{font-size:18px;font-weight:700;line-height:1.4;color:var(--ink)}
|
||||
@media (prefers-reduced-motion:reduce){.fade{opacity:1;transform:none;transition:none}}
|
||||
@media (max-width:370px){h1{font-size:26px}.pt b{font-size:13.5px}.bm{padding:9px 8px 11px}.bm .v{font-size:18px}}
|
||||
</style>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标:stroke 1.8,颜色走 .ic(主色) -->
|
||||
@@ -417,6 +418,7 @@ h2{font-size:18px;font-weight:700;line-height:1.4;color:var(--ink)}
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -197,6 +197,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
.care p+p{margin-top:8px}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标(每题一个场景图标 q-*) -->
|
||||
@@ -373,6 +374,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -178,6 +178,7 @@ h1 em{font-style:normal;background:linear-gradient(transparent 62%,rgba(240,138,
|
||||
.fade.in{opacity:1;transform:none}
|
||||
@media (prefers-reduced-motion:reduce){.fade{opacity:1;transform:none;transition:none}.amt .tr i{transform:none;transition:none}}
|
||||
</style>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<svg width="0" height="0" style="position:absolute" aria-hidden="true">
|
||||
@@ -313,6 +314,7 @@ h1 em{font-style:normal;background:linear-gradient(transparent 62%,rgba(240,138,
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -196,6 +196,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
.warn{margin-top:20px;padding:10px 14px;border-radius:14px;background:var(--cbg);color:#4F7F2A;font-size:13px;line-height:1.6;text-align:center}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标(每题一个场景图标 q-*) -->
|
||||
@@ -359,6 +360,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -72,6 +72,7 @@ button{cursor:pointer}
|
||||
.foot{margin:14px 20px 0;font-size:12px;color:var(--m);text-align:center;line-height:1.6}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/wizard.css?v=26110464">
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<svg style="position:absolute;width:0;height:0" aria-hidden="true"><symbol id="i-back" viewBox="0 0 24 24"><path d="M15 5l-7 7 7 7"/></symbol></svg>
|
||||
@@ -113,6 +114,7 @@ button{cursor:pointer}
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
var sc = $('#scroll'), KEY = 'mmbox.edd.calc', DAY = 864e5;
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -205,6 +205,7 @@ html.cm:not(.cm-all) .cm-more{display:flex;align-items:center;justify-content:ce
|
||||
<!-- 11-04 计算器模式(calc=1)走分步:一步一题、最后出结果,见 ../_shared/wizard.js -->
|
||||
<link rel="stylesheet" href="../_shared/wizard.css?v=26110464">
|
||||
<script src="../_shared/wizard.js?v=26110464"></script>
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<svg class="hide" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -410,6 +411,7 @@ html.cm:not(.cm-all) .cm-more{display:flex;align-items:center;justify-content:ce
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
@@ -197,6 +197,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
@media (prefers-reduced-motion:reduce){.fade,.stage,.view.on,.mask.on{opacity:1;transform:none;transition:none;animation:none}}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../_shared/quiz-skin.css?v=26110643"><!-- 11-07 答题页底色 / 卡片 -->
|
||||
<script src="../../js/host-nav.js?v=26110903"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 单色线性图标(每题一个场景图标 q-*) -->
|
||||
@@ -358,6 +359,7 @@ mark{background:linear-gradient(transparent 62%,var(--c20) 0);color:inherit;padd
|
||||
|
||||
/* 返回:从首页点进来就 back;直接打开(分享 / 刷新)就回同目录的首页,身份 hash 原样带回 */
|
||||
$('#back').addEventListener('click', function () {
|
||||
if (window.MBHost && MBHost.back(function () { location.href = '../../' + location.search + location.hash; })) return; /* 11-09 容器页:回小程序上一页 */
|
||||
if (document.referrer && document.referrer.indexOf(location.host) >= 0 && history.length > 1) history.back();
|
||||
else location.href = '../../' + location.search + location.hash;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user