mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 23:39:28 +08:00
feat(market): 准入 10 项技能,补齐 AI 日报与高德完整安装包 (#350)
- 准入 10 项 installable 技能:agent-reach、dingtalk-api、follow-builders、humanizer-zh、karpathy-guidelines、marketingskills、netease-skills、wecom-cli(原 pin 不变),以及完整 MIT 本地版 ai-news-radar(LearnPrompt/ai-news-radar@689395109cc962a27c369bdd6fa50d1e090eb319)和 ClawHub 1.1.1 完整 ZIP 的 amap-jsapi-skill(sha256 9468743ee18dbe1704e8a98f47f6628d6a4e6acec30a05f0b8f59a07603d011f)。 - 瑞幸、MiniMax 图片/语音、LumaRescue、美团跑腿、Ian 小黑、女娲 继续 listing-only。 - 高德许可按 SKILL.md 的 MIT 声明保守记录,skill-card/ClawHub 写 MIT-0 的差异已在 ADMISSION.md 披露。 - validate、translate 通过;CodeQL 对上游原样 update_news.py 的 5 条告警经 mashagua 确认忽略。
This commit is contained in:
1 parent
8006ad8518
commit
91563b4695
62 files changed
+23030
-98
No files matched your search
@@ -0,0 +1,140 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const STORAGE_KEY = "aiNewsRadarViewV2";
|
||||
const LEGACY_STORAGE_KEY = "aiNewsRadarView";
|
||||
const MOBILE_OVERRIDE_KEY = "aiNewsRadarMobileViewOnce";
|
||||
const MOBILE_BREAKPOINT = "(max-width: 760px)";
|
||||
const VALID_VIEWS = new Set(["mobile", "classic"]);
|
||||
const script = document.currentScript;
|
||||
const rootHint = script?.dataset.root || "./";
|
||||
const rootUrl = new URL(rootHint, window.location.href);
|
||||
const currentView = document.documentElement.dataset.radarView || "mobile";
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const requestedView = params.get("view") || "";
|
||||
const isMobileViewport = window.matchMedia(MOBILE_BREAKPOINT).matches;
|
||||
|
||||
try {
|
||||
window.localStorage.removeItem(LEGACY_STORAGE_KEY);
|
||||
} catch {
|
||||
// Storage can be unavailable in private or hardened browser contexts.
|
||||
}
|
||||
|
||||
function readPreference() {
|
||||
try {
|
||||
const value = window.localStorage.getItem(STORAGE_KEY) || "";
|
||||
return VALID_VIEWS.has(value) ? value : "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function writePreference(view) {
|
||||
try {
|
||||
if (VALID_VIEWS.has(view)) {
|
||||
window.localStorage.setItem(STORAGE_KEY, view);
|
||||
} else {
|
||||
window.localStorage.removeItem(STORAGE_KEY);
|
||||
}
|
||||
} catch {
|
||||
// Storage can be unavailable in private or hardened browser contexts.
|
||||
}
|
||||
}
|
||||
|
||||
function readMobileOverride() {
|
||||
try {
|
||||
const value = window.sessionStorage.getItem(MOBILE_OVERRIDE_KEY) || "";
|
||||
window.sessionStorage.removeItem(MOBILE_OVERRIDE_KEY);
|
||||
return VALID_VIEWS.has(value) ? value : "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function writeMobileOverride(view) {
|
||||
try {
|
||||
if (VALID_VIEWS.has(view)) {
|
||||
window.sessionStorage.setItem(MOBILE_OVERRIDE_KEY, view);
|
||||
} else {
|
||||
window.sessionStorage.removeItem(MOBILE_OVERRIDE_KEY);
|
||||
}
|
||||
} catch {
|
||||
// Storage can be unavailable in private or hardened browser contexts.
|
||||
}
|
||||
}
|
||||
|
||||
if (requestedView === "auto") {
|
||||
writePreference("");
|
||||
writeMobileOverride("");
|
||||
} else if (!isMobileViewport && VALID_VIEWS.has(requestedView)) {
|
||||
writePreference(requestedView);
|
||||
}
|
||||
|
||||
const mobileOverride = isMobileViewport ? readMobileOverride() : "";
|
||||
const preference = isMobileViewport
|
||||
? mobileOverride
|
||||
: (requestedView === "auto"
|
||||
? ""
|
||||
: (VALID_VIEWS.has(requestedView) ? requestedView : readPreference()));
|
||||
const deviceDefault = "mobile";
|
||||
const targetView = preference || deviceDefault;
|
||||
|
||||
function destination(view) {
|
||||
const url = new URL(view === "classic" ? "classic/" : "./", rootUrl);
|
||||
const passthrough = new URLSearchParams(window.location.search);
|
||||
passthrough.delete("view");
|
||||
url.search = passthrough.toString();
|
||||
url.hash = window.location.hash;
|
||||
return url;
|
||||
}
|
||||
|
||||
function cleanViewQuery() {
|
||||
if (!requestedView) return;
|
||||
const cleanUrl = destination(currentView);
|
||||
window.history.replaceState(null, "", `${cleanUrl.pathname}${cleanUrl.search}${cleanUrl.hash}`);
|
||||
}
|
||||
|
||||
function chooseView(view) {
|
||||
if (!VALID_VIEWS.has(view)) return;
|
||||
if (isMobileViewport) writeMobileOverride(view);
|
||||
else writePreference(view);
|
||||
if (view === currentView) return;
|
||||
window.location.assign(destination(view).href);
|
||||
}
|
||||
|
||||
if (targetView !== currentView) {
|
||||
window.location.replace(destination(targetView).href);
|
||||
return;
|
||||
}
|
||||
|
||||
cleanViewQuery();
|
||||
|
||||
function mountSwitches() {
|
||||
document.querySelectorAll("[data-radar-view-target]").forEach((button) => {
|
||||
const view = button.dataset.radarViewTarget || "";
|
||||
const active = view === currentView;
|
||||
button.classList.toggle("is-active", active);
|
||||
button.setAttribute("aria-pressed", active ? "true" : "false");
|
||||
if (active) button.setAttribute("aria-current", "page");
|
||||
else button.removeAttribute("aria-current");
|
||||
button.addEventListener("click", () => chooseView(view));
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", mountSwitches, { once: true });
|
||||
} else {
|
||||
mountSwitches();
|
||||
}
|
||||
|
||||
window.AINewsRadarView = {
|
||||
current: currentView,
|
||||
preference: preference || "auto",
|
||||
choose: chooseView,
|
||||
reset() {
|
||||
writePreference("");
|
||||
writeMobileOverride("");
|
||||
window.location.replace(destination(deviceDefault).href);
|
||||
},
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user