v26110446 预览:专属福利不跟后台开关一直显示;「宝宝出生了」改成和我的收藏同款列表行;踢腿音效改到手机喇叭能放的频段+绕开 iPhone 静音键+每次触摸恢复声音

This commit is contained in:
deploy
2026-11-05 03:43:54 +00:00
parent c441dae002
commit 9b18cec9b5
28 changed files with 147 additions and 120 deletions

View File

@@ -6,7 +6,7 @@
· 别的脚本读 window.__mbUgc(true/false),等结果用 window.__mbUgcReady(Promise),中途变了会发 mb-ugc 事件。
上一次拿到的值存本机 mmbox.ugc.v1,先按它渲染、接口回来再校正;接口不通就沿用上一次的值(从没拿到过 = 关)。
11-05 首页「孕N周专属福利」开关 giftEnabled(后台同一处,默认开):false → <html>.gift-off 藏 .shelf.gift2,缓存 mmbox.gift.v1。
预览站也跟这个开关(预览不跟的只是 UGC);正式版 main 是并进 UGC 那次请求里的,合并时以哪边为准都行、两边行为一致。
预览站不跟这个开关、一直显示(11-05 用户:预览放出来,正式先隐藏);正式版 main 是并进 UGC 那次请求里的,合并时以哪边为准都行、两边行为一致。
本文件在 <root>/js/ugc.js,必须同步 <script> 引入(要靠 document.currentScript 算首页地址)。 */
(function () {
var K = 'mmbox.ugc.v1', de = document.documentElement, me = document.currentScript, on = false;
@@ -21,8 +21,10 @@
'html.gift-off .shelf.gift2{display:none!important}';
(document.head || de).appendChild(st);
try { de.classList.toggle('gift-off', localStorage.getItem('mmbox.gift.v1') === '0'); } catch (e) {}
fetch('/api/mp/public/mama-box/config', { cache: 'no-store' })
/* 11-05 用户:「预览页面要放出来,正式上线的可以先隐藏」→ 预览站不跟 giftEnabled,一直显示;正式站照开关 */
var pvSite = /\/mama-box-preview\//.test(location.pathname);
if (!pvSite) try { de.classList.toggle('gift-off', localStorage.getItem('mmbox.gift.v1') === '0'); } catch (e) {}
if (!pvSite) fetch('/api/mp/public/mama-box/config', { cache: 'no-store' })
.then(function (r) { return r.json(); })
.then(function (j) {
var g = !(j && j.result && j.result.giftEnabled === false);