sync update from LAN repo (source master @ ca48c4ec)
This commit is contained in:
1 parent
8bc8b0e082
commit
ea9dcff9c0
873 files changed
+107866
-14011
No files matched your search
+215
@@ -0,0 +1,215 @@
|
||||
{
|
||||
"site": {
|
||||
"brandPrimary": "GMA",
|
||||
"brandAccent": "新闻",
|
||||
"tagline": "菲律宾新闻在线",
|
||||
"dateLabel": "2026年10月30日 星期五 · 菲律宾",
|
||||
"pageTitle": "GMA 新闻——菲律宾广播新闻门户",
|
||||
"description": "采用菲律宾广播新闻视觉语言制作的中文新闻门户概念页面。",
|
||||
"language": "zh-CN",
|
||||
"theme": "light",
|
||||
"skipLabel": "跳转到主要新闻",
|
||||
"weatherMini": [
|
||||
{"id": "manila", "city": "马尼拉", "temp": "31℃", "condition": "晴间多云 · 降雨概率20%"},
|
||||
{"id": "cebu", "city": "宿务", "temp": "29℃", "condition": "多云 · 降雨概率35%"},
|
||||
{"id": "davao", "city": "达沃", "temp": "30℃", "condition": "小雨 · 降雨概率45%"}
|
||||
]
|
||||
},
|
||||
"navigation": {
|
||||
"menuLabel": "打开新闻菜单",
|
||||
"searchLabel": "搜索",
|
||||
"contrastOnLabel": "高对比度阅读已开启",
|
||||
"contrastOffLabel": "已恢复标准配色",
|
||||
"liveLabel": "观看直播",
|
||||
"topLinks": [
|
||||
{"label": "广播", "href": "#radio"},
|
||||
{"label": "国际", "href": "#footer"},
|
||||
{"label": "新闻简报", "href": "#newsletter"},
|
||||
{"label": "登录", "href": "#footer"}
|
||||
],
|
||||
"primary": [
|
||||
{"label": "首页", "href": "#main"},
|
||||
{"label": "新闻", "href": "#latest"},
|
||||
{"label": "娱乐", "href": "#channels"},
|
||||
{"label": "电视直播", "href": "#onair"},
|
||||
{"label": "生活", "href": "#channels"},
|
||||
{"label": "体育", "href": "#channels"},
|
||||
{"label": "财经", "href": "#channels"},
|
||||
{"label": "天气", "href": "#weather"},
|
||||
{"label": "公共服务", "href": "#service"},
|
||||
{"label": "视频", "href": "#videos"}
|
||||
],
|
||||
"drawer": {
|
||||
"eyebrow": "浏览新闻栏目",
|
||||
"title": "菲律宾新闻与公共服务",
|
||||
"text": "集中查看突发新闻、天气、交通、公共服务和广播节目。",
|
||||
"ctaLabel": "打开公共服务中心",
|
||||
"ctaHref": "#service"
|
||||
},
|
||||
"search": {
|
||||
"title": "搜索 GMA 新闻",
|
||||
"placeholder": "搜索主题、地点和新闻",
|
||||
"hint": "热门:交通、天气、排球",
|
||||
"emptyMessage": "请输入主题、地点或人物。",
|
||||
"resultPrefix": "条相关结果,关键词为"
|
||||
}
|
||||
},
|
||||
"justIn": {
|
||||
"label": "即时新闻",
|
||||
"moreLabel": "展开4条",
|
||||
"closeLabel": "收起",
|
||||
"featured": "沿海省份在台风季前启用统一应急信息热线。",
|
||||
"items": [
|
||||
{"id": "rapid-bus", "time": "上午10:12", "title": "快速公交走廊启动公众测试", "category": "全国", "href": "#topnews"},
|
||||
{"id": "volleyball", "time": "上午10:04", "title": "国家排球队公布最终十二人名单", "category": "体育", "href": "#channels"},
|
||||
{"id": "peso", "time": "上午9:51", "title": "出口数据强劲推动比索走高", "category": "财经", "href": "#channels"},
|
||||
{"id": "rain", "time": "上午9:43", "title": "马尼拉都会区预计出现小雨", "category": "天气", "href": "#weather"}
|
||||
]
|
||||
},
|
||||
"lead": {
|
||||
"main": {
|
||||
"id": "capital-hub",
|
||||
"kicker": "头条 · 交通",
|
||||
"title": "首都综合交通枢纽进入公众测试最后一周",
|
||||
"summary": "数千名通勤者参与试运行,新枢纽将把轨道交通、快速公交和渡轮连接成统一网络。",
|
||||
"byline": "记者 索菲娅·梅尔卡多",
|
||||
"time": "上午9:48更新",
|
||||
"readTime": "阅读约6分钟",
|
||||
"visual": "transit-hub",
|
||||
"videoLabel": "观看报道"
|
||||
},
|
||||
"sideStories": [
|
||||
{"id": "flood-alert", "kicker": "环境", "title": "多省启动洪水和山体滑坡联合预警系统", "summary": "预警信息将同步发送至地方广播和移动网络。", "time": "23分钟前", "visual": "storm"},
|
||||
{"id": "learning-board", "kicker": "教育", "title": "全国学习资源平台向家长和教师开放", "summary": "公共平台用于比较资源配置,不对单个学校进行排名。", "time": "41分钟前", "visual": "education"}
|
||||
],
|
||||
"headlines": [
|
||||
{"id": "procurement", "kicker": "政治", "title": "参议院委员会推进地方采购透明法案", "href": "#latest"},
|
||||
{"id": "heat-space", "kicker": "国际", "title": "东盟城市就耐热公共空间达成合作", "href": "#latest"},
|
||||
{"id": "women-final", "kicker": "体育", "title": "国家女队晋级地区决赛", "href": "#channels"},
|
||||
{"id": "export-hub", "kicker": "财经", "title": "小型出口商接入共享物流枢纽", "href": "#channels"}
|
||||
]
|
||||
},
|
||||
"news": {
|
||||
"trackingTitle": "正在追踪",
|
||||
"trackingStatusPrefix": "正在跟踪的相关新闻数量",
|
||||
"topics": [
|
||||
{"id": "transit", "label": "交通网络", "count": "18"},
|
||||
{"id": "storm", "label": "台风准备", "count": "15"},
|
||||
{"id": "food", "label": "食品价格", "count": "16"},
|
||||
{"id": "sea", "label": "西菲律宾海", "count": "17"},
|
||||
{"id": "school", "label": "学校日历", "count": "14"}
|
||||
],
|
||||
"feeds": [
|
||||
{
|
||||
"id": "latest",
|
||||
"label": "最新新闻",
|
||||
"items": [
|
||||
{"id": "night-trips", "kicker": "全国", "title": "交通部门增加二十趟深夜试运行班次", "summary": "延长运行将测试晚高峰后的车站值守和换乘衔接。", "time": "12分钟前", "visual": "transit"},
|
||||
{"id": "road-guide", "kicker": "公共事务", "title": "多地发布峰会道路管制一站式指南", "summary": "交互式路线方案涵盖公交、配送和应急通道。", "time": "29分钟前", "visual": "civic"},
|
||||
{"id": "clinics", "kicker": "健康", "title": "社区诊所本周延长免费筛查时间", "summary": "流动医疗队还将前往交通枢纽和公共市场。", "time": "47分钟前", "visual": "health"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "trending",
|
||||
"label": "热榜",
|
||||
"items": [
|
||||
{"id": "weather-five", "kicker": "最受关注", "title": "本周天气需要了解的五件事", "summary": "区域预报解读降雨、气温和出行条件。", "time": "阅读量8.2万", "visual": "weather"},
|
||||
{"id": "fare-guide", "kicker": "新闻解读", "title": "统一交通票价将如何运行", "summary": "一张卡、每日封顶和免费换乘规则详解。", "time": "阅读量6.4万", "visual": "fare"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "regional",
|
||||
"label": "地区新闻",
|
||||
"items": [
|
||||
{"id": "cebu-loop", "kicker": "维萨亚", "title": "宿务开放滨水林荫交通环线", "summary": "新路线连接渡轮、自行车和公共汽车。", "time": "34分钟前", "visual": "regional"},
|
||||
{"id": "davao-cacao", "kicker": "棉兰老", "title": "达沃可可中心启用共享质量实验室", "summary": "小型种植户可以在出口前完成本地检测。", "time": "55分钟前", "visual": "cacao"}
|
||||
]
|
||||
}
|
||||
],
|
||||
"trendingTitle": "热门新闻",
|
||||
"trendingLabel": "实时",
|
||||
"trendingItems": [
|
||||
{"id": "trend-1", "title": "新交通枢纽将如何影响通勤者", "href": "#topnews"},
|
||||
{"id": "trend-2", "title": "气象部门更新全国降雨图", "href": "#weather"},
|
||||
{"id": "trend-3", "title": "女子排球队晋级决赛", "href": "#channels"},
|
||||
{"id": "trend-4", "title": "比索在午后交易中走强", "href": "#channels"},
|
||||
{"id": "trend-5", "title": "峰会道路管制应急热线汇总", "href": "#service"}
|
||||
]
|
||||
},
|
||||
"services": {
|
||||
"weatherTitle": "天气",
|
||||
"weatherLiveLabel": "实时",
|
||||
"locations": [
|
||||
{"id": "manila", "city": "马尼拉都会区", "temp": "31°", "condition": "晴间多云", "forecast": [{"day": "周六", "temp": "30°", "label": "有雨"}, {"day": "周日", "temp": "31°", "label": "多云"}, {"day": "周一", "temp": "32°", "label": "晴"}]},
|
||||
{"id": "cebu", "city": "宿务市", "temp": "29°", "condition": "午后有雨", "forecast": [{"day": "周六", "temp": "29°", "label": "有雨"}, {"day": "周日", "temp": "30°", "label": "多云"}, {"day": "周一", "temp": "30°", "label": "多云"}]},
|
||||
{"id": "davao", "city": "达沃市", "temp": "30°", "condition": "小雨且湿度较高", "forecast": [{"day": "周六", "temp": "29°", "label": "有雨"}, {"day": "周日", "temp": "30°", "label": "小雨"}, {"day": "周一", "temp": "31°", "label": "多云"}]},
|
||||
{"id": "baguio", "city": "碧瑶市", "temp": "21°", "condition": "凉爽并有阵雨", "forecast": [{"day": "周六", "temp": "20°", "label": "阵雨"}, {"day": "周日", "temp": "21°", "label": "多云"}, {"day": "周一", "temp": "22°", "label": "晴间多云"}]}
|
||||
],
|
||||
"publicTitle": "公共服务",
|
||||
"publicItems": [
|
||||
{"id": "classes", "label": "停课信息", "message": "已打开停课信息演示面板。"},
|
||||
{"id": "hotlines", "label": "应急热线", "message": "已打开应急热线演示面板。"},
|
||||
{"id": "traffic", "label": "交通提示", "message": "已打开道路管制演示面板。"},
|
||||
{"id": "transit", "label": "公共交通", "message": "已打开公共交通时刻演示面板。"}
|
||||
]
|
||||
},
|
||||
"broadcast": {
|
||||
"eyebrow": "电视直播",
|
||||
"title": "正在播出",
|
||||
"moreLabel": "完整节目表",
|
||||
"moreHref": "#onair",
|
||||
"hero": {"title": "影响今天的重要新闻", "summary": "汇集菲律宾各地的突发进展、现场报道和清晰解读。", "visual": "newsroom", "actionLabel": "观看电视直播"},
|
||||
"scheduleTitle": "星期五节目表",
|
||||
"slots": [
|
||||
{"id": "news-center", "time": "下午5:00", "title": "新闻中心", "summary": "午后新闻摘要", "live": false},
|
||||
{"id": "prime-report", "time": "下午6:30", "title": "黄金时段报道", "summary": "旗舰新闻节目", "live": true},
|
||||
{"id": "public-affairs", "time": "晚上8:00", "title": "公共事务台", "summary": "访谈与新闻解读", "live": false},
|
||||
{"id": "state-nation", "time": "晚上9:00", "title": "国家观察", "summary": "分析与背景", "live": false},
|
||||
{"id": "late-edition", "time": "晚上10:00", "title": "晚间版", "summary": "全天新闻回顾", "live": false}
|
||||
],
|
||||
"modal": {"brand": "GMA 新闻直播", "title": "黄金时段报道", "note": "新闻中心演示直播", "quality": "直播 · 1080p", "captionsOn": "字幕:已开启", "captionsOff": "字幕:已关闭"}
|
||||
},
|
||||
"channels": {
|
||||
"glanceTitle": "数据速览",
|
||||
"glanceMoreLabel": "更多新闻解读",
|
||||
"glanceMoreHref": "#glance",
|
||||
"glanceItems": [
|
||||
{"id": "commute", "kicker": "交通", "value": "42分钟", "text": "新跨湾通勤线路在高峰时段预计节省的时间。", "actionLabel": "查看路线", "actionHref": "#topnews"},
|
||||
{"id": "schools", "kicker": "教育", "value": "1,240所", "text": "首批纳入学习资源平台的公立学校数量。", "actionLabel": "了解运行方式", "actionHref": "#latest"},
|
||||
{"id": "cities", "kicker": "天气", "value": "4座城市", "text": "纳入城市高温与降雨联合试点的城市数量。", "actionLabel": "查看天气", "actionHref": "#weather"},
|
||||
{"id": "growth", "kicker": "经济", "value": "6.1%", "text": "地区制造业产值同比增幅。", "actionLabel": "阅读分析", "actionHref": "#channels"}
|
||||
],
|
||||
"deskTitle": "GMA 新闻频道",
|
||||
"deskMoreLabel": "全部频道",
|
||||
"deskMoreHref": "#footer",
|
||||
"deskItems": [
|
||||
{"id": "showbiz", "kicker": "娱乐", "title": "独立电影节公布群岛巡展计划", "summary": "新增放映场地让菲律宾电影走近更多地方观众。", "visual": "showbiz"},
|
||||
{"id": "lifestyle", "kicker": "生活", "title": "社区花园如何为高密度街区降温", "summary": "居民分享小型城市花园的实用经验。", "visual": "lifestyle"},
|
||||
{"id": "sports", "kicker": "体育", "title": "大学宿敌加时赛上演经典对决", "summary": "最后一次大胆进攻决定了赛季揭幕战的胜负。", "visual": "sports"},
|
||||
{"id": "money", "kicker": "财经", "title": "地区工厂领跑新一轮增长数据", "summary": "食品加工和电子制造连续三个季度扩张。", "visual": "money"}
|
||||
]
|
||||
},
|
||||
"media": {
|
||||
"videosTitle": "最新视频",
|
||||
"videosMoreLabel": "查看全部视频",
|
||||
"videosMoreHref": "#videos",
|
||||
"videos": [
|
||||
{"id": "hub-video", "kicker": "新闻解读", "duration": "08:42", "title": "走进新的首都综合交通枢纽", "summary": "了解轨道、公交和渡轮如何实现换乘。", "visual": "transit-video"},
|
||||
{"id": "rain-video", "kicker": "天气", "duration": "04:16", "title": "全国降雨预警系统如何运行", "summary": "气象人员解释预警颜色和发布流程。", "visual": "rain-video"},
|
||||
{"id": "peso-video", "kicker": "财经", "duration": "06:05", "title": "市场观察:比索为何波动", "summary": "出口、能源和利率如何共同影响汇率。", "visual": "market-video"}
|
||||
],
|
||||
"podcast": {"eyebrow": "GMA 广播", "title": "晨间新闻播客", "text": "用十分钟掌握今天的重要新闻和背景。", "playLabel": "播放播客", "pauseLabel": "暂停播客", "startTime": "03:12 / 10:15", "playingTime": "05:51 / 10:15"},
|
||||
"lotto": {"eyebrow": "官方开奖", "title": "彩票结果", "date": "2026年10月25日 · 演示结果", "games": [{"id": "649", "label": "6/49", "numbers": ["07", "18", "24", "31", "42", "47"]}, {"id": "658", "label": "6/58", "numbers": ["05", "16", "27", "38", "49", "56"]}, {"id": "642", "label": "6/42", "numbers": ["03", "11", "19", "26", "34", "40"]}]},
|
||||
"newsletter": {"title": "新闻与你一路同行", "text": "每天早晨通过一封邮件获取菲律宾头条和公共服务动态。", "label": "电子邮箱", "placeholder": "请输入电子邮箱", "button": "立即订阅", "successPrefix": "订阅成功,确认邮件已发送至"}
|
||||
},
|
||||
"footer": {
|
||||
"description": "以紧迫、清晰和公共服务为核心的菲律宾广播新闻门户概念页面。本页面并非 GMA 官方网站。",
|
||||
"columns": [
|
||||
{"id": "news", "title": "新闻", "links": [{"label": "头条新闻", "href": "#topnews"}, {"label": "地区新闻", "href": "#latest"}, {"label": "财经", "href": "#channels"}, {"label": "体育", "href": "#channels"}]},
|
||||
{"id": "multimedia", "title": "多媒体", "links": [{"label": "视频", "href": "#videos"}, {"label": "广播", "href": "#radio"}, {"label": "电视节目表", "href": "#onair"}, {"label": "新闻简报", "href": "#newsletter"}]},
|
||||
{"id": "about", "title": "关于", "links": [{"label": "关于我们", "href": "#footer"}, {"label": "联系我们", "href": "#footer"}, {"label": "编辑政策", "href": "#footer"}, {"label": "工作机会", "href": "#footer"}]}
|
||||
],
|
||||
"copyright": "© 2026 GMA 新闻概念页面",
|
||||
"legal": "隐私 · 条款 · 无障碍访问 · 更正说明"
|
||||
}
|
||||
}
|
||||
+315
@@ -0,0 +1,315 @@
|
||||
(() => {
|
||||
"use strict";
|
||||
|
||||
const MODULES = ["site", "navigation", "justIn", "lead", "news", "services", "broadcast", "channels", "media", "footer"];
|
||||
const MODULE_META = {site:"站点信息",navigation:"页面导航",justIn:"即时新闻",lead:"头条新闻",news:"新闻信息流",services:"天气与服务",broadcast:"电视直播",channels:"数据与频道",media:"视频广播",footer:"页面页脚"};
|
||||
const node = (id) => document.getElementById(id);
|
||||
const clone = (value) => JSON.parse(JSON.stringify(value));
|
||||
const initialText = node("gmaNewsPageData").textContent;
|
||||
const initialData = JSON.parse(initialText);
|
||||
const fingerprint = (() => { let hash=2166136261; for(let i=0;i<initialText.length;i+=1){hash^=initialText.charCodeAt(i);hash=Math.imul(hash,16777619)} return (hash>>>0).toString(36) })();
|
||||
const dataKey = "gma-news-page-data-v1:" + fingerprint;
|
||||
const themeKey = "gma-news-page-theme-v1:" + fingerprint;
|
||||
const readStorage = (key) => { try{return window.localStorage.getItem(key)}catch(_error){return null} };
|
||||
const writeStorage = (key,value) => { try{window.localStorage.setItem(key,value);return true}catch(_error){return false} };
|
||||
const removeStorage = (key) => { try{window.localStorage.removeItem(key)}catch(_error){/* optional storage */} };
|
||||
let data = clone(initialData);
|
||||
try { const saved=readStorage(dataKey); if(saved)data=JSON.parse(saved) } catch(_error) { data=clone(initialData) }
|
||||
let weatherMiniIndex=0, activeFeed="latest", activeTopic="transit", activeWeather="manila", activeGame="649", playing=false, captionsOn=true, currentModule=MODULES[0], toastTimer=0;
|
||||
const esc = (value) => String(value??"").replace(/[&<>'"]/g,(char)=>({"&":"&","<":"<",">":">","'":"'",'"':"""})[char]);
|
||||
const safeHref = (value) => typeof value==="string"&&value.startsWith("#")?value:"#main";
|
||||
const safeRemoteUrl=(value,kind="link")=>{const source=String(value||"").trim();if(!source)return"";const lower=source.toLowerCase();if(kind==="image"&&lower.startsWith("data:image/"))return source;if(kind==="video"&&lower.startsWith("data:video/"))return source;try{const url=new URL(source);return["http:","https:"].includes(url.protocol)?url.href:""}catch(_error){return""}};
|
||||
const setText = (id,value) => {const el=node(id);if(el)el.textContent=value??""};
|
||||
const setLink = (id,label,href) => {const el=node(id);if(el){el.textContent=label??"";el.href=safeHref(href)}};
|
||||
const links = (items,className="") => (items||[]).map((item)=>`<a class="${className}" href="${esc(safeHref(item.href))}">${esc(item.label)}</a>`).join("");
|
||||
document.head.insertAdjacentHTML("beforeend",'<style data-external-media>[data-visual]>img,[data-visual]>video,[data-visual]>iframe{position:relative;z-index:1;width:100%;height:100%;display:block;border:0;object-fit:cover;background:#000}[data-visual]>iframe{object-fit:initial}.external-media::before,.external-media::after{display:none!important}.external-open{position:absolute;right:10px;bottom:10px;z-index:4;padding:7px 11px;color:#fff;background:rgba(0,0,0,.72);text-decoration:none;font-size:12px;font-weight:700}.external-copy{position:absolute;left:10px;right:10px;bottom:10px;z-index:4;padding:9px;color:#fff;background:rgba(0,0,0,.72);text-decoration:none}.external-copy strong,.external-copy span{display:block}.external-copy span{margin-top:3px;font-size:12px}</style>');
|
||||
const externalMedia=(media,label)=>{if(!media||typeof media!=="object")return"";if(media.type==="image"){const source=safeRemoteUrl(media.mediaUrl,"image"),page=safeRemoteUrl(media.pageUrl);return source?`<img src="${esc(source)}" alt="${esc(media.alt||label||"新闻图片")}" loading="lazy" referrerpolicy="no-referrer">${page?`<a class="external-open" href="${esc(page)}" target="_blank" rel="noopener noreferrer">打开来源</a>`:""}`:""}if(media.type==="video"){const source=safeRemoteUrl(media.mediaUrl,"video"),poster=safeRemoteUrl(media.posterUrl,"image");return source?`<video src="${esc(source)}"${poster?` poster="${esc(poster)}"`:""} controls playsinline preload="metadata" aria-label="${esc(media.alt||label||"新闻视频")}"></video>`:""}if(media.type==="webpage"){const page=safeRemoteUrl(media.pageUrl),preview=safeRemoteUrl(media.mediaUrl,"image");if(!page)return"";const body=media.embed===true?`<iframe src="${esc(page)}" title="${esc(media.title||"网页预览")}" loading="lazy" referrerpolicy="no-referrer" sandbox="allow-forms allow-popups allow-scripts"></iframe>`:(preview?`<img src="${esc(preview)}" alt="${esc(media.alt||media.title||"网页预览图")}" loading="lazy" referrerpolicy="no-referrer">`:"");return`${body}<a class="external-copy" href="${esc(page)}" target="_blank" rel="noopener noreferrer"><strong>${esc(media.title||label||"打开网页")}</strong><span>${esc(media.description||"新窗口打开")}</span></a>`}return""};
|
||||
const art = (visual,className="art",media=null,mediaPath="") => {const mediaMarkup=externalMedia(media,media?.title),path=mediaPath?` data-media-path="${esc(mediaPath)}"`:"";return `<div class="${className}${mediaMarkup?" external-media":""}" data-visual="${esc(visual)}"${path} aria-hidden="${mediaMarkup?"false":"true"}">${mediaMarkup}</div>`};
|
||||
function toast(message){const el=node("toast");el.textContent=message;el.classList.add("show");clearTimeout(toastTimer);toastTimer=setTimeout(()=>el.classList.remove("show"),2200)}
|
||||
|
||||
function renderSite(){
|
||||
document.documentElement.lang=data.site.language;document.title=data.site.pageTitle;document.querySelector('meta[name="description"]').content=data.site.description;
|
||||
setText("skipLink",data.site.skipLabel);setText("dateLabel",data.site.dateLabel);setText("brandPrimary",data.site.brandPrimary);setText("brandAccent",data.site.brandAccent);setText("brandTagline",data.site.tagline);
|
||||
setText("footerBrandPrimary",data.site.brandPrimary);setText("footerBrandAccent",data.site.brandAccent);setText("footerTagline",data.site.tagline);setText("drawerBrand",`${data.site.brandPrimary} ${data.site.brandAccent}`);setText("searchBrand",`${data.site.brandPrimary} ${data.site.brandAccent}`);
|
||||
const preferred=readStorage(themeKey);document.body.classList.toggle("contrast",preferred==="contrast"||(!preferred&&data.site.theme==="dark"));renderMiniWeather();
|
||||
}
|
||||
function renderNavigation(){
|
||||
node("menuOpen").setAttribute("aria-label",data.navigation.menuLabel);setText("liveLabel",data.navigation.liveLabel);node("topLinks").innerHTML=links(data.navigation.topLinks);node("primaryNav").innerHTML=data.navigation.primary.map((item,index)=>`<a class="${index===0?"active":""}" href="${esc(safeHref(item.href))}">${esc(item.label)}</a>`).join("");
|
||||
setText("drawerEyebrow",data.navigation.drawer.eyebrow);setText("drawerTitle",data.navigation.drawer.title);setText("drawerText",data.navigation.drawer.text);setLink("drawerCta",data.navigation.drawer.ctaLabel,data.navigation.drawer.ctaHref);node("drawerNav").innerHTML=links(data.navigation.primary,"drawer-link");
|
||||
setText("searchTitle",data.navigation.search.title);node("searchInput").placeholder=data.navigation.search.placeholder;setText("searchResult",data.navigation.search.hint);
|
||||
}
|
||||
function renderMiniWeather(){const items=data.site.weatherMini;if(!items.length)return;weatherMiniIndex%=items.length;const item=items[weatherMiniIndex];setText("miniCity",`${item.city} · ${item.temp}`);setText("miniSky",item.condition)}
|
||||
function renderJustIn(){setText("justLabel",data.justIn.label);setText("justFeatured",data.justIn.featured);const open=node("justPanel").classList.contains("open");setText("justToggle",open?data.justIn.closeLabel:data.justIn.moreLabel);node("justGrid").innerHTML=data.justIn.items.map((item)=>`<article class="just-item"><time>${esc(item.time)}</time><a href="${esc(safeHref(item.href))}">${esc(item.title)}</a><span>${esc(item.category)}</span></article>`).join("")}
|
||||
function renderLead(){
|
||||
const main=data.lead.main;node("mainStory").innerHTML=`${art(main.visual,"art",main.media,"lead.main")}<div class="shade"></div><button class="video-pill" data-player="${esc(main.id)}">▶ ${esc(main.videoLabel)}</button><div class="story-copy"><div class="eyebrow">${esc(main.kicker)}</div><h1>${esc(main.title)}</h1><p>${esc(main.summary)}</p><div class="story-meta"><span>${esc(main.byline)}</span><span>${esc(main.time)}</span><span>${esc(main.readTime)}</span></div></div>`;
|
||||
node("sideStories").innerHTML=data.lead.sideStories.map((item,index)=>`<article class="top-card">${art(item.visual,"art",item.media,`lead.sideStories.${index}`)}<div class="top-card-copy"><div class="eyebrow">${esc(item.kicker)}</div><h2>${esc(item.title)}</h2><p>${esc(item.summary)}</p><time>${esc(item.time)}</time></div></article>`).join("");
|
||||
node("headlineStrip").innerHTML=data.lead.headlines.map((item)=>`<article class="headline"><span>${esc(item.kicker)}</span><a href="${esc(safeHref(item.href))}">${esc(item.title)}</a></article>`).join("");
|
||||
}
|
||||
function renderNews(){
|
||||
setText("trackingTitle",data.news.trackingTitle);if(!data.news.topics.some((item)=>item.id===activeTopic))activeTopic=data.news.topics[0]?.id;node("trackingPills").innerHTML=data.news.topics.map((item)=>`<button class="track${item.id===activeTopic?" active":""}" data-topic="${esc(item.id)}">${esc(item.label)}</button>`).join("");const topic=data.news.topics.find((item)=>item.id===activeTopic)||data.news.topics[0];setText("trackingStatus",`${data.news.trackingStatusPrefix}:${topic.count} · ${topic.label}`);
|
||||
if(!data.news.feeds.some((item)=>item.id===activeFeed))activeFeed=data.news.feeds[0]?.id;node("feedTabs").innerHTML=data.news.feeds.map((feed)=>`<button class="${feed.id===activeFeed?"active":""}" data-feed="${esc(feed.id)}">${esc(feed.label)}</button>`).join("");node("feedPanels").innerHTML=data.news.feeds.map((feed,feedIndex)=>`<div class="feed-panel${feed.id===activeFeed?" active":""}" data-feed-panel="${esc(feed.id)}">${feed.items.map((item,itemIndex)=>`<article class="feed-item">${art(item.visual,"feed-art",item.media,`news.feeds.${feedIndex}.items.${itemIndex}`)}<div><div class="eyebrow">${esc(item.kicker)}</div><h3>${esc(item.title)}</h3><p>${esc(item.summary)}</p><time>${esc(item.time)}</time></div></article>`).join("")}</div>`).join("");
|
||||
setText("trendingTitle",data.news.trendingTitle);setText("trendingLabel",data.news.trendingLabel);node("trendingList").innerHTML=data.news.trendingItems.map((item,index)=>`<div class="trend-item"><b>${index+1}</b><a href="${esc(safeHref(item.href))}">${esc(item.title)}</a></div>`).join("");
|
||||
}
|
||||
function renderServices(){
|
||||
setText("weatherTitle",data.services.weatherTitle);setText("weatherLive",data.services.weatherLiveLabel);if(!data.services.locations.some((item)=>item.id===activeWeather))activeWeather=data.services.locations[0]?.id;node("weatherSelect").innerHTML=data.services.locations.map((item)=>`<option value="${esc(item.id)}"${item.id===activeWeather?" selected":""}>${esc(item.city)}</option>`).join("");const weather=data.services.locations.find((item)=>item.id===activeWeather)||data.services.locations[0];setText("weatherTemp",weather.temp);setText("weatherCondition",weather.condition);node("forecast").innerHTML=weather.forecast.map((item)=>`<div>${esc(item.day)}<b>${esc(item.temp)}</b>${esc(item.label)}</div>`).join("");setText("publicTitle",data.services.publicTitle);node("serviceLinks").innerHTML=data.services.publicItems.map((item)=>`<button data-service="${esc(item.id)}">${esc(item.label)}</button>`).join("");
|
||||
}
|
||||
function renderBroadcast(){
|
||||
const hero=data.broadcast.hero,mediaMarkup=externalMedia(hero.media,hero.title),broadcastArt=node("broadcastArt"),stage=broadcastArt.closest(".tv-stage");broadcastArt.className=`tv-art${mediaMarkup?" external-media":""}`;broadcastArt.dataset.visual=hero.visual;broadcastArt.dataset.mediaPath="broadcast.hero";broadcastArt.setAttribute("aria-hidden",mediaMarkup?"false":"true");broadcastArt.innerHTML=mediaMarkup;stage.classList.toggle("has-external-media",Boolean(mediaMarkup));setText("broadcastTitle",data.broadcast.title);setLink("broadcastMore",data.broadcast.moreLabel,data.broadcast.moreHref);setText("broadcastEyebrow",data.broadcast.eyebrow);setText("broadcastHeroTitle",hero.title);setText("broadcastHeroSummary",hero.summary);setText("watchLive",`▶ ${hero.actionLabel}`);setText("scheduleTitle",data.broadcast.scheduleTitle);node("scheduleSlots").innerHTML=data.broadcast.slots.map((item)=>`<div class="slot${item.live?" live":""}"><time>${esc(item.time)}</time><div><b>${esc(item.title)}</b><span>${esc(item.summary)}</span></div></div>`).join("");setText("playerBrand",data.broadcast.modal.brand);setText("playerQuality",data.broadcast.modal.quality);updateCaption();
|
||||
}
|
||||
function renderChannels(){
|
||||
setText("glanceTitle",data.channels.glanceTitle);setLink("glanceMore",data.channels.glanceMoreLabel,data.channels.glanceMoreHref);node("glanceGrid").innerHTML=data.channels.glanceItems.map((item)=>`<article class="glance-card"><div class="eyebrow">${esc(item.kicker)}</div><strong>${esc(item.value)}</strong><p>${esc(item.text)}</p><a href="${esc(safeHref(item.actionHref))}">${esc(item.actionLabel)} →</a></article>`).join("");setText("deskTitle",data.channels.deskTitle);setLink("deskMore",data.channels.deskMoreLabel,data.channels.deskMoreHref);node("channelGrid").innerHTML=data.channels.deskItems.map((item,index)=>`<article class="channel-card">${art(item.visual,"channel-art",item.media,`channels.deskItems.${index}`)}<div class="channel-copy"><div class="eyebrow">${esc(item.kicker)}</div><h3>${esc(item.title)}</h3><p>${esc(item.summary)}</p></div></article>`).join("");
|
||||
}
|
||||
function renderMedia(){
|
||||
setText("videosTitle",data.media.videosTitle);setLink("videosMore",data.media.videosMoreLabel,data.media.videosMoreHref);node("videoGrid").innerHTML=data.media.videos.map((item,index)=>`<article class="video-card"><div class="video-art${item.media?" external-media":""}" data-visual="${esc(item.visual)}" data-media-path="media.videos.${index}">${externalMedia(item.media,item.title)}<span class="video-duration">${esc(item.duration)}</span><button class="video-open" type="button" data-player="${esc(item.id)}" aria-label="播放视频:${esc(item.title)}"></button></div><div class="video-copy"><div class="eyebrow">${esc(item.kicker)}</div><h3>${esc(item.title)}</h3><p>${esc(item.summary)}</p></div></article>`).join("");setText("podcastEyebrow",data.media.podcast.eyebrow);setText("podcastTitle",data.media.podcast.title);setText("podcastText",data.media.podcast.text);node("audioPlay").setAttribute("aria-label",playing?data.media.podcast.pauseLabel:data.media.podcast.playLabel);setText("audioPlay",playing?"Ⅱ":"▶");setText("audioTime",playing?data.media.podcast.playingTime:data.media.podcast.startTime);node("audioProgress").style.width=playing?"57%":"38%";
|
||||
if(!data.media.lotto.games.some((item)=>item.id===activeGame))activeGame=data.media.lotto.games[0]?.id;setText("lottoEyebrow",data.media.lotto.eyebrow);setText("lottoTitle",data.media.lotto.title);node("lottoTabs").innerHTML=data.media.lotto.games.map((item)=>`<button class="${item.id===activeGame?"active":""}" data-game="${esc(item.id)}">${esc(item.label)}</button>`).join("");const game=data.media.lotto.games.find((item)=>item.id===activeGame)||data.media.lotto.games[0];node("lottoBalls").innerHTML=game.numbers.map((number)=>`<span class="ball">${esc(number)}</span>`).join("");setText("lottoNote",`${game.label} · ${data.media.lotto.date}`);
|
||||
setText("newsletterTitle",data.media.newsletter.title);setText("newsletterText",data.media.newsletter.text);setText("newsletterLabel",data.media.newsletter.label);node("email").placeholder=data.media.newsletter.placeholder;setText("newsletterButton",data.media.newsletter.button);
|
||||
}
|
||||
function renderFooter(){setText("footerDescription",data.footer.description);node("footerColumns").innerHTML=data.footer.columns.map((column)=>`<nav class="foot-col"><h3>${esc(column.title)}</h3>${links(column.links)}</nav>`).join("");setText("footerCopyright",data.footer.copyright);setText("footerLegal",data.footer.legal)}
|
||||
function renderAll(){renderSite();renderNavigation();renderJustIn();renderLead();renderNews();renderServices();renderBroadcast();renderChannels();renderMedia();renderFooter()}
|
||||
|
||||
function openLayer(id){const el=node(id);el.classList.add("open");document.body.classList.add("locked")}
|
||||
function closeLayer(id){node(id).classList.remove("open");if(!document.querySelector(".drawer.open,.search-overlay.open,.player-modal.open,.settings-overlay.open"))document.body.classList.remove("locked")}
|
||||
function openPlayer(id){const item=data.media.videos.find((video)=>video.id===id);const isMain=id===data.lead.main.id;setText("playerTitle",item?.title||data.broadcast.modal.title);setText("playerNote",item?.summary||(isMain?data.lead.main.summary:data.broadcast.modal.note));captionsOn=true;updateCaption();openLayer("playerModal")}
|
||||
function updateCaption(){setText("captionToggle",captionsOn?data.broadcast.modal.captionsOn:data.broadcast.modal.captionsOff)}
|
||||
function searchStories(){const raw=node("searchInput").value.trim();const query=raw.toLowerCase();const strings=[];const walk=(value)=>{if(Array.isArray(value))value.forEach(walk);else if(value&&typeof value==="object")Object.values(value).forEach(walk);else if(typeof value==="string")strings.push(value)};walk(data);const count=query?strings.filter((value)=>value.toLowerCase().includes(query)).length:0;setText("searchResult",query?`${count}${data.navigation.search.resultPrefix}“${raw}”`:data.navigation.search.emptyMessage)}
|
||||
|
||||
function validateClient(candidate){
|
||||
if(!candidate||typeof candidate!=="object"||Array.isArray(candidate))throw new Error("顶层 JSON 必须是对象。");const keys=Object.keys(candidate),missing=MODULES.filter((name)=>!keys.includes(name)),extra=keys.filter((name)=>!MODULES.includes(name));if(missing.length)throw new Error(`缺少模块:${missing.join("、")}`);if(extra.length)throw new Error(`存在未知模块:${extra.join("、")}`);MODULES.forEach((name)=>{if(!candidate[name]||typeof candidate[name]!=="object"||Array.isArray(candidate[name]))throw new Error(`${name} 必须是对象。`)});const text=JSON.stringify(candidate).toLowerCase();if(["<script","<iframe","javascript:"].some((token)=>text.includes(token)))throw new Error("不允许使用 HTML 或脚本。");const validateMedia=(value,path="当前模块")=>{if(Array.isArray(value))return value.forEach((item,index)=>validateMedia(item,`${path}[${index}]`));if(!value||typeof value!=="object")return;const media=value.media;if(media&&["image","video","webpage"].includes(media.type)){if(["image","video"].includes(media.type)&&!safeRemoteUrl(media.mediaUrl,media.type))throw new Error(`${path}.media.mediaUrl 无效。`);if(media.type==="webpage"&&!safeRemoteUrl(media.pageUrl))throw new Error(`${path}.media.pageUrl 无效。`);if(media.posterUrl&&!safeRemoteUrl(media.posterUrl,"image"))throw new Error(`${path}.media.posterUrl 无效。`)}Object.entries(value).forEach(([key,item])=>{if(key!=="media")validateMedia(item,`${path}.${key}`)})};validateMedia(candidate);if(candidate.site.language!=="zh-CN")throw new Error("site.language 必须是 zh-CN。");const technical=new Set(["id","href","visual","theme","language","brandPrimary","type","mediaUrl","posterUrl","pageUrl"]);const check=(value,key="")=>{if(Array.isArray(value))value.forEach((item)=>check(item,key));else if(value&&typeof value==="object")Object.entries(value).forEach(([child,item])=>check(item,child));else if(typeof value==="string"&&!technical.has(key)&&!key.toLowerCase().endsWith("id")&&!key.toLowerCase().endsWith("href")&&!key.toLowerCase().endsWith("url")&&/[A-Za-z]/.test(value)&&!/[\u3400-\u9fff]/.test(value))throw new Error("除品牌缩写 GMA 外,所有读者可见文案必须使用简体中文。")};check(candidate);return true;
|
||||
}
|
||||
function renderSettingsTabs(){node("moduleTabs").innerHTML=MODULES.map((name)=>`<button class="module-tab${name===currentModule?" active":""}" data-module="${name}">${MODULE_META[name]}</button>`).join("");showModule(currentModule)}
|
||||
function showModule(name){currentModule=name;node("moduleTabs").querySelectorAll("button").forEach((button)=>button.classList.toggle("active",button.dataset.module===name));setText("editorModule",MODULE_META[name]);node("jsonEditor").value=JSON.stringify(data[name],null,2);setText("jsonValidity","JSON 有效")}
|
||||
function parseEditor(){try{const value=JSON.parse(node("jsonEditor").value);if(!value||typeof value!=="object"||Array.isArray(value))throw new Error("当前模块必须是对象。");setText("jsonValidity","JSON 有效");return value}catch(error){setText("jsonValidity","JSON 无效");throw error}}
|
||||
const setStatus=(message)=>setText("settingsStatus",message);
|
||||
function applyEditor(){try{const candidate={...data,[currentModule]:parseEditor()};validateClient(candidate);data=candidate;writeStorage(dataKey,JSON.stringify(data));renderAll();renderSettingsTabs();setStatus("JSON 已应用并完成渲染。") }catch(error){setStatus(error.message);setText("jsonValidity","JSON 无效")}}
|
||||
async function copyJson(){const candidate={...data,[currentModule]:parseEditor()};validateClient(candidate);const text=JSON.stringify(candidate,null,2);try{await navigator.clipboard.writeText(text);setStatus("完整 JSON 已复制。") }catch(_error){node("jsonEditor").select();document.execCommand("copy");setStatus("已选中当前模块,可手动复制。")}}
|
||||
function downloadJson(){const candidate={...data,[currentModule]:parseEditor()};validateClient(candidate);const blob=new Blob([JSON.stringify(candidate,null,2)+"\n"],{type:"application/json"}),url=URL.createObjectURL(blob),anchor=document.createElement("a");anchor.href=url;anchor.download="gma-news-page-data.json";anchor.click();URL.revokeObjectURL(url);setStatus("JSON 下载文件已生成。")}
|
||||
|
||||
node("justToggle").addEventListener("click",()=>{const open=node("justPanel").classList.toggle("open");node("justToggle").setAttribute("aria-expanded",String(open));renderJustIn()});
|
||||
node("weatherMini").addEventListener("click",()=>{weatherMiniIndex+=1;renderMiniWeather();toast(`天气已切换至${data.site.weatherMini[weatherMiniIndex%data.site.weatherMini.length].city}`)});
|
||||
node("menuOpen").addEventListener("click",()=>openLayer("drawer"));node("searchOpen").addEventListener("click",()=>{openLayer("searchOverlay");setTimeout(()=>node("searchInput").focus(),0)});node("liveButton").addEventListener("click",()=>openPlayer("live"));node("watchLive").addEventListener("click",()=>openPlayer("live"));
|
||||
node("contrastToggle").addEventListener("click",()=>{const on=document.body.classList.toggle("contrast");writeStorage(themeKey,on?"contrast":"standard");toast(on?data.navigation.contrastOnLabel:data.navigation.contrastOffLabel)});
|
||||
node("weatherSelect").addEventListener("change",(event)=>{activeWeather=event.target.value;renderServices();toast(`天气已更新为${event.target.options[event.target.selectedIndex].text}`)});
|
||||
node("searchForm").addEventListener("submit",(event)=>{event.preventDefault();searchStories()});node("captionToggle").addEventListener("click",()=>{captionsOn=!captionsOn;updateCaption();toast(captionsOn?data.broadcast.modal.captionsOn:data.broadcast.modal.captionsOff)});
|
||||
node("audioPlay").addEventListener("click",()=>{playing=!playing;renderMedia();toast(playing?data.media.podcast.playLabel:data.media.podcast.pauseLabel)});node("subForm").addEventListener("submit",(event)=>{event.preventDefault();const email=node("email").value.trim();setText("subStatus",`${data.media.newsletter.successPrefix} ${email}。`);event.currentTarget.reset()});
|
||||
document.addEventListener("click",(event)=>{const close=event.target.closest("[data-close]");if(close){closeLayer(close.dataset.close);return}const topic=event.target.closest("[data-topic]");if(topic){activeTopic=topic.dataset.topic;renderNews();return}const feed=event.target.closest("[data-feed]");if(feed){activeFeed=feed.dataset.feed;renderNews();return}const service=event.target.closest("[data-service]");if(service){const item=data.services.publicItems.find((value)=>value.id===service.dataset.service);if(item)toast(item.message);return}const player=event.target.closest("[data-player]");if(player){openPlayer(player.dataset.player);return}const game=event.target.closest("[data-game]");if(game){activeGame=game.dataset.game;renderMedia();return}const module=event.target.closest("[data-module]");if(module&&module.closest("#moduleTabs")){showModule(module.dataset.module)}});
|
||||
["drawer","searchOverlay","playerModal","settingsOverlay"].forEach((id)=>node(id).addEventListener("click",(event)=>{if(event.target===node(id))closeLayer(id)}));document.addEventListener("keydown",(event)=>{if(event.key==="Escape"){["drawer","searchOverlay","playerModal","settingsOverlay"].forEach((id)=>{if(node(id).classList.contains("open"))closeLayer(id)});node("justPanel").classList.remove("open")}});window.addEventListener("scroll",()=>document.body.classList.toggle("sticky",window.scrollY>220),{passive:true});
|
||||
node("openSettings").addEventListener("click",()=>{renderSettingsTabs();setStatus("");openLayer("settingsOverlay")});node("validateJson").addEventListener("click",()=>{try{const candidate={...data,[currentModule]:parseEditor()};validateClient(candidate);setStatus("完整 JSON 校验通过。")}catch(error){setStatus(error.message)}});node("copyJson").addEventListener("click",()=>copyJson().catch((error)=>setStatus(error.message)));node("downloadJson").addEventListener("click",()=>{try{downloadJson()}catch(error){setStatus(error.message)}});node("resetJson").addEventListener("click",()=>{data=clone(initialData);removeStorage(dataKey);removeStorage(themeKey);currentModule=MODULES[0];activeFeed="latest";activeTopic="transit";activeWeather="manila";activeGame="649";playing=false;renderAll();renderSettingsTabs();setStatus("已恢复内嵌初始 JSON。")});node("applyJson").addEventListener("click",applyEditor);
|
||||
|
||||
validateClient(data);renderAll();
|
||||
function installJsonMediaUpload(){
|
||||
const editor=document.getElementById("jsonEditor"),apply=document.getElementById("applyJson");if(!editor||!apply||document.getElementById("uploadJsonMedia"))return;
|
||||
const actions=apply.parentElement,button=document.createElement("button"),input=document.createElement("input"),reference=actions.querySelector("#downloadJson,#copyJson,#validateJson,#resetJson");button.type="button";button.id="uploadJsonMedia";button.className=reference?reference.className:apply.className;button.textContent="上传图片/视频";button.title="先把光标放进要替换的内容对象,再选择图片或视频";input.type="file";input.accept="image/*,video/*";input.hidden=true;actions.insertBefore(button,apply);actions.appendChild(input);
|
||||
const report=(message)=>{const status=document.getElementById("settingsStatus")||document.getElementById("jsonError")||document.getElementById("jsonStatus");if(status)status.textContent=message};
|
||||
const findTarget=(text,cursor)=>{const stack=[],matches=[];let quoted=false,escaped=false;for(let index=0;index<text.length;index+=1){const char=text[index];if(quoted){if(escaped)escaped=false;else if(char==="\\")escaped=true;else if(char==='"')quoted=false;continue}if(char==='"'){quoted=true;continue}if(char==="{")stack.push(index);else if(char==="}"){const start=stack.pop();if(start===undefined||cursor<start||cursor>index+1)continue;try{const value=JSON.parse(text.slice(start,index+1)),own=(key)=>Object.prototype.hasOwnProperty.call(value,key);if(value&&!Array.isArray(value)&&(own("media")||own("visual")||(own("id")&&(own("text")||own("title"))&&(own("author")||own("channel")||own("user")))))matches.push({start,end:index+1,value})}catch(_error){/* full validator handles malformed JSON */}}}return matches.sort((left,right)=>(left.end-left.start)-(right.end-right.start))[0]||null};
|
||||
button.addEventListener("click",()=>{input.value="";report("请选择图片或视频;文件会写入光标所在内容对象的 media 字段。");input.click()});
|
||||
input.addEventListener("change",()=>{const file=input.files&&input.files[0];if(!file)return;const type=file.type.startsWith("image/")?"image":file.type.startsWith("video/")?"video":"";if(!type){report("仅支持图片或视频文件。");return}const target=findTarget(editor.value,editor.selectionStart);if(!target){report("请先把光标放进带 visual/media 的内容对象,或带 id 的帖子/视频对象内。");return}const reader=new FileReader();reader.onerror=()=>report("文件读取失败,请重新选择。");reader.onload=()=>{const previous=target.value.media&&typeof target.value.media==="object"?target.value.media:{},media={type,mediaUrl:String(reader.result)};for(const key of ["alt","label","caption","pageUrl"])if(typeof previous[key]==="string")media[key]=previous[key];if(!media.alt)media.alt=type==="image"?"用户上传的图片":"用户上传的视频";target.value.media=media;const lineStart=editor.value.lastIndexOf("\n",target.start-1)+1,indent=(editor.value.slice(lineStart,target.start).match(/^\s*/)||[""])[0],replacement=JSON.stringify(target.value,null,2).split("\n").map((line,index)=>index?indent+line:line).join("\n");editor.value=editor.value.slice(0,target.start)+replacement+editor.value.slice(target.end);editor.dispatchEvent(new Event("input",{bubbles:true}));const mediaIndex=replacement.indexOf('"media"');editor.focus();editor.setSelectionRange(target.start+Math.max(mediaIndex,0),target.start+Math.max(mediaIndex,0));report(`已把 ${file.name} 写入 JSON,请点击“应用并渲染”。${file.size>2*1024*1024?" 文件较大,建议同时下载 JSON 保存。":""}`)};reader.readAsDataURL(file)});
|
||||
}
|
||||
installJsonMediaUpload();
|
||||
function installInlineMediaReplace() {
|
||||
if (document.getElementById("dfInlineMediaInput")) return;
|
||||
const visualHostSelector = "[data-media-path],.post-media,.video-visual,.thumbnail-visual,.short-thumb,.watch-visual,.thread-media,.visual,.lead-visual,.mini-visual,.compact-media,.card-art,.story-visual,.art,.video-art,.media-art,.player-stage,.thumbnail,.thumb,.list-thumb,.focus-thumb,.involve-bg,.hero-art,#heroArt,#adminArt";
|
||||
const getRootData = () => {
|
||||
if (typeof pageData !== "undefined") return pageData;
|
||||
if (typeof data !== "undefined") return data;
|
||||
return null;
|
||||
};
|
||||
const input = document.createElement("input");
|
||||
input.id = "dfInlineMediaInput";
|
||||
input.type = "file";
|
||||
input.hidden = true;
|
||||
document.body.appendChild(input);
|
||||
const style = document.createElement("style");
|
||||
style.dataset.dfInlineMediaReplace = "true";
|
||||
style.textContent = ".df-inline-media-host{position:relative!important}.df-inline-media-button{position:absolute;z-index:40;top:10px;right:10px;width:40px;height:40px;padding:0;border:1px solid rgba(255,255,255,.55);border-radius:50%;display:grid;place-items:center;color:#fff;background:rgba(8,15,28,.78);box-shadow:0 8px 24px rgba(0,0,0,.28);backdrop-filter:blur(8px);cursor:pointer;opacity:0;transform:translateY(-4px);transition:opacity .16s,transform .16s,background .16s}.df-inline-media-button:hover{background:rgba(20,110,240,.92)}.df-inline-media-button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.df-inline-media-host:hover>.df-inline-media-button,.df-inline-media-host:focus-within>.df-inline-media-button,.df-inline-media-button:focus-visible{opacity:1;transform:none}@media(hover:none){.df-inline-media-button{opacity:1;transform:none}}.df-inline-media-toast{position:fixed;z-index:2147483647;left:50%;bottom:28px;max-width:min(88vw,520px);padding:10px 14px;border-radius:10px;color:#fff;background:rgba(15,23,42,.94);box-shadow:0 12px 32px rgba(0,0,0,.28);font:600 13px/1.45 system-ui,sans-serif;transform:translateX(-50%)}";
|
||||
document.head.appendChild(style);
|
||||
const notify = (message) => {
|
||||
if (typeof showToast === "function") { showToast(message); return; }
|
||||
if (typeof toast === "function") { toast(message); return; }
|
||||
let notice = document.getElementById("dfInlineMediaToast");
|
||||
if (!notice) {
|
||||
notice = document.createElement("div");
|
||||
notice.id = "dfInlineMediaToast";
|
||||
notice.className = "df-inline-media-toast";
|
||||
document.body.appendChild(notice);
|
||||
}
|
||||
notice.textContent = message;
|
||||
window.clearTimeout(notice._timer);
|
||||
notice._timer = window.setTimeout(() => notice.remove(), 2600);
|
||||
};
|
||||
const sameSource = (value, source, absolute) => {
|
||||
if (typeof value !== "string") return false;
|
||||
if (value === source || value === absolute) return true;
|
||||
try { return new URL(value, location.href).href === absolute; } catch (_error) { return false; }
|
||||
};
|
||||
const findMatches = (source, absolute) => {
|
||||
const matches = [];
|
||||
const stack = [];
|
||||
const visit = (value) => {
|
||||
if (Array.isArray(value)) { value.forEach(visit); return; }
|
||||
if (!value || typeof value !== "object") return;
|
||||
stack.push(value);
|
||||
Object.entries(value).forEach(([key, item]) => {
|
||||
if ((key === "mediaUrl" || key === "posterUrl") && sameSource(item, source, absolute)) {
|
||||
const ancestors = stack.slice(0, -1).reverse();
|
||||
const owner = ancestors.find((candidate) => candidate && typeof candidate === "object" && !Array.isArray(candidate) && ("id" in candidate || "title" in candidate || "text" in candidate || "name" in candidate || "author" in candidate)) || ancestors[0] || value;
|
||||
matches.push({ owner, previous: value, key });
|
||||
}
|
||||
if (item && typeof item === "object") visit(item);
|
||||
});
|
||||
stack.pop();
|
||||
};
|
||||
visit(getRootData());
|
||||
return matches;
|
||||
};
|
||||
const visualOwners = () => {
|
||||
const owners = [];
|
||||
const seen = new Set();
|
||||
const visit = (value) => {
|
||||
if (Array.isArray(value)) { value.forEach(visit); return; }
|
||||
if (!value || typeof value !== "object") return;
|
||||
const hasVisual = Object.prototype.hasOwnProperty.call(value, "visual") || (value.media && typeof value.media === "object");
|
||||
const hasIdentity = ["id", "title", "text", "leadTitle", "feature", "name", "author"].some((key) => typeof value[key] === "string" && value[key].trim());
|
||||
if (hasVisual && hasIdentity && !seen.has(value)) { seen.add(value); owners.push(value); }
|
||||
Object.values(value).forEach((item) => { if (item && typeof item === "object") visit(item); });
|
||||
};
|
||||
visit(getRootData());
|
||||
return owners;
|
||||
};
|
||||
const domIdentifiers = (element) => {
|
||||
const values = new Set();
|
||||
let cursor = element;
|
||||
for (let depth = 0; cursor && cursor !== document.body && depth < 8; depth += 1, cursor = cursor.parentElement) {
|
||||
Object.values(cursor.dataset || {}).forEach((value) => { if (value) values.add(String(value)); });
|
||||
}
|
||||
return values;
|
||||
};
|
||||
const exactPathTarget = (element) => {
|
||||
const host = element.closest("[data-media-path]");
|
||||
const path = host && host.dataset ? host.dataset.mediaPath : "";
|
||||
if (!path) return null;
|
||||
const owner = path.split(".").reduce((value, segment) => {
|
||||
if (Array.isArray(value)) return value[Number(segment)];
|
||||
return value && typeof value === "object" ? value[segment] : null;
|
||||
}, getRootData());
|
||||
if (!owner || typeof owner !== "object" || Array.isArray(owner)) return null;
|
||||
return { owner, previous: owner.media && typeof owner.media === "object" ? owner.media : { type: "image" }, key: "mediaUrl" };
|
||||
};
|
||||
const chooseVisualTarget = (element) => {
|
||||
const exact = exactPathTarget(element);
|
||||
if (exact) return exact;
|
||||
const identifiers = domIdentifiers(element);
|
||||
const context = element.closest("article,button,[data-post-id],[data-video-id],[data-short-id],.post,.video-card,.news-card,.story-card,.lead-story,.hero") || element.parentElement || element;
|
||||
const contextText = String(context.textContent || "").replace(/\s+/g, " ").trim();
|
||||
const visualNode = element.closest("[data-visual]") || element.querySelector && element.querySelector("[data-visual]");
|
||||
const visualValue = visualNode && visualNode.dataset ? visualNode.dataset.visual : "";
|
||||
let best = null;
|
||||
let bestScore = 0;
|
||||
visualOwners().forEach((owner) => {
|
||||
let score = 0;
|
||||
Object.entries(owner).forEach(([key, value]) => {
|
||||
if (/id$/i.test(key) && identifiers.has(String(value))) score += 100;
|
||||
});
|
||||
["title", "text", "leadTitle", "feature", "visualLabel", "label", "author", "name", "summary"].forEach((key) => {
|
||||
const value = typeof owner[key] === "string" ? owner[key].trim() : "";
|
||||
if (value.length >= 2 && contextText.includes(value)) score += Math.min(40, value.length);
|
||||
});
|
||||
if (visualValue && owner.visual === visualValue) score += 20;
|
||||
if (score > bestScore) { best = owner; bestScore = score; }
|
||||
});
|
||||
if (!best || bestScore <= 0) return null;
|
||||
return { owner: best, previous: best.media && typeof best.media === "object" ? best.media : { type: "image" }, key: "mediaUrl" };
|
||||
};
|
||||
const chooseTarget = (element) => {
|
||||
const exact = exactPathTarget(element);
|
||||
if (exact) return exact;
|
||||
const source = element.getAttribute("src") || "";
|
||||
const absolute = element.currentSrc || element.src || source;
|
||||
const matches = findMatches(source, absolute);
|
||||
if (!matches.length) return null;
|
||||
const identifiers = domIdentifiers(element);
|
||||
return matches.find(({ owner }) => Object.entries(owner).some(([key, value]) => /id$/i.test(key) && identifiers.has(String(value)))) || matches[0];
|
||||
};
|
||||
const persist = () => {
|
||||
const root = getRootData();
|
||||
if (typeof saveData === "function") return saveData();
|
||||
if (typeof writeStorage === "function" && typeof storageKey !== "undefined") return writeStorage(storageKey, JSON.stringify(root));
|
||||
if (typeof writeStorage === "function" && typeof dataKey !== "undefined") return writeStorage(dataKey, JSON.stringify(root));
|
||||
return false;
|
||||
};
|
||||
let active = null;
|
||||
const attachButton = (host, target) => {
|
||||
if (!host || !target || host.querySelector(":scope > .df-inline-media-button")) return;
|
||||
host.classList.add("df-inline-media-host");
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "df-inline-media-button";
|
||||
button.setAttribute("aria-label", "替换图片或视频");
|
||||
button.title = "上传图片或视频并替换";
|
||||
button.innerHTML = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 16V4m0 0L7.5 8.5M12 4l4.5 4.5"/><path d="M5 14v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4"/></svg>';
|
||||
button.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
active = { ...target };
|
||||
input.accept = "image/*,video/*";
|
||||
input.value = "";
|
||||
input.click();
|
||||
});
|
||||
host.appendChild(button);
|
||||
};
|
||||
const decorateBuiltInVisuals = () => {
|
||||
document.querySelectorAll(visualHostSelector).forEach((host) => {
|
||||
if (host.querySelector("img[src],video[src],iframe[src],:scope > .df-inline-media-button")) return;
|
||||
if (!host.querySelector("svg") && !host.dataset.visual) return;
|
||||
const target = chooseVisualTarget(host);
|
||||
if (!target) return;
|
||||
attachButton(host, target);
|
||||
});
|
||||
};
|
||||
const decorate = () => {
|
||||
decorateBuiltInVisuals();
|
||||
document.querySelectorAll("img[src],video[src]").forEach((media) => {
|
||||
if (media.dataset.dfInlineMediaReady === "true") return;
|
||||
const target = chooseTarget(media);
|
||||
if (!target) return;
|
||||
const host = media.closest(visualHostSelector) || media.parentElement;
|
||||
if (!host) return;
|
||||
media.dataset.dfInlineMediaReady = "true";
|
||||
attachButton(host, target);
|
||||
});
|
||||
};
|
||||
input.addEventListener("change", () => {
|
||||
const file = input.files && input.files[0];
|
||||
if (!file || !active) return;
|
||||
const uploadedType = file.type.startsWith("image/") ? "image" : file.type.startsWith("video/") ? "video" : "";
|
||||
if (!uploadedType) {
|
||||
notify("请选择图片或视频文件。");
|
||||
return;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onerror = () => notify("文件读取失败,请重新选择。");
|
||||
reader.onload = () => {
|
||||
const next = { ...(active.previous || {}) };
|
||||
const result = String(reader.result);
|
||||
next.type = uploadedType;
|
||||
next.mediaUrl = result;
|
||||
delete next.posterUrl;
|
||||
if (!next.alt) next.alt = uploadedType === "video" ? "用户上传的视频" : "用户上传的图片";
|
||||
active.owner.media = next;
|
||||
const stored = persist();
|
||||
renderAll();
|
||||
notify(stored === false ? "媒体已替换;浏览器未能缓存,请下载 JSON 留存。" : "媒体已替换并写入页面 JSON。");
|
||||
active = null;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
let queued = false;
|
||||
const queueDecorate = () => {
|
||||
if (queued) return;
|
||||
queued = true;
|
||||
requestAnimationFrame(() => { queued = false; decorate(); });
|
||||
};
|
||||
new MutationObserver(queueDecorate).observe(document.body, { childList: true, subtree: true });
|
||||
decorate();
|
||||
}
|
||||
installInlineMediaReplace();
|
||||
})();
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="description" content="GMA 新闻中文广播新闻门户概念页面">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title>GMA 新闻——菲律宾广播新闻门户</title>
|
||||
<style>
|
||||
:root{--navy:#071d38;--blue:#084c9e;--blue2:#0c66c2;--red:#e31e2f;--red2:#b80f22;--yellow:#ffc627;--ink:#17202b;--muted:#66717f;--bg:#f3f5f8;--card:#fff;--line:#dce2e8;--soft:#e9eff6;--green:#13855b;--max:1280px;--sans:Arial,"Microsoft YaHei",sans-serif;--ease:200ms ease}
|
||||
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--sans)}body.contrast{--bg:#0c1520;--card:#131f2d;--ink:#f7f9fb;--muted:#b6c0ca;--line:#384653;--soft:#1c2a38}body.locked{overflow:hidden}a{color:inherit;text-decoration:none}button,input,select{font:inherit}button{border:0;background:none;color:inherit}a,button{cursor:pointer;touch-action:manipulation}:focus-visible{outline:3px solid var(--yellow);outline-offset:3px}.skip{position:fixed;z-index:400;left:10px;top:8px;background:#fff;color:#111;padding:10px 14px;font-weight:800;transform:translateY(-160%)}.skip:focus{transform:none}.wrap{width:min(var(--max),calc(100% - 40px));margin:auto}.eyebrow{font-size:11px;font-weight:900;letter-spacing:.13em;color:var(--red)}.section{padding:46px 0}.section-head{display:flex;align-items:center;justify-content:space-between;border-bottom:4px solid var(--blue);padding-bottom:10px;margin-bottom:22px}.section-head h2{margin:0;font-size:30px;line-height:1;font-weight:900}.section-head a{color:var(--blue);font-size:12px;font-weight:900}.icon-btn{width:44px;height:44px;display:grid;place-items:center;border:1px solid var(--line);background:var(--card);transition:background var(--ease),color var(--ease);font-size:19px}.icon-btn:hover{background:var(--blue);color:#fff}.btn{min-height:44px;padding:0 18px;display:inline-flex;align-items:center;justify-content:center;background:var(--red);color:#fff;font-size:12px;font-weight:900;transition:background var(--ease),transform var(--ease)}.btn:hover{background:var(--red2)}.btn:active{transform:scale(.97)}
|
||||
.just-bar{background:#071c36;color:#fff;position:relative;z-index:90}.just-row{height:42px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:16px}.just-label{height:42px;display:flex;align-items:center;gap:8px;background:var(--red);padding:0 17px;font-size:11px;font-weight:900}.live-dot{width:9px;height:9px;border-radius:50%;background:#fff;box-shadow:0 0 0 4px rgba(255,255,255,.2)}.just-copy{font-size:13px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.just-toggle{height:42px;color:#fff;font-size:11px;font-weight:900}.just-panel{position:absolute;left:0;right:0;top:42px;background:#fff;color:#17202b;box-shadow:0 15px 40px rgba(0,0,0,.25);max-height:0;overflow:hidden;transition:max-height 280ms ease}.just-panel.open{max-height:340px}.just-grid{display:grid;grid-template-columns:repeat(4,1fr);padding:22px 0}.just-item{padding:0 22px;border-right:1px solid #dce2e8}.just-item:last-child{border:0}.just-item time{color:var(--red);font-size:10px;font-weight:900}.just-item a{display:block;font-weight:800;line-height:1.25;margin:6px 0}.just-item span{font-size:10px;color:#6a7480}
|
||||
.topline{background:var(--card);border-bottom:1px solid var(--line)}.top-row{height:35px;display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:10px}.top-links{display:flex;gap:18px}.head{background:var(--card)}.head-row{height:96px;display:grid;grid-template-columns:1fr auto 1fr;align-items:center}.head-side{display:flex;align-items:center;gap:10px}.head-side.right{justify-content:flex-end}.brand{display:flex;align-items:center;gap:11px}.brand-mark{width:62px;height:62px;border-radius:50%;background:linear-gradient(135deg,var(--blue) 0 48%,var(--red) 48% 78%,var(--yellow) 78%);position:relative}.brand-mark::after{content:"";position:absolute;inset:13px;border:7px solid white;border-top-color:transparent;border-radius:50%;transform:rotate(-26deg)}.brand-copy strong{display:block;font-size:31px;line-height:.9;font-weight:1000;letter-spacing:-.045em;color:var(--blue)}.brand-copy strong span{color:var(--red)}.brand-copy small{font-size:9px;font-weight:900;letter-spacing:.16em;color:var(--muted)}.weather-mini{display:flex;align-items:center;gap:8px;padding:0 10px;min-height:44px;text-align:left}.weather-sun{width:26px;height:26px;border-radius:50%;background:var(--yellow);box-shadow:11px 9px 0 -4px #8cb7d0}.weather-mini b{display:block;font-size:11px}.weather-mini span span{display:block;color:var(--muted);font-size:9px}.live-btn{min-height:44px;display:flex;align-items:center;gap:9px;padding:0 15px;background:var(--red);color:#fff;font-size:11px;font-weight:900}.nav{background:var(--blue);color:#fff;position:relative;z-index:70}.nav-row{height:48px;display:flex;align-items:center;overflow:auto;scrollbar-width:none}.nav-row::-webkit-scrollbar{display:none}.nav-row a{align-self:stretch;display:flex;align-items:center;padding:0 17px;border-right:1px solid rgba(255,255,255,.22);font-size:11px;font-weight:900;white-space:nowrap}.nav-row a:first-child{border-left:1px solid rgba(255,255,255,.22)}.nav-row a.active,.nav-row a:hover{background:var(--red)}body.sticky .nav{position:fixed;left:0;right:0;top:0;box-shadow:0 5px 20px rgba(0,0,0,.25)}
|
||||
.hero{padding:26px 0 38px}.hero-grid{display:grid;grid-template-columns:minmax(0,1.52fr) minmax(330px,.78fr);gap:20px}.main-story{position:relative;min-height:535px;background:var(--navy);color:#fff;overflow:hidden;display:flex;align-items:flex-end}.art{position:relative;overflow:hidden;background:linear-gradient(145deg,#4f86b4,#d7b17b)}.main-story .art{position:absolute;inset:0}.art::before,.art::after{content:"";position:absolute}.art::before{left:6%;right:6%;bottom:24%;height:25%;background:linear-gradient(90deg,#345a70 0 18%,#e9edf0 18% 38%,#345a70 38% 56%,#e31e2f 56% 77%,#345a70 77%);clip-path:polygon(4% 100%,13% 20%,90% 20%,98% 100%)}.art::after{left:-5%;right:-5%;bottom:8%;height:9%;border-top:13px solid white;border-bottom:10px solid #72a8c2;transform:rotate(-1deg)}.shade{position:absolute;inset:0;background:linear-gradient(transparent 27%,rgba(1,19,39,.96))}.story-copy{position:relative;z-index:2;padding:34px;width:min(830px,94%)}.story-copy .eyebrow{color:#ffdd6a}.story-copy h1{font-size:clamp(39px,4.6vw,66px);line-height:.95;letter-spacing:-.05em;margin:8px 0 13px}.story-copy p{font-size:17px;color:#dce8f4;margin:0 0 17px;max-width:720px}.story-meta{display:flex;gap:14px;flex-wrap:wrap;font-size:10px}.video-pill{position:absolute;z-index:3;right:22px;top:22px;min-height:42px;background:var(--red);color:#fff;padding:0 14px;font-size:11px;font-weight:900}.top-stack{display:grid;grid-template-rows:1fr 1fr;gap:16px}.top-card{background:var(--card);display:grid;grid-template-columns:145px 1fr;border:1px solid var(--line)}.top-card .art{min-height:100%;background:linear-gradient(145deg,#a9cdb6,#3d705d)}.top-card:nth-child(2) .art{background:linear-gradient(145deg,#d9c7b4,#13518c)}.top-card-copy{padding:18px}.top-card h2{font-size:23px;line-height:1.04;margin:7px 0 10px}.top-card p{font-size:12px;color:var(--muted);margin:0}.top-card time{display:block;font-size:9px;color:var(--muted);margin-top:12px}.headline-strip{margin-top:20px;display:grid;grid-template-columns:repeat(4,1fr);background:var(--card);border:1px solid var(--line)}.headline{padding:18px;border-right:1px solid var(--line)}.headline:last-child{border:0}.headline span{font-size:9px;color:var(--red);font-weight:900}.headline a{display:block;font-size:14px;line-height:1.3;font-weight:800;margin-top:6px}
|
||||
.tracking{background:var(--navy);color:#fff;padding:22px 0}.tracking-row{display:grid;grid-template-columns:auto 1fr;gap:25px;align-items:center}.tracking h2{font-size:17px;margin:0}.tracking-pills{display:flex;gap:9px;overflow:auto}.track{min-height:42px;padding:0 17px;border:1px solid rgba(255,255,255,.42);color:#fff;white-space:nowrap;font-size:11px;font-weight:900}.track.active,.track:hover{background:var(--red);border-color:var(--red)}.tracking-status{grid-column:2;color:#bad0e5;font-size:12px;min-height:18px;margin-top:-12px}.news-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(310px,.7fr);gap:28px}.feed-tabs{display:flex;border-bottom:3px solid var(--blue);margin-bottom:18px}.feed-tabs button{min-height:45px;padding:0 22px;font-size:11px;font-weight:900}.feed-tabs button.active{background:var(--blue);color:#fff}.feed-panel{display:none}.feed-panel.active{display:block}.feed-item{display:grid;grid-template-columns:180px 1fr;gap:17px;padding-bottom:18px;margin-bottom:18px;border-bottom:1px solid var(--line)}.feed-art{height:112px;background:linear-gradient(145deg,#9fc6d6,#255d79);position:relative;overflow:hidden}.feed-art::after{content:"";position:absolute;left:15%;right:15%;bottom:0;height:65%;background:repeating-linear-gradient(90deg,rgba(255,255,255,.75) 0 13px,transparent 13px 23px)}.feed-item h3{font-size:21px;line-height:1.08;margin:5px 0 8px}.feed-item p{font-size:13px;color:var(--muted);margin:0}.feed-item time{font-size:9px;color:var(--muted)}.side-rail{display:flex;flex-direction:column;gap:20px}.rail-card{background:var(--card);border:1px solid var(--line);padding:20px}.rail-title{display:flex;justify-content:space-between;align-items:center;border-bottom:3px solid var(--red);padding-bottom:10px;margin-bottom:6px}.rail-title h3{margin:0;font-size:19px}.trend-item{display:grid;grid-template-columns:32px 1fr;gap:8px;padding:12px 0;border-bottom:1px solid var(--line)}.trend-item b{font-size:22px;color:var(--red)}.trend-item a{font-size:13px;font-weight:800}.weather-now{display:flex;align-items:center;justify-content:space-between;padding:14px 0}.weather-now strong{font-size:44px}.weather-now .weather-sun{width:60px;height:60px}.weather-card select{width:100%;height:44px;border:1px solid var(--line);background:var(--card);color:var(--ink);padding:0 10px}.forecast{display:grid;grid-template-columns:repeat(3,1fr);margin-top:12px}.forecast div{text-align:center;border-right:1px solid var(--line);font-size:10px}.forecast div:last-child{border:0}.forecast b{display:block;font-size:16px}.service-links{display:grid;grid-template-columns:1fr 1fr;gap:8px}.service-links button{min-height:58px;background:var(--soft);color:var(--blue);font-size:11px;font-weight:900}.service-links button:hover{background:var(--blue);color:#fff}
|
||||
.broadcast{background:#071d38;color:#fff}.broadcast .section-head{border-color:var(--red)}.broadcast .section-head a{color:#fff}.onair-grid{display:grid;grid-template-columns:1.4fr .72fr;gap:25px}.tv-stage{min-height:430px;background:linear-gradient(135deg,#0b3b70 0 54%,#e12536 54%);position:relative;overflow:hidden;display:flex;align-items:flex-end}.tv-stage::before{content:"";position:absolute;left:7%;top:15%;width:39%;height:45%;border:8px solid #4b87ba;background:#0b2039}.tv-stage::after{content:"";position:absolute;inset:0;background:linear-gradient(transparent 40%,rgba(0,0,0,.8))}.tv-stage.has-external-media::before{display:none}.tv-art{position:absolute;inset:0}.tv-copy{position:relative;z-index:2;padding:29px}.tv-copy h3{font-size:39px;line-height:1;margin:7px 0 10px}.tv-copy p{color:#bdd0e2;max-width:620px}.watch-live{color:#fff;font-size:11px;font-weight:900}.schedule{border:1px solid rgba(255,255,255,.25)}.schedule-head{padding:17px;background:var(--red);font-size:12px;font-weight:900}.slot{display:grid;grid-template-columns:70px 1fr;gap:11px;padding:16px;border-bottom:1px solid rgba(255,255,255,.18)}.slot time{color:#ffc94c;font-size:11px;font-weight:900}.slot b{display:block;font-size:14px}.slot span{font-size:10px;color:#aabed2}.slot.live{background:#103c69}.slot.live b::after{content:"直播";margin-left:8px;background:var(--red);padding:3px 5px;font-size:8px}
|
||||
.glance-grid,.channel-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.glance-card{background:var(--card);border:1px solid var(--line);padding:22px}.glance-card strong{display:block;font-size:32px;color:var(--blue);margin:8px 0}.glance-card p,.channel-card p{color:var(--muted)}.glance-card a{color:var(--blue);font-weight:800}.channel-card{background:var(--card);border:1px solid var(--line)}.channel-art{height:150px;background:linear-gradient(140deg,#d9b3cf,#9b2c7b);position:relative}.channel-card:nth-child(2) .channel-art{background:linear-gradient(140deg,#bfd4bd,#26815d)}.channel-card:nth-child(3) .channel-art{background:linear-gradient(140deg,#dfb08b,#e35b25)}.channel-card:nth-child(4) .channel-art{background:linear-gradient(140deg,#b7c9df,#244f91)}.channel-art::after{content:"";position:absolute;width:75px;height:75px;border-radius:50%;background:rgba(255,255,255,.62);left:calc(50% - 37px);top:38px}.channel-copy{padding:18px}.channel-copy h3{font-size:20px;line-height:1.1;margin:7px 0}.videos{background:var(--soft)}.video-grid{display:grid;grid-template-columns:1.35fr .8fr .8fr;gap:16px}.video-card{background:var(--card);border:1px solid var(--line)}.video-art{height:220px;background:linear-gradient(145deg,#4f7d9f,#1e526e);position:relative}.video-card:first-child .video-art{height:310px}.video-art::before{content:"▶";position:absolute;left:18px;bottom:16px;width:46px;height:46px;border-radius:50%;display:grid;place-items:center;background:var(--red);color:white;padding-left:3px}.video-open{position:absolute;z-index:3;inset:0;width:100%;height:100%;padding:0}.video-art[data-visual="rain-video"]{background:linear-gradient(145deg,#a7c6b1,#3c6b56)}.video-art[data-visual="market-video"]{background:linear-gradient(145deg,#dcc29d,#125494)}.video-duration{position:absolute;right:10px;bottom:10px;background:#071d38;color:white;padding:3px 6px;font-size:9px}.video-copy{padding:17px}.video-copy h3{font-size:21px;line-height:1.08;margin:7px 0}.extras-grid{display:grid;grid-template-columns:1.25fr .75fr;gap:20px}.podcast{background:var(--navy);color:#fff;padding:28px;display:grid;grid-template-columns:100px 1fr;gap:22px}.pod-art{width:100px;height:100px;border-radius:50%;border:8px solid var(--yellow);display:grid;place-items:center;font-size:34px}.podcast p{color:#b9cada}.audio-controls{display:flex;align-items:center;gap:12px}.audio-play{width:44px;height:44px;border-radius:50%;background:var(--red);color:white}.audio-line{height:6px;background:#36516e;flex:1}.audio-line span{display:block;height:100%;width:38%;background:var(--yellow)}.audio-time{font-size:10px}.lotto{background:var(--card);border:1px solid var(--line);padding:24px}.lotto-tabs{display:flex;gap:6px}.lotto-tabs button{padding:8px 10px;background:var(--soft);font-weight:900}.lotto-tabs button.active{background:var(--blue);color:white}.balls{display:flex;gap:7px;flex-wrap:wrap;margin:18px 0}.ball{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--yellow);font-weight:900}.newsletter{background:var(--red);color:#fff;padding:36px 0}.news-row{display:grid;grid-template-columns:1fr 1fr;gap:40px;align-items:center}.newsletter h2{font-size:37px;margin:0}.form-row{display:flex}.form-row label{position:absolute;clip:rect(0 0 0 0)}.form-row input{flex:1;min-width:0;border:0;padding:14px}.form-row button{background:var(--navy);color:#fff;padding:0 20px;font-weight:900}.form-status{min-height:20px;margin-top:8px;font-size:12px}
|
||||
footer{background:var(--navy);color:#fff;padding:52px 0 24px}.foot-grid{display:grid;grid-template-columns:1.4fr repeat(3,1fr);gap:35px}.foot-brand p{color:#b5c6d8}.foot-col h3{color:var(--yellow);font-size:12px}.foot-col a{display:block;color:#c8d5e2;margin:9px 0}.foot-bottom{border-top:1px solid #38506c;margin-top:35px;padding-top:18px;display:flex;justify-content:space-between;color:#91a6ba;font-size:10px}
|
||||
.drawer,.search-overlay,.player-modal,.settings-overlay{position:fixed;inset:0;display:none;z-index:200;background:rgba(3,14,28,.88)}.drawer.open,.search-overlay.open,.player-modal.open,.settings-overlay.open{display:block}.drawer-panel{width:min(430px,90vw);height:100%;background:var(--card);margin-left:auto;padding:24px;overflow:auto}.drawer-head,.overlay-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);padding-bottom:17px}.close{width:42px;height:42px;border:1px solid var(--line);font-size:25px}.drawer-body{padding-top:28px}.drawer-nav a{display:block;font-size:23px;font-weight:800;padding:13px 0;border-bottom:1px solid var(--line)}.drawer-service{margin-top:30px;padding:22px;background:var(--soft)}.search-box{width:min(820px,calc(100% - 40px));margin:10vh auto;background:var(--card);padding:30px}.search-box h2{font-size:42px}.search-line{display:flex;border-bottom:3px solid var(--blue)}.search-line input{flex:1;border:0;background:transparent;color:var(--ink);padding:14px 0;font-size:25px;outline:none}.search-line button{width:60px;font-size:24px}.search-result{margin-top:16px;color:var(--muted)}.player-card{width:min(900px,calc(100% - 40px));margin:5vh auto;background:var(--card)}.player-head{background:var(--navy);color:white;padding:16px 20px;display:flex;justify-content:space-between;align-items:center}.player-stage{min-height:430px;background:linear-gradient(135deg,#115596 0 60%,#e31e2f 60%);color:white;display:grid;place-items:center;text-align:center}.big-play{width:78px;height:78px;border-radius:50%;background:white;color:var(--red);display:grid;place-items:center;margin:auto;font-size:28px;padding-left:5px}.player-stage h3{font-size:37px;margin:18px 0 6px}.player-controls{padding:16px 20px;display:flex;justify-content:space-between}.toast{position:fixed;z-index:300;left:50%;bottom:30px;transform:translate(-50%,120px);background:#111;color:#fff;padding:11px 18px;opacity:0;transition:.2s}.toast.show{transform:translate(-50%,0);opacity:1}
|
||||
.settings-button{position:fixed;right:18px;top:58px;z-index:155;width:46px;height:46px;border-radius:50%;background:var(--navy);color:white;border:2px solid var(--yellow);font-size:19px}.settings-overlay{padding:24px}.settings-card{height:calc(100vh - 48px);max-width:1500px;margin:auto;background:#071426;color:#eef6ff;border:1px solid #2b739e;display:grid;grid-template-rows:auto 1fr auto}.settings-head{padding:22px 28px;border-bottom:1px solid #24516f;display:flex;justify-content:space-between}.settings-head small{color:#ffc627;font-size:11px;font-weight:800}.settings-head h2{margin:7px 0 0;font-size:27px}.settings-main{display:grid;grid-template-columns:270px 1fr;min-height:0}.module-tabs{padding:18px;border-right:1px solid #24516f;overflow:auto;display:grid;align-content:start;gap:7px}.module-tab{border:1px solid #244b68;background:#0b2035;color:#c5d8e7;text-align:left;padding:12px 14px;font-weight:800}.module-tab.active{background:#1aa9e8;color:#041322}.editor-wrap{padding:18px;display:grid;grid-template-rows:auto 1fr auto;gap:10px;min-width:0}.editor-meta{display:flex;justify-content:space-between;color:#94afc5;font-size:12px}.json-editor{width:100%;height:100%;resize:none;background:#020b14;color:#d6efff;border:1px solid #244b68;padding:18px;font:14px/1.55 Consolas,monospace}.editor-help{color:#829db2;font-size:12px}.settings-actions{padding:16px 28px;border-top:1px solid #24516f;display:flex;justify-content:flex-end;gap:10px}.settings-actions button{border:1px solid #3381ab;color:white;padding:12px 17px;font-weight:800}.settings-actions .apply{background:#ffc627;color:#071426;border-color:#ffc627}.settings-status{margin-right:auto;align-self:center;color:#8bd2f2;font-size:12px}
|
||||
@media(max-width:1000px){.hero-grid,.news-grid{grid-template-columns:1fr}.top-stack{grid-template-columns:1fr 1fr;grid-template-rows:auto}.onair-grid{grid-template-columns:1fr}.glance-grid,.channel-grid{grid-template-columns:1fr 1fr}.video-grid{grid-template-columns:1fr 1fr}.video-card:first-child{grid-column:1/-1}.foot-grid{grid-template-columns:1fr 1fr}.settings-main{grid-template-columns:210px 1fr}}
|
||||
@media(max-width:720px){.wrap{width:min(var(--max),calc(100% - 26px))}.top-links,.weather-mini{display:none}.head-row{grid-template-columns:52px 1fr 100px}.brand-mark{width:48px;height:48px}.brand-copy strong{font-size:24px}.brand-copy small{font-size:7px}.live-btn{padding:0 9px}.just-row{grid-template-columns:auto 1fr}.just-toggle{display:none}.just-grid{grid-template-columns:1fr 1fr;gap:16px}.hero{padding-top:15px}.main-story{min-height:500px}.story-copy{padding:23px}.story-copy h1{font-size:42px}.top-stack{grid-template-columns:1fr}.headline-strip{grid-template-columns:1fr 1fr}.tracking-row{grid-template-columns:1fr}.tracking-status{grid-column:1;margin:0}.feed-item{grid-template-columns:115px 1fr}.glance-grid,.channel-grid,.video-grid{grid-template-columns:1fr}.video-card:first-child{grid-column:auto}.extras-grid,.news-row{grid-template-columns:1fr}.foot-grid{grid-template-columns:1fr 1fr}.settings-overlay{padding:8px}.settings-card{height:calc(100vh - 16px)}.settings-main{grid-template-columns:1fr;grid-template-rows:auto 1fr}.module-tabs{grid-auto-flow:column;grid-auto-columns:max-content;overflow-x:auto;border-right:0;border-bottom:1px solid #24516f;padding:10px}.settings-head{padding:16px}.settings-actions{padding:11px;overflow:auto}.settings-actions button{white-space:nowrap}.settings-status{display:none}}
|
||||
@media(max-width:430px){.head-side.right .icon-btn{display:none}.main-story{min-height:550px}.top-card{grid-template-columns:110px 1fr}.headline-strip{grid-template-columns:1fr}.feed-tabs button{padding:0 12px}.feed-item{grid-template-columns:1fr}.feed-art{height:160px}.service-links{grid-template-columns:1fr}.glance-grid,.channel-grid,.foot-grid{grid-template-columns:1fr}.podcast{grid-template-columns:1fr}.foot-bottom{display:block}.form-row{display:block}.form-row button{width:100%;height:44px}.settings-button{right:10px;top:52px}}
|
||||
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,*::before,*::after{transition:none!important}}
|
||||
.skip{top:calc(var(--df-generated-header-height,0px) + 8px)}
|
||||
body.sticky .nav{top:var(--df-generated-header-height,0px)}
|
||||
.settings-button{top:calc(var(--df-generated-header-height,0px) + 58px)}
|
||||
@media(max-width:430px){.settings-button{top:calc(var(--df-generated-header-height,0px) + 52px)}}
|
||||
.skip{transform:translateY(calc(-100% - var(--df-generated-header-height,0px) - 24px))}.skip:focus{transform:none}
|
||||
.drawer,.search-overlay,.player-modal{z-index:1200}.settings-overlay{z-index:1300}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip" id="skipLink" href="#main">跳转到主要新闻</a>
|
||||
<button class="settings-button" id="openSettings" aria-label="编辑页面 JSON" title="编辑页面 JSON">⚙</button>
|
||||
<div class="just-bar"><div class="wrap just-row"><div class="just-label"><span class="live-dot"></span><span id="justLabel"></span></div><div class="just-copy" id="justFeatured"></div><button class="just-toggle" id="justToggle" aria-expanded="false"></button></div><div class="just-panel" id="justPanel"><div class="wrap just-grid" id="justGrid"></div></div></div>
|
||||
<header id="siteHeader"><div class="topline"><div class="wrap top-row"><span id="dateLabel"></span><nav class="top-links" id="topLinks"></nav></div></div><div class="head"><div class="wrap head-row"><div class="head-side"><button class="icon-btn" id="menuOpen">☰</button><button class="weather-mini" id="weatherMini"><span class="weather-sun"></span><span><b id="miniCity"></b><span id="miniSky"></span></span></button></div><a class="brand" href="#main"><span class="brand-mark"></span><span class="brand-copy"><strong><span id="brandPrimary"></span> <span id="brandAccent"></span></strong><small id="brandTagline"></small></span></a><div class="head-side right"><button class="live-btn" id="liveButton"><span class="live-dot"></span><span id="liveLabel"></span></button><button class="icon-btn" id="searchOpen" aria-label="搜索">⌕</button><button class="icon-btn" id="contrastToggle" aria-label="切换对比模式">◐</button></div></div></div><nav class="nav"><div class="wrap nav-row" id="primaryNav"></div></nav></header>
|
||||
<main id="main" tabindex="-1">
|
||||
<section class="hero" id="topnews"><div class="wrap"><div class="hero-grid"><article class="main-story" id="mainStory"></article><div class="top-stack" id="sideStories"></div></div><div class="headline-strip" id="headlineStrip"></div></div></section>
|
||||
<section class="tracking"><div class="wrap tracking-row"><h2 id="trackingTitle"></h2><div class="tracking-pills" id="trackingPills"></div><div class="tracking-status" id="trackingStatus"></div></div></section>
|
||||
<section class="section" id="latest"><div class="wrap news-grid"><div><div class="feed-tabs" id="feedTabs"></div><div id="feedPanels"></div></div><aside class="side-rail"><section class="rail-card"><div class="rail-title"><h3 id="trendingTitle"></h3><span class="eyebrow" id="trendingLabel"></span></div><div id="trendingList"></div></section><section class="rail-card weather-card" id="weather"><div class="rail-title"><h3 id="weatherTitle"></h3><span class="eyebrow" id="weatherLive"></span></div><select id="weatherSelect"></select><div class="weather-now"><div><strong id="weatherTemp"></strong><div id="weatherCondition"></div></div><span class="weather-sun"></span></div><div class="forecast" id="forecast"></div></section><section class="rail-card" id="service"><div class="rail-title"><h3 id="publicTitle"></h3></div><div class="service-links" id="serviceLinks"></div></section></aside></div></section>
|
||||
<section class="section broadcast" id="onair"><div class="wrap"><div class="section-head"><h2 id="broadcastTitle"></h2><a id="broadcastMore"></a></div><div class="onair-grid"><article class="tv-stage"><div class="tv-art" id="broadcastArt"></div><div class="tv-copy"><div class="eyebrow" id="broadcastEyebrow"></div><h3 id="broadcastHeroTitle"></h3><p id="broadcastHeroSummary"></p><button class="watch-live" id="watchLive"></button></div></article><aside class="schedule"><div class="schedule-head" id="scheduleTitle"></div><div id="scheduleSlots"></div></aside></div></div></section>
|
||||
<section class="section" id="glance"><div class="wrap"><div class="section-head"><h2 id="glanceTitle"></h2><a id="glanceMore"></a></div><div class="glance-grid" id="glanceGrid"></div></div></section>
|
||||
<section class="section" id="channels"><div class="wrap"><div class="section-head"><h2 id="deskTitle"></h2><a id="deskMore"></a></div><div class="channel-grid" id="channelGrid"></div></div></section>
|
||||
<section class="section videos" id="videos"><div class="wrap"><div class="section-head"><h2 id="videosTitle"></h2><a id="videosMore"></a></div><div class="video-grid" id="videoGrid"></div></div></section>
|
||||
<section class="section" id="radio"><div class="wrap extras-grid"><article class="podcast"><div class="pod-art">◉</div><div><div class="eyebrow" id="podcastEyebrow"></div><h3 id="podcastTitle"></h3><p id="podcastText"></p><div class="audio-controls"><button class="audio-play" id="audioPlay">▶</button><div class="audio-line"><span id="audioProgress"></span></div><span class="audio-time" id="audioTime"></span></div></div></article><section class="lotto"><div class="eyebrow" id="lottoEyebrow"></div><h3 id="lottoTitle"></h3><div class="lotto-tabs" id="lottoTabs"></div><div class="balls" id="lottoBalls"></div><p id="lottoNote"></p></section></div></section>
|
||||
<section class="newsletter" id="newsletter"><div class="wrap news-row"><div><h2 id="newsletterTitle"></h2><p id="newsletterText"></p></div><form id="subForm"><div class="form-row"><label id="newsletterLabel" for="email"></label><input id="email" type="email" required><button id="newsletterButton"></button></div><div class="form-status" id="subStatus"></div></form></div></section>
|
||||
</main>
|
||||
<footer id="footer"><div class="wrap foot-grid"><div class="foot-brand"><div class="brand"><span class="brand-mark"></span><span class="brand-copy"><strong><span id="footerBrandPrimary"></span> <span id="footerBrandAccent"></span></strong><small id="footerTagline"></small></span></div><p id="footerDescription"></p></div><div id="footerColumns" style="display:contents"></div></div><div class="wrap foot-bottom"><span id="footerCopyright"></span><span id="footerLegal"></span></div></footer>
|
||||
<div class="drawer" id="drawer"><div class="drawer-panel"><div class="drawer-head"><strong id="drawerBrand"></strong><button class="close" data-close="drawer">×</button></div><div class="drawer-body"><div class="eyebrow" id="drawerEyebrow"></div><h2 id="drawerTitle"></h2><p id="drawerText"></p><nav class="drawer-nav" id="drawerNav"></nav><div class="drawer-service"><a class="btn" id="drawerCta"></a></div></div></div></div>
|
||||
<div class="search-overlay" id="searchOverlay"><div class="search-box"><div class="overlay-head"><strong id="searchBrand"></strong><button class="close" data-close="searchOverlay">×</button></div><h2 id="searchTitle"></h2><form id="searchForm"><div class="search-line"><input id="searchInput" type="search"><button aria-label="提交搜索">⌕</button></div><div class="search-result" id="searchResult"></div></form></div></div>
|
||||
<div class="player-modal" id="playerModal"><div class="player-card"><div class="player-head"><strong id="playerBrand"></strong><button class="close" data-close="playerModal">×</button></div><div class="player-stage"><div><div class="big-play">▶</div><h3 id="playerTitle"></h3><p id="playerNote"></p></div></div><div class="player-controls"><span id="playerQuality"></span><button id="captionToggle"></button></div></div></div>
|
||||
<div class="toast" id="toast"></div>
|
||||
<div class="settings-overlay" id="settingsOverlay"><div class="settings-card"><div class="settings-head"><div><small>GMA 新闻页面模板控制台</small><h2>JSON 编辑器</h2></div><button class="close" data-close="settingsOverlay">×</button></div><div class="settings-main"><div class="module-tabs" id="moduleTabs"></div><div class="editor-wrap"><div class="editor-meta"><span id="editorModule"></span><span id="jsonValidity">JSON 有效</span></div><textarea class="json-editor" id="jsonEditor" spellcheck="false"></textarea><div class="editor-help">编辑当前模块并完成校验后,即可应用到页面。缓存按照当前文件的初始 JSON 指纹隔离。</div></div></div><div class="settings-actions"><span class="settings-status" id="settingsStatus"></span><button id="validateJson">校验</button><button id="copyJson">复制 JSON</button><button id="downloadJson">下载 JSON</button><button id="resetJson">重置</button><button class="apply" id="applyJson">应用并渲染</button></div></div></div>
|
||||
<script type="application/json" id="gmaNewsPageData">__GMA_NEWS_PAGE_DATA__</script>
|
||||
<script>__GMA_NEWS_PAGE_RUNTIME__</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user