From 2af43674ccbc75091159baf2839f503f7436e925 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Thu, 4 Sep 2025 19:09:05 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feature:=20=E5=A2=9E=E5=8A=A0=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- javascripts/discourse/initializers/alert.js | 198 ++++++++++++++++++++ javascripts/discourse/lib/navigation.js | 71 +++++++ javascripts/discourse/lib/search.js | 168 +++++++++++++++++ javascripts/discourse/lib/sidebar.js | 30 +++ javascripts/discourse/lib/tags.js | 25 +++ javascripts/discourse/lib/topic.js | 74 ++++++++ javascripts/discourse/lib/utils.js | 58 ++++++ 7 files changed, 624 insertions(+) create mode 100644 javascripts/discourse/initializers/alert.js create mode 100644 javascripts/discourse/lib/navigation.js create mode 100644 javascripts/discourse/lib/search.js create mode 100644 javascripts/discourse/lib/sidebar.js create mode 100644 javascripts/discourse/lib/tags.js create mode 100644 javascripts/discourse/lib/topic.js create mode 100644 javascripts/discourse/lib/utils.js diff --git a/javascripts/discourse/initializers/alert.js b/javascripts/discourse/initializers/alert.js new file mode 100644 index 0000000..123a5ce --- /dev/null +++ b/javascripts/discourse/initializers/alert.js @@ -0,0 +1,198 @@ +import { reportNavigationClick } from "../lib/navigation.js"; +import reportSearch from "../lib/search.js"; +import { reportSidebarClick } from "../lib/sidebar.js"; +import { reportTagsClick } from "../lib/tags.js"; +import { reportTopicClick, reportTopicLeave } from "../lib/topic.js"; + +function isCookieAgreed() { + const regexp = /\bagreed-cookiepolicy=([^;])+/; + const res = document.cookie.match(regexp)?.[1]; + return res === "1"; +} + +export default { + name: "alert", + initialize() { + import( + "https://unpkg.com/@opensig/open-analytics@0.0.9/dist/open-analytics.mjs" + ).then(({ OpenAnalytics, getClientInfo, OpenEventKeys }) => { + const oa = new OpenAnalytics({ + appKey: "openEuler", + request: (data) => { + if (!isCookieAgreed()) { + disableOA(); + return; + } + fetch("https://dsapi.test.osinfra.cn/query/track/openeuler", { + body: JSON.stringify(data), + method: "POST", + headers: { "Content-Type": "application/json" }, + }); + }, + }); + + /** + * 开启埋点上报功能 + * + * 设置上报内容的header信息为浏览器相关信息 + */ + const enableOA = () => { + oa.setHeader(getClientInfo()); + oa.enableReporting(true); + }; + + /** + * 关闭埋点上报功能,清除localStorage中关于埋点的条目 + */ + const disableOA = () => { + oa.enableReporting(false); + [ + "oa-openEuler-client", + "oa-openEuler-events", + "oa-openEuler-session", + ].forEach((key) => { + localStorage.removeItem(key); + }); + }; + + function oaReport(event, eventData, $service = "forum", options) { + return oa.report( + event, + async (...opt) => { + return { + $service, + ...(typeof eventData === "function" + ? await eventData(...opt) + : eventData), + }; + }, + options + ); + } + + /** + * 上报PageView事件 + * @param $referrer 从哪一个页面跳转过来 + */ + const reportPV = ($referrer) => { + oaReport(OpenEventKeys.PV, ($referrer && { $referrer }) || null); + }; + + /** + * 上报性能指标 + */ + const reportPerformance = () => { + oaReport(OpenEventKeys.LCP); + oaReport(OpenEventKeys.INP); + oaReport(OpenEventKeys.PageBasePerformance); + }; + + function listenCookieSet() { + if (isCookieAgreed()) { + enableOA(); + } + const desc = Object.getOwnPropertyDescriptor( + Document.prototype, + "cookie" + ); + Object.defineProperty(Document.prototype, "cookie", { + ...desc, + set(val) { + desc.set.call(this, val); + if (isCookieAgreed()) { + enableOA(); + } else { + disableOA(); + } + }, + }); + } + + function listenHistoryChange() { + let referrer; + + ["replaceState", "pushState"].forEach((method) => { + const native = History.prototype[method]; + History.prototype[method] = function (...args) { + try { + if (oa.enabled) { + const beforePath = location.pathname; + native.call(this, ...args); + const afterPath = location.pathname; + if ( + beforePath.startsWith("/t/topic/") && + afterPath.startsWith("/t/topic/") && + beforePath.split("/")[3] === afterPath.split("/")[3] + ) { + return; + } + if (beforePath !== afterPath) { + reportPV(referrer); + window.dispatchEvent( + new CustomEvent("afterRouteChange", { + detail: { from: beforePath, to: afterPath }, + }) + ); + } + } else { + native.call(this, ...args); + } + } catch { + native.call(this, ...args); + } finally { + referrer = location.href; + } + }; + }); + + window.addEventListener("popstate", () => { + try { + const beforePath = new URL(referrer).pathname; + if (beforePath !== location.pathname) { + setTimeout(() => reportPV(referrer)); + window.dispatchEvent( + new CustomEvent("afterRouteChange", { + detail: { from: beforePath, to: location.pathname }, + }) + ); + } + } finally { + referrer = location.href; + } + }); + } + + let enterTime = Date.now(); + document.addEventListener('visibilitychange', () => { + if (document.visibilityState === 'visible') { + enterTime = Date.now(); + } else { + oaReport( + 'leaveForum', + { + time: Date.now() - enterTime, + $url: location.href + } + ); + } + }); + + listenCookieSet(); + listenHistoryChange(); + reportPV(); + reportPerformance(); + + window._oaReport = oaReport; + window._enableOA = enableOA; + window._disableOA = disableOA; + + reportSidebarClick(); + reportNavigationClick(); + reportTopicClick(); + reportTopicLeave(); + reportTagsClick(); + + reportSearch(); + }); + }, +}; diff --git a/javascripts/discourse/lib/navigation.js b/javascripts/discourse/lib/navigation.js new file mode 100644 index 0000000..06a7461 --- /dev/null +++ b/javascripts/discourse/lib/navigation.js @@ -0,0 +1,71 @@ +import { onNodeInserted } from "./utils.js"; + +export function reportNavigationClick() { + // 类别下拉点击 + onNodeInserted( + ".navigation-container .category-drop.is-expanded .select-kit-collection", + (node) => { + window + .$(node) + .children() + .on("click", (ev) => + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + type: "类别", + module: "nav-dropdown", + $url: location.href, + }) + ); + } + ); + // 标签下拉点击 + onNodeInserted( + ".navigation-container .tag-drop.is-expanded .select-kit-collection", + (node) => { + window + .$(node) + .children() + .on("click", (ev) => + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + type: "标签", + module: "nav-dropdown", + $url: location.href, + }) + ); + } + ); + // 所有下拉点击 + onNodeInserted( + ".navigation-container .solved-status-filter.is-expanded .select-kit-collection", + (node) => { + window + .$(node) + .children() + .on("click", (ev) => + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + type: "所有", + module: "nav-dropdown", + $url: location.href, + }) + ); + } + ); + + onNodeInserted( + "#navigation-bar", + (node) => { + window + .$(node) + .children() + .on("click", (ev) => + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + module: "navigation", + $url: location.href, + }) + ); + } + ); +} diff --git a/javascripts/discourse/lib/search.js b/javascripts/discourse/lib/search.js new file mode 100644 index 0000000..960a49e --- /dev/null +++ b/javascripts/discourse/lib/search.js @@ -0,0 +1,168 @@ +import { debounce, onNodeInserted } from "./utils.js"; + +function onClickSearchInput() { + window._oaReport("click", { + type: "search-input", + module: "search", + $url: location.href, + }); +} + +function onInputSearchInput(ev) { + window._oaReport("input", { + type: "search-input", + module: "search", + content: ev.currentTarget.value.trim(), + $url: location.href, + }); +} + +function onClickSearchHistory(ev) { + window._oaReport("click", { + type: "search-history", + module: "search", + target: ev.currentTarget.textContent.trim(), + $url: location.href, + }); +} + +function onClearSearchHistoryClick() { + window._oaReport("click", { + type: "clear-search-history", + module: "search", + $url: location.href, + }); +} + +function onClickSuggestion(ev) { + window._oaReport("click", { + type: "search-suggestion", + module: "search", + target: ev.currentTarget.textContent.trim(), + searchContent: window.$(".search-input-wrapper input").get(0).value, + detail: ev.currentTarget.href, + $url: location.href, + }); +} + +function onClickSearchResultTopic(ev) { + const current$ = window.$(ev.currentTarget); + window._oaReport("click", { + type: "search-result", + module: "search", + target: current$.find(".first-line").text().trim(), + searchContent: window.$(".search-input-wrapper input").get(0).value, + detail: { + path: ev.currentTarget.href, + categories: current$.find(".badge-category__name").text().trim(), + tags: current$.find(".discourse-tags").text().trim(), + }, + $url: location.href, + }); +} + +export default function reportSearch() { + onNodeInserted(".search-input-wrapper input", (node) => { + window.$(node).on("focus", onClickSearchInput); + window.$(node).on("input", debounce(onInputSearchInput, 300)); + window.$(node).on("keydown", (ev) => { + if (ev.key === "Enter") { + window._oaReport("input", { + type: "search", + module: "search", + content: ev.currentTarget.value.trim(), + $url: location.href, + }); + } + }); + }); + + // 历史记录点击 + onNodeInserted(".search-menu-panel .search-menu-recent", (node) => { + window + .$(node) + .children(".search-menu-assistant-item") + .on("click", onClickSearchHistory); + // 清除历史记录 + window + .$(node) + .find(".clear-recent-searches") + .on("click", onClearSearchHistoryClick); + }); + + // 联想/帖子结果点击 + onNodeInserted( + ".search-menu-panel .results div[class^=search-result]", + (node) => { + if (node.classList.contains("search-result-topic")) { + // 话题结果点击 + window + .$(node) + .find(".list .item a") + .on("click", onClickSearchResultTopic); + } else { + // 联想结果点击 + window.$(node).find(".list .item a").on("click", onClickSuggestion); + } + } + ); + + window.addEventListener("afterRouteChange", ({ detail }) => { + if (detail.to === "/search") { + // 监听是否显示AI搜索结果的点击 + onNodeInserted('.search-advanced .semantic-search__results-toggle', (el) => { + window.$(el).on("click", (ev) => { + if (ev.currentTarget.disabled) return; + window._oaReport("click", { + type: "ai-toggle", + module: "search", + searchContent: decodeURIComponent( + location.search.match(/\bq=([^&]+)/)[1] + ), + detail: ev.currentTarget.getAttribute("aria-checked"), + $url: location.href, + }); + }); + }); + + onNodeInserted( + ".search-results .fps-result:first-child", + () => { + window.$(".search-results .fps-result-entries").on("click", (ev) => { + let link = ev.target; + if (link === ev.currentTarget) return; + while (!link.classList.contains("search-link")) { + link = link.parentElement; + if (link === ev.currentTarget || !link) return; + } + + let root = link; + while (!root.classList.contains("fps-result")) { + root = root.parentElement; + if (root === ev.currentTarget || !root) return; + } + const rank = [...root.parentElement.children].indexOf(root) + 1 + + const target$ = window.$(root); + window._oaReport("click", { + type: "search-result", + module: "search", + target: window.$(link).text().trim(), + searchContent: decodeURIComponent( + location.search.match(/\bq=([^&]+)/)[1] + ), + detail: { + rank, + path: window.$(link).attr("href"), + categories: target$.find(".badge-category__name").text().trim(), + tags: target$.find(".discourse-tags").text().trim(), + }, + $url: location.href, + }); + }); + }, + true + ); + } + }); +} diff --git a/javascripts/discourse/lib/sidebar.js b/javascripts/discourse/lib/sidebar.js new file mode 100644 index 0000000..63c6a82 --- /dev/null +++ b/javascripts/discourse/lib/sidebar.js @@ -0,0 +1,30 @@ +import { onNodeInserted } from "./utils.js"; + +export function reportSidebarClick() { + onNodeInserted("#sidebar-section-content-categories", (node) => { + window + .$(node) + .children() + .on("click", (ev) => { + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + type: "类别", + module: "sidebar", + $url: location.href, + }); + }); + }); + onNodeInserted("#sidebar-section-content-tags", (node) => { + window + .$(node) + .children() + .on("click", (ev) => { + window._oaReport("click", { + target: ev.currentTarget.textContent.trim(), + type: "标签", + module: "sidebar", + $url: location.href, + }); + }); + }); +} diff --git a/javascripts/discourse/lib/tags.js b/javascripts/discourse/lib/tags.js new file mode 100644 index 0000000..a2c5462 --- /dev/null +++ b/javascripts/discourse/lib/tags.js @@ -0,0 +1,25 @@ +import { onNodeInserted } from "./utils"; + +function allTagsClick() { + window._oaReport("click", { + target: this.textContent.trim(), + module: "all-tags", + $url: location.href, + }); +} + +export function reportTagsClick() { + window.addEventListener("afterRouteChange", ({ detail }) => { + if (detail.to === "/tags") { + onNodeInserted( + ".all-tag-lists .tags-list", + node => { + node.querySelectorAll(".tag-box")?.forEach((el) => { + el.querySelector("a").addEventListener("click", allTagsClick); + }); + }, + true + ); + } + }); +} diff --git a/javascripts/discourse/lib/topic.js b/javascripts/discourse/lib/topic.js new file mode 100644 index 0000000..c0f4b84 --- /dev/null +++ b/javascripts/discourse/lib/topic.js @@ -0,0 +1,74 @@ +import { onNodeInserted } from "./utils.js"; + +function onTopicListClick(ev) { + if (ev.target === ev.currentTarget) { + return; + } + let target = ev.target; + while (!(target instanceof HTMLAnchorElement && target.classList.contains("title"))) { + target = target.parentElement; + if (target === ev.currentTarget || !target) { + return; + } + } + + const mainLink = target.closest(".main-link"); + const categories = [...mainLink.querySelectorAll('.badge-category__wrapper')].map(el => el.textContent.trim()).join(); + const tags = mainLink.querySelector('.discourse-tags')?.textContent?.trim(); + const path = target.getAttribute('href').match(/^\/t\/topic\/[^/]+/)?.[0]; + sessionStorage.setItem('topicRead', JSON.stringify({ + title: target.textContent.trim(), + path, + readTime: Date.now(), + categories, + ...(tags && { tags }), + })); + window._oaReport("click", { + target: target.textContent.trim(), + type: 'topic-click', + $url: location.href, + detail: { + path, + categories, + ...(tags && { tags }), + } + }); +} + +/** + * 点击某个帖子 + */ +export function reportTopicClick() { + onNodeInserted( + '#main-outlet .topic-list .topic-list-body', + node => window.$(node).on('click', onTopicListClick) + ); +} + +export function reportTopicLeave() { + window.addEventListener('afterRouteChange', ({ detail }) => { + if (detail.from.startsWith('/t/topic/')) { + const topicRead = sessionStorage.getItem('topicRead'); + if (!topicRead) { + return; + } + const readInfo = JSON.parse(topicRead); + if (readInfo.path !== detail.from.match(/^\/t\/topic\/[^/]+/)?.[0]) { + return; + } + sessionStorage.removeItem('topicRead'); + window._oaReport( + 'pageLeave', + { + target: readInfo.title, + detail: { + path: readInfo.path, + readTime: Date.now() - Number(readInfo.readTime), + categories: readInfo.categories, + ...(readInfo.tags ? { tags: readInfo.tags } : null), + } + } + ); + } + }); +} diff --git a/javascripts/discourse/lib/utils.js b/javascripts/discourse/lib/utils.js new file mode 100644 index 0000000..41e7591 --- /dev/null +++ b/javascripts/discourse/lib/utils.js @@ -0,0 +1,58 @@ +/** + * @template {function} T + * @param {T} fn fn + * @param {number} delay dealy + * @returns {T} + */ +export function debounce(fn, delay = 10) { + let timeout; + return (...args) => { + if (timeout) { + clearTimeout(timeout); + } + timeout = setTimeout(() => { + fn(...args); + clearTimeout(timeout); + timeout = null; + }, delay); + }; +} + +const seqGenerator = (function* () { + let i = 0; + while (true) { + yield i++; + } +})(); + +/** + * @param {string} selector css selector + * @param {(HTMLElement) => void} callback callback + * @param {boolean} once + * @returns cancel function + */ +export function onNodeInserted(selector, callback, once) { + const css = document.createElement("style"); + const detectorName = `__nodeInserted_${seqGenerator.next().value}`; + css.innerHTML = + `@keyframes ${detectorName} { from { transform: none; } to { transform: none; } }` + + `${selector} { animation-duration: 0.01s; animation-name: ${detectorName}; }`; + document.head.appendChild(css); + + const handler = (event) => { + if (event.animationName === detectorName) { + event.stopImmediatePropagation(); + if (once) { + document.head.removeChild(css); + document.removeEventListener("animationstart", handler); + } + callback(event.target); + } + }; + document.addEventListener("animationstart", handler); + + return () => { + document.head.removeChild(css); + document.removeEventListener("animationstart", handler); + }; +} From 837ed7fd4fa041cc2ee601c7de5d5516f6007329 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Tue, 9 Sep 2025 14:57:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9cookie?= =?UTF-8?q?=E5=90=8C=E6=84=8F=E7=9A=84=E5=88=A4=E6=96=AD=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- javascripts/discourse/initializers/alert.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/javascripts/discourse/initializers/alert.js b/javascripts/discourse/initializers/alert.js index 123a5ce..30f5dc9 100644 --- a/javascripts/discourse/initializers/alert.js +++ b/javascripts/discourse/initializers/alert.js @@ -5,9 +5,9 @@ import { reportTagsClick } from "../lib/tags.js"; import { reportTopicClick, reportTopicLeave } from "../lib/topic.js"; function isCookieAgreed() { - const regexp = /\bagreed-cookiepolicy=([^;])+/; + const regexp = /\b_cookies_accepted=([^;]+)/; const res = document.cookie.match(regexp)?.[1]; - return res === "1"; + return res === "all" || res === "performance"; } export default { @@ -23,7 +23,7 @@ export default { disableOA(); return; } - fetch("https://dsapi.test.osinfra.cn/query/track/openeuler", { + fetch("/api-dsapi/query/track/openeuler", { body: JSON.stringify(data), method: "POST", headers: { "Content-Type": "application/json" }, @@ -163,17 +163,14 @@ export default { } let enterTime = Date.now(); - document.addEventListener('visibilitychange', () => { - if (document.visibilityState === 'visible') { + document.addEventListener("visibilitychange", () => { + if (document.visibilityState === "visible") { enterTime = Date.now(); } else { - oaReport( - 'leaveForum', - { - time: Date.now() - enterTime, - $url: location.href - } - ); + oaReport("leaveForum", { + time: Date.now() - enterTime, + $url: location.href, + }); } }); From 44dd122e2fca85297c9a753877eefa0e02335b40 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Wed, 10 Sep 2025 15:17:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/common.scss | 9 --- locales/ar.yml | 8 -- locales/be.yml | 7 -- locales/bg.yml | 7 -- locales/bs_BA.yml | 7 -- locales/ca.yml | 7 -- locales/cs.yml | 7 -- locales/da.yml | 7 -- locales/de.yml | 8 -- locales/el.yml | 7 -- locales/en.yml | 2 - locales/en_GB.yml | 7 -- locales/es.yml | 8 -- locales/et.yml | 7 -- locales/fa_IR.yml | 7 -- locales/fi.yml | 8 -- locales/fr.yml | 8 -- locales/gl.yml | 7 -- locales/he.yml | 8 -- locales/hr.yml | 7 -- locales/hu.yml | 7 -- locales/hy.yml | 7 -- locales/id.yml | 7 -- locales/it.yml | 8 -- locales/ja.yml | 8 -- locales/ko.yml | 7 -- locales/lt.yml | 7 -- locales/lv.yml | 7 -- locales/nb_NO.yml | 7 -- locales/nl.yml | 8 -- locales/pl_PL.yml | 7 -- locales/pt.yml | 7 -- locales/pt_BR.yml | 8 -- locales/ro.yml | 7 -- locales/ru.yml | 8 -- locales/sk.yml | 7 -- locales/sl.yml | 7 -- locales/sq.yml | 7 -- locales/sr.yml | 7 -- locales/sv.yml | 7 -- locales/sw.yml | 7 -- locales/te.yml | 7 -- locales/th.yml | 7 -- locales/tr_TR.yml | 8 -- locales/ug.yml | 7 -- locales/uk.yml | 7 -- locales/ur.yml | 7 -- locales/vi.yml | 7 -- locales/zh_CN.yml | 8 -- locales/zh_TW.yml | 7 -- settings.yml | 8 -- spec/system/color_scheme_toggle_spec.rb | 60 --------------- test/acceptance/toggle-test.js | 99 ------------------------- translator.yml | 5 -- 54 files changed, 532 deletions(-) delete mode 100644 common/common.scss delete mode 100644 locales/ar.yml delete mode 100644 locales/be.yml delete mode 100644 locales/bg.yml delete mode 100644 locales/bs_BA.yml delete mode 100644 locales/ca.yml delete mode 100644 locales/cs.yml delete mode 100644 locales/da.yml delete mode 100644 locales/de.yml delete mode 100644 locales/el.yml delete mode 100644 locales/en.yml delete mode 100644 locales/en_GB.yml delete mode 100644 locales/es.yml delete mode 100644 locales/et.yml delete mode 100644 locales/fa_IR.yml delete mode 100644 locales/fi.yml delete mode 100644 locales/fr.yml delete mode 100644 locales/gl.yml delete mode 100644 locales/he.yml delete mode 100644 locales/hr.yml delete mode 100644 locales/hu.yml delete mode 100644 locales/hy.yml delete mode 100644 locales/id.yml delete mode 100644 locales/it.yml delete mode 100644 locales/ja.yml delete mode 100644 locales/ko.yml delete mode 100644 locales/lt.yml delete mode 100644 locales/lv.yml delete mode 100644 locales/nb_NO.yml delete mode 100644 locales/nl.yml delete mode 100644 locales/pl_PL.yml delete mode 100644 locales/pt.yml delete mode 100644 locales/pt_BR.yml delete mode 100644 locales/ro.yml delete mode 100644 locales/ru.yml delete mode 100644 locales/sk.yml delete mode 100644 locales/sl.yml delete mode 100644 locales/sq.yml delete mode 100644 locales/sr.yml delete mode 100644 locales/sv.yml delete mode 100644 locales/sw.yml delete mode 100644 locales/te.yml delete mode 100644 locales/th.yml delete mode 100644 locales/tr_TR.yml delete mode 100644 locales/ug.yml delete mode 100644 locales/uk.yml delete mode 100644 locales/ur.yml delete mode 100644 locales/vi.yml delete mode 100644 locales/zh_CN.yml delete mode 100644 locales/zh_TW.yml delete mode 100644 settings.yml delete mode 100644 spec/system/color_scheme_toggle_spec.rb delete mode 100644 test/acceptance/toggle-test.js delete mode 100644 translator.yml diff --git a/common/common.scss b/common/common.scss deleted file mode 100644 index f9c5a88..0000000 --- a/common/common.scss +++ /dev/null @@ -1,9 +0,0 @@ -.header-toggle-button { - // this is not ideal, we usually don't want to mess - // with button padding... - // but the problem here is that the other header elements aren't buttons - // they are anchors... - .btn { - padding: 0; - } -} diff --git a/locales/ar.yml b/locales/ar.yml deleted file mode 100644 index 9387299..0000000 --- a/locales/ar.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ar: - toggle_button_title: تبديل لوحة الألوان diff --git a/locales/be.yml b/locales/be.yml deleted file mode 100644 index 2ea77a0..0000000 --- a/locales/be.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -be: diff --git a/locales/bg.yml b/locales/bg.yml deleted file mode 100644 index 5233352..0000000 --- a/locales/bg.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -bg: diff --git a/locales/bs_BA.yml b/locales/bs_BA.yml deleted file mode 100644 index 828a7e6..0000000 --- a/locales/bs_BA.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -bs_BA: diff --git a/locales/ca.yml b/locales/ca.yml deleted file mode 100644 index ec737bc..0000000 --- a/locales/ca.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ca: diff --git a/locales/cs.yml b/locales/cs.yml deleted file mode 100644 index 041b2f0..0000000 --- a/locales/cs.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -cs: diff --git a/locales/da.yml b/locales/da.yml deleted file mode 100644 index f39c727..0000000 --- a/locales/da.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -da: diff --git a/locales/de.yml b/locales/de.yml deleted file mode 100644 index e6fef3f..0000000 --- a/locales/de.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -de: - toggle_button_title: Farbpalette umschalten diff --git a/locales/el.yml b/locales/el.yml deleted file mode 100644 index d872d0e..0000000 --- a/locales/el.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -el: diff --git a/locales/en.yml b/locales/en.yml deleted file mode 100644 index d997cf4..0000000 --- a/locales/en.yml +++ /dev/null @@ -1,2 +0,0 @@ -en: - toggle_button_title: Toggle color palette diff --git a/locales/en_GB.yml b/locales/en_GB.yml deleted file mode 100644 index 2d4fa18..0000000 --- a/locales/en_GB.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -en_GB: diff --git a/locales/es.yml b/locales/es.yml deleted file mode 100644 index 69d38be..0000000 --- a/locales/es.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -es: - toggle_button_title: Alternar paleta de colores diff --git a/locales/et.yml b/locales/et.yml deleted file mode 100644 index 0ea0b6d..0000000 --- a/locales/et.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -et: diff --git a/locales/fa_IR.yml b/locales/fa_IR.yml deleted file mode 100644 index 5651208..0000000 --- a/locales/fa_IR.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -fa_IR: diff --git a/locales/fi.yml b/locales/fi.yml deleted file mode 100644 index a443c74..0000000 --- a/locales/fi.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -fi: - toggle_button_title: Vaihda väripalettia diff --git a/locales/fr.yml b/locales/fr.yml deleted file mode 100644 index b96b960..0000000 --- a/locales/fr.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -fr: - toggle_button_title: Changer la palette de couleurs diff --git a/locales/gl.yml b/locales/gl.yml deleted file mode 100644 index fb911ce..0000000 --- a/locales/gl.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -gl: diff --git a/locales/he.yml b/locales/he.yml deleted file mode 100644 index ba5e3c5..0000000 --- a/locales/he.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -he: - toggle_button_title: החלפת ערכת צבעים diff --git a/locales/hr.yml b/locales/hr.yml deleted file mode 100644 index 93343ce..0000000 --- a/locales/hr.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -hr: diff --git a/locales/hu.yml b/locales/hu.yml deleted file mode 100644 index 76b6e9d..0000000 --- a/locales/hu.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -hu: diff --git a/locales/hy.yml b/locales/hy.yml deleted file mode 100644 index cb18f64..0000000 --- a/locales/hy.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -hy: diff --git a/locales/id.yml b/locales/id.yml deleted file mode 100644 index 596e36b..0000000 --- a/locales/id.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -id: diff --git a/locales/it.yml b/locales/it.yml deleted file mode 100644 index c558f50..0000000 --- a/locales/it.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -it: - toggle_button_title: Attiva/disattiva lo schema di colori diff --git a/locales/ja.yml b/locales/ja.yml deleted file mode 100644 index 88e2ef9..0000000 --- a/locales/ja.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ja: - toggle_button_title: 色パレットの切り替え diff --git a/locales/ko.yml b/locales/ko.yml deleted file mode 100644 index 18dd77f..0000000 --- a/locales/ko.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ko: diff --git a/locales/lt.yml b/locales/lt.yml deleted file mode 100644 index 16bb197..0000000 --- a/locales/lt.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -lt: diff --git a/locales/lv.yml b/locales/lv.yml deleted file mode 100644 index 59e0ef6..0000000 --- a/locales/lv.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -lv: diff --git a/locales/nb_NO.yml b/locales/nb_NO.yml deleted file mode 100644 index 2e2224d..0000000 --- a/locales/nb_NO.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -nb_NO: diff --git a/locales/nl.yml b/locales/nl.yml deleted file mode 100644 index 0b35ddf..0000000 --- a/locales/nl.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -nl: - toggle_button_title: Kleurenpalet schakelen diff --git a/locales/pl_PL.yml b/locales/pl_PL.yml deleted file mode 100644 index a260c31..0000000 --- a/locales/pl_PL.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -pl_PL: diff --git a/locales/pt.yml b/locales/pt.yml deleted file mode 100644 index 298ba52..0000000 --- a/locales/pt.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -pt: diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml deleted file mode 100644 index 0c9c321..0000000 --- a/locales/pt_BR.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -pt_BR: - toggle_button_title: Alternar paleta de cores diff --git a/locales/ro.yml b/locales/ro.yml deleted file mode 100644 index 08a77f8..0000000 --- a/locales/ro.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ro: diff --git a/locales/ru.yml b/locales/ru.yml deleted file mode 100644 index 3ab1d59..0000000 --- a/locales/ru.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ru: - toggle_button_title: Переключить цветовую палитру diff --git a/locales/sk.yml b/locales/sk.yml deleted file mode 100644 index 6f81562..0000000 --- a/locales/sk.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sk: diff --git a/locales/sl.yml b/locales/sl.yml deleted file mode 100644 index 23489a4..0000000 --- a/locales/sl.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sl: diff --git a/locales/sq.yml b/locales/sq.yml deleted file mode 100644 index 7f051b7..0000000 --- a/locales/sq.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sq: diff --git a/locales/sr.yml b/locales/sr.yml deleted file mode 100644 index 88d63d6..0000000 --- a/locales/sr.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sr: diff --git a/locales/sv.yml b/locales/sv.yml deleted file mode 100644 index b165aa2..0000000 --- a/locales/sv.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sv: diff --git a/locales/sw.yml b/locales/sw.yml deleted file mode 100644 index 0d7cdd0..0000000 --- a/locales/sw.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -sw: diff --git a/locales/te.yml b/locales/te.yml deleted file mode 100644 index 03967bd..0000000 --- a/locales/te.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -te: diff --git a/locales/th.yml b/locales/th.yml deleted file mode 100644 index 7de85ff..0000000 --- a/locales/th.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -th: diff --git a/locales/tr_TR.yml b/locales/tr_TR.yml deleted file mode 100644 index 085ee64..0000000 --- a/locales/tr_TR.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -tr_TR: - toggle_button_title: Renk paletini değiştir diff --git a/locales/ug.yml b/locales/ug.yml deleted file mode 100644 index a6bf018..0000000 --- a/locales/ug.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ug: diff --git a/locales/uk.yml b/locales/uk.yml deleted file mode 100644 index f139054..0000000 --- a/locales/uk.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -uk: diff --git a/locales/ur.yml b/locales/ur.yml deleted file mode 100644 index b4a9c21..0000000 --- a/locales/ur.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -ur: diff --git a/locales/vi.yml b/locales/vi.yml deleted file mode 100644 index f629dcf..0000000 --- a/locales/vi.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -vi: diff --git a/locales/zh_CN.yml b/locales/zh_CN.yml deleted file mode 100644 index 52be761..0000000 --- a/locales/zh_CN.yml +++ /dev/null @@ -1,8 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -zh_CN: - toggle_button_title: 切换调色板 diff --git a/locales/zh_TW.yml b/locales/zh_TW.yml deleted file mode 100644 index 7e15fab..0000000 --- a/locales/zh_TW.yml +++ /dev/null @@ -1,7 +0,0 @@ -# WARNING: Never edit this file. -# It will be overwritten when translations are pulled from Crowdin. -# -# To work with us on translations, join this project: -# https://translate.discourse.org/ - -zh_TW: diff --git a/settings.yml b/settings.yml deleted file mode 100644 index cafc938..0000000 --- a/settings.yml +++ /dev/null @@ -1,8 +0,0 @@ -svg_icons: - default: "moon|sun" - type: "list" - list_type: "compact" -add_color_scheme_toggle_to_header: - default: false - type: bool - description: "Add color scheme toggle button to site header" diff --git a/spec/system/color_scheme_toggle_spec.rb b/spec/system/color_scheme_toggle_spec.rb deleted file mode 100644 index 412b417..0000000 --- a/spec/system/color_scheme_toggle_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe "", system: true do - fab!(:topic) { Fabricate(:post).topic } - fab!(:user) - fab!(:post) { Fabricate(:post, topic:, raw: <<~POST * 20) } - Very lengthy post with lots of height for testing logo change when scrolling - - Here's another paragraph to make the post take very large vertical space\n - POST - - fab!(:dark_mode_image) { Fabricate(:image_upload, color: "white", width: 400, height: 120) } - fab!(:light_mode_image) { Fabricate(:image_upload, color: "black", width: 400, height: 120) } - - fab!(:small_dark_mode_image) { Fabricate(:image_upload, color: "white", width: 120, height: 120) } - fab!(:small_light_mode_image) do - Fabricate(:image_upload, color: "black", width: 120, height: 120) - end - - let!(:theme_component) { upload_theme_component } - - let(:topic_page) { PageObjects::Pages::Topic.new } - - before do - SiteSetting.logo = light_mode_image - SiteSetting.logo_small = small_light_mode_image - SiteSetting.logo_dark = dark_mode_image - SiteSetting.logo_small_dark = small_dark_mode_image - sign_in(user) - end - - it "applies the correct `media` attribute on the source element when the logo is minimized upon scrolling" do - topic_page.visit_topic(topic) - - dark_logo_source = - find( - ".title picture source[media=\"(prefers-color-scheme: dark)\"][srcset*=\"#{dark_mode_image.url}\"]", - visible: false, - ) - expect(dark_logo_source).to be_present - - find(".color-scheme-toggler").click - - dark_logo_source = - find( - ".title picture source[media=\"all\"][srcset*=\"#{dark_mode_image.url}\"]", - visible: false, - ) - expect(dark_logo_source).to be_present - - page.scroll_to(find(".topic-footer-main-buttons .create")) - - dark_logo_source = - find( - ".title picture source[media=\"all\"][srcset*=\"#{small_dark_mode_image.url}\"]", - visible: false, - ) - expect(dark_logo_source).to be_present - end -end diff --git a/test/acceptance/toggle-test.js b/test/acceptance/toggle-test.js deleted file mode 100644 index ee7ffcc..0000000 --- a/test/acceptance/toggle-test.js +++ /dev/null @@ -1,99 +0,0 @@ -import { visit } from "@ember/test-helpers"; -import { test } from "qunit"; -import Session from "discourse/models/session"; -import { acceptance } from "discourse/tests/helpers/qunit-helpers"; - -acceptance("Color Scheme Toggle - header icon", function (needs) { - needs.hooks.beforeEach(function () { - settings.add_color_scheme_toggle_to_header = true; - Session.current().set("darkModeAvailable", true); - }); - - needs.hooks.afterEach(function () { - Session.current().set("darkModeAvailable", null); - }); - - test("shows in header", async function (assert) { - await visit("/"); - - assert - .dom(".header-color-scheme-toggle") - .exists("button present in header"); - }); -}); - -acceptance("Color Scheme Toggle - no op", function (needs) { - needs.hooks.beforeEach(function () { - settings.add_color_scheme_toggle_to_header = true; - }); - - test("does not show when no dark color scheme available", async function (assert) { - await visit("/"); - - assert - .dom(".header-color-scheme-toggle") - .doesNotExist("button is not present in header"); - }); -}); - -acceptance("Color Scheme Toggle - sidebar icon", function (needs) { - needs.settings({ - enable_sidebar: true, - enable_experimental_sidebar_hamburger: true, - }); - - needs.hooks.beforeEach(function () { - settings.add_color_scheme_toggle_to_header = false; - Session.current().set("darkModeAvailable", true); - }); - - needs.hooks.afterEach(function () { - Session.current().set("darkModeAvailable", null); - }); - - test("shows in sidebar", async function (assert) { - await visit("/"); - - assert - .dom(".header-color-scheme-toggle") - .doesNotExist("button not present in header"); - - assert - .dom(".sidebar-footer-wrapper .color-scheme-toggler") - .exists("button in footer"); - }); -}); - -acceptance("Color Scheme Toggle - sidebar icon", function (needs) { - needs.pretender((server, helper) => { - server.get("/color-scheme-stylesheet/2.json", () => { - return helper.response({ - color_scheme_id: 2, - new_href: - "/stylesheets/color_definitions_wcag-dark_2_52_a09af66a69bc639c6d63acd81d4c3cea2985282e.css", - }); - }); - }); - - needs.settings({ - enable_sidebar: true, - enable_experimental_sidebar_hamburger: true, - default_dark_mode_color_scheme_id: 2, - }); - - needs.hooks.beforeEach(function () { - settings.add_color_scheme_toggle_to_header = false; - }); - - test("shows in sidebar if site has auto dark mode", async function (assert) { - await visit("/"); - - assert - .dom(".header-color-scheme-toggle") - .doesNotExist("button not present in header"); - - assert - .dom(".sidebar-footer-wrapper .color-scheme-toggler") - .exists("button in footer"); - }); -}); diff --git a/translator.yml b/translator.yml deleted file mode 100644 index d1cf3ae..0000000 --- a/translator.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Configuration file for discourse-translator-bot - -files: -- source_path: locales/en.yml - destination_path: translations.yml From 7c30f510a5a80bd842b5163b59ad8d6c48176582 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Mon, 22 Sep 2025 14:10:39 +0800 Subject: [PATCH 4/4] feature: openubmc --- javascripts/discourse/initializers/alert.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/javascripts/discourse/initializers/alert.js b/javascripts/discourse/initializers/alert.js index 30f5dc9..6f3cdb4 100644 --- a/javascripts/discourse/initializers/alert.js +++ b/javascripts/discourse/initializers/alert.js @@ -17,13 +17,13 @@ export default { "https://unpkg.com/@opensig/open-analytics@0.0.9/dist/open-analytics.mjs" ).then(({ OpenAnalytics, getClientInfo, OpenEventKeys }) => { const oa = new OpenAnalytics({ - appKey: "openEuler", + appKey: "openUBMC", request: (data) => { if (!isCookieAgreed()) { disableOA(); return; } - fetch("/api-dsapi/query/track/openeuler", { + fetch("/api-dsapi/query/track/openubmc", { body: JSON.stringify(data), method: "POST", headers: { "Content-Type": "application/json" }, @@ -47,9 +47,9 @@ export default { const disableOA = () => { oa.enableReporting(false); [ - "oa-openEuler-client", - "oa-openEuler-events", - "oa-openEuler-session", + "oa-openUBMC-client", + "oa-openUBMC-events", + "oa-openUBMC-session", ].forEach((key) => { localStorage.removeItem(key); });