74 lines
23 KiB
JavaScript
74 lines
23 KiB
JavaScript
|
|
// ========================================
|
|||
|
|
// 按钮配置模块
|
|||
|
|
// ========================================
|
|||
|
|
|
|||
|
|
import { i18n } from './i18n.js';
|
|||
|
|
import { config } from './config.js';
|
|||
|
|
|
|||
|
|
let allButtons = [];
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
export const buildAllButtons = async () => {
|
|||
|
|
await i18n.ready();
|
|||
|
|
allButtons = [
|
|||
|
|
{ id: "buttonSavor-light", type: "theme", group: "light", label: i18n.t("Light 配色"), styleId: "Sv-theme-color-light", svg: "<path fill='#f4f4f3' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#e2e2e2' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#fff' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'light'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonsalt", type: "theme", group: "light", label: i18n.t("Salt 配色"), styleId: "Sv-theme-color-salt", svg: "<path fill='#d7e0df' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#ccd5d4' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#eaf2f2' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'salt'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonsugar", type: "theme", group: "light", label: i18n.t("Sugar 配色"), styleId: "Sv-theme-color-sugar", svg: "<path fill='#f3ede8' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#e8e1dc' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#f9f8f5' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'sugar'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonforest", type: "theme", group: "light", label: i18n.t("Forest 配色"), styleId: "Sv-theme-color-forest", svg: "<path fill='#ecefea' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#e0e4de' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#fff' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'forest'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonflower", type: "theme", group: "light", label: i18n.t("Flower 配色"), styleId: "Sv-theme-color-flower", svg: "<path fill='#f3eefc' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#e8e2f0' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#fffbff' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'flower'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonwind", type: "theme", group: "light", label: i18n.t("Wind 配色"), styleId: "Sv-theme-color-wind", svg: "<path fill='#d6d5d5' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#cdcccc' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#ecebeb' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'wind'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
// 配色按钮(dark)
|
|||
|
|
{ id: "buttonSavor-dark", type: "theme", group: "dark", label: i18n.t("Dark 配色"), styleId: "Sv-theme-color-dark", svg: "<path fill='#202528' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#2a2e32' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#2f3437' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'dark'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonvinegar", type: "theme", group: "dark", label: i18n.t("Vinegar 配色"), styleId: "Sv-theme-color-vinegar", svg: "<path fill='#191919' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#222222' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#222222' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'vinegar'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonocean", type: "theme", group: "dark", label: i18n.t("Ocean 配色"), styleId: "Sv-theme-color-ocean", svg: "<path fill='#141825' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#1e2330' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#1e2330' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'ocean'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
{ id: "buttonmountain", type: "theme", group: "dark", label: i18n.t("Mountain 配色"), styleId: "Sv-theme-color-mountain", svg: "<path fill='#1f211f' d='M0 0h56.889v32h-56.889v-32z'></path><path fill='#2d302d' d='M4.444 9.422h5.511c0.889 0 1.422-0.711 1.422-1.422 0-0.889-0.711-1.422-1.422-1.422h-5.511c-0.889 0-1.422 0.711-1.422 1.422 0 0.889 0.711 1.422 1.422 1.422zM11.556 11.022h-7.111c-0.711 0-1.422 0.711-1.422 1.6s0.711 1.422 1.422 1.422h7.111c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.6-1.422-1.6zM7.644 15.644h-3.2c-0.711 0-1.422 0.711-1.422 1.422s0.711 1.422 1.422 1.422h3.022c0.889 0 1.422-0.711 1.422-1.422s-0.533-1.422-1.244-1.422z'></path><path fill='#2d302d' d='M33.067 6.756v-2.489c0-0.533-0.533-1.067-1.067-1.067h-11.022c-0.533 0-1.067 0.533-1.067 1.067v2.489h-3.733c-0.533 0-1.067 0.533-1.067 1.067v24.178h41.778v-25.244h-23.822z'></path>", onEnable: () => { document.documentElement.setAttribute('savor-theme', 'mountain'); }, onDisable: () => { document.documentElement.removeAttribute('savor-theme'); } },
|
|||
|
|
// 功能按钮
|
|||
|
|
{ id: "concealButton", type: "feature", label: i18n.t("挖空"), styleId: "Sv-theme-color-conceal挖空", attrName: "conceal挖空", svg: "M16 10.667c-3.733 0-6.667 2.933-6.667 6.667 0 3.6 3.067 6.667 6.667 6.667 3.733 0 6.667-3.067 6.667-6.667 0-3.733-3.067-6.667-6.667-6.667zM16 22.533c-2.933 0-5.2-2.267-5.2-5.2s2.267-5.2 5.2-5.2c2.267 0 4.133 1.467 4.933 3.467-0.133 0-0.4 0-0.4 0.133-0.533 0.533-0.933 0.8-1.467 1.2 0 0-0.133 0-0.133 0.133-0.533 0.267-1.2 0.533-1.733 0.533 0 0 0 0-0.133 0-0.4 0.133-0.667 0.133-1.067 0.133-0.267 0-0.667 0-0.933-0.133h-0.133c-0.533-0.133-1.2-0.267-1.6-0.533-0.133-0.133-0.133-0.133-0.133-0.133-0.533-0.267-1.067-0.667-1.467-1.067-0.133-0.133-0.533-0.133-0.8 0-0.133 0.133-0.133 0.533 0 0.8 0.4 0.4 0.8 0.8 1.2 1.067l-0.933 0.8c-0.133 0.133-0.133 0.533 0.133 0.8 0.133 0.133 0.133 0.133 0.4 0.133 0.133 0 0.267-0.133 0.4-0.133l0.933-1.2c0.4 0.133 0.8 0.267 1.2 0.4l-0.267 1.2c-0.133 0.267 0.133 0.533 0.4 0.667h0.267c0.267 0 0.533-0.133 0.533-0.4l0.267-1.2h1.467l0.267 1.2c0.133 0.267 0.267 0.4 0.533 0.4h0.133c0.267-0.133 0.533-0.4 0.4-0.667l-0.267-1.2c0.4-0.133 0.8-0.267 1.2-0.4l0.933 1.2c0.133 0.133 0.267 0.133 0.4 0.133s0.267 0 0.4-0.133c0 0 0-0.133 0.133-0.133-0.933 1.867-2.8 3.333-5.067 3.333zM20.933 18.933c0-0.133 0-0.267-0.133-0.4l-0.8-1.067c0.4-0.267 0.8-0.533 1.067-0.8 0 0.267 0 0.533 0 0.667 0.133 0.533 0 1.067-0.133 1.6z", onEnable: () => { document.documentElement.setAttribute('savor-conceal-mark', 'true'); }, onDisable: () => { document.documentElement.removeAttribute('savor-conceal-mark'); } },
|
|||
|
|
{ id: "tabbarVertical", type: "feature", label: i18n.t("垂直页签"), styleId: "Sv-theme-color-tabbar垂直", attrName: "tabbar垂直", svg: "M21.067 10.667h-10.133c-0.8 0-1.6 0.8-1.6 1.6v10c0 0.933 0.8 1.733 1.6 1.733h10c0.933 0 1.6-0.8 1.6-1.6v-10.133c0.133-0.8-0.667-1.6-1.467-1.6zM21.333 22.4c0 0.133-0.133 0.267-0.267 0.267h-7.333v-7.733h7.6v7.467zM21.333 13.6h-10.667v-1.333c0-0.133 0.133-0.267 0.267-0.267h10c0.267 0 0.4 0.133 0.4 0.267v1.333z", onEnable: () => { document.getElementById("topBar")?.classList.remove('button_on'); config.set("topbar隐藏", "0"); document.documentElement.setAttribute('savor-tabbar', 'vertical'); setTimeout(() => window.tabbarResize?.init(), 500); }, onDisable: () => { document.documentElement.removeAttribute('savor-tabbar'); window.tabbarResize?.remove(); } },
|
|||
|
|
{ id: "topBar", type: "feature", label: i18n.t("顶栏合并"), styleId: "Sv-theme-color-topbar隐藏", attrName: "topbar隐藏", svg: "M21.067 10.667h-1.867c-0.133 0-0.133 0-0.267 0h-3.733c-0.133 0-0.133 0-0.267 0h-4c-0.8 0-1.6 0.8-1.6 1.6v10c0 0.933 0.8 1.733 1.6 1.733h10c0.933 0 1.6-0.8 1.6-1.6v-10.133c0.133-0.8-0.667-1.6-1.467-1.6zM15.333 12h2.4l-1.067 1.6h-2.4l1.067-1.6zM10.667 12.267c0-0.133 0.133-0.267 0.267-0.267h2.8l-1.067 1.6h-2v-1.333zM21.333 22.4c0 0.133-0.133 0.267-0.267 0.267h-10.133c-0.133 0-0.267-0.133-0.267-0.267v-7.333h10.667v7.333zM21.333 13.6h-3.067l1.067-1.6h1.6c0.267 0 0.4 0.133 0.4 0.267 0 0 0 1.333 0 1.333z", onEnable: () => { document.getElementById("tabbarVertical")?.classList.remove('button_on'); config.set("tabbar垂直", "0"); window.tabbarResize?.remove(); document.documentElement.setAttribute('savor-tabbar', 'merge'); window.theme.initTabBarsMarginUnified?.('right'); window.theme.initTabBarsMarginUnified?.('left'); if (window.updateTabBarsMargin) window.updateTabBarsMargin(); if (window.updateTabBarsMarginLeft) window.updateTabBarsMarginLeft(); }, onDisable: () => { document.documentElement.removeAttribute('savor-tabbar'); window.theme.cleanupTopbarMerge?.(); } },
|
|||
|
|
{ id: "bulletThreading", type: "feature", label: i18n.t("列表子弹线"), styleId: "Sv-theme-color-列表子弹线", attrName: "列表子弹线", svg: "M20 20c1.067 0 2 0.933 2 2s-0.933 2-2 2-2-0.933-2-2c0-1.067 0.933-2 2-2zM18.4 12c1.6 0 2.933 1.333 2.933 2.933s-1.333 2.933-2.933 2.933h-4.667c-0.933 0-1.6 0.8-1.6 1.6 0 0.933 0.8 1.6 1.6 1.6h2.933c0.267 0 0.667 0.267 0.667 0.667 0 0.267-0.267 0.667-0.667 0.667h-2.933c-1.733 0.267-3.067-1.067-3.067-2.8s1.333-2.933 3.067-2.933h4.667c0.933 0 1.6-0.8 1.6-1.6s-0.8-1.733-1.6-1.733h-2.933c-0.533 0-0.8-0.4-0.8-0.667s0.267-0.667 0.667-0.667c0 0 3.067 0 3.067 0zM20 21.333c-0.267 0-0.667 0.267-0.667 0.667 0 0.267 0.267 0.667 0.667 0.667s0.667-0.267 0.667-0.667c0-0.4-0.267-0.667-0.667-0.667v0zM12 10.667c1.067 0 2 0.933 2 2s-0.933 2-2 2c-1.067 0-2-0.933-2-2s0.933-2 2-2zM12 12c-0.267 0-0.667 0.267-0.667 0.667s0.4 0.667 0.667 0.667c0.4 0 0.667-0.267 0.667-0.667v0c0-0.4-0.267-0.667-0.667-0.667z", onEnable: () => { document.documentElement.setAttribute('savor-bullet-threading', 'true'); window.initBulletThreading?.(); }, onDisable: () => { document.documentElement.removeAttribute('savor-bullet-threading'); window.removeBulletThreading?.(); } },
|
|||
|
|
{ id: "colorFolder", type: "feature", label: i18n.t("彩色文档树"), styleId: "Sv-theme-color-彩色文档树", attrName: "彩色文档树", svg: "M11.6 14.933c0-0.133 0-0.267 0-0.4 0-2.533 2-4.533 4.4-4.533s4.4 2 4.4 4.533c0 0.133 0 0.267 0 0.4 1.467 0.667 2.533 2.267 2.533 4.133 0 2.533-2 4.533-4.4 4.533-0.933 0-1.867-0.267-2.533-0.8-0.8 0.533-1.6 0.8-2.533 0.8-2.4 0-4.4-2-4.4-4.533 0-1.867 0.933-3.467 2.533-4.133zM11.867 16.267c-0.933 0.533-1.6 1.6-1.6 2.8 0 1.733 1.467 3.2 3.2 3.2 0.533 0 1.067-0.133 1.6-0.4-0.667-0.8-0.933-1.733-0.933-2.8 0-0.133 0-0.267 0-0.4-1.067-0.533-1.867-1.467-2.267-2.4v0zM15.333 18.933v0c0 1.867 1.467 3.2 3.2 3.2s3.2-1.467 3.2-3.2c0-1.2-0.667-2.267-1.6-2.8-0.667 1.6-2.267 2.8-4.133 2.8-0.267 0.133-0.4 0-0.667 0v0zM16 17.733c1.733 0 3.2-1.467 3.2-3.2s-1.467-3.2-3.2-3.2-3.2 1.467-3.2 3.2 1.467 3.2 3.2 3.2z", onEnable: () => { document.documentElement.setAttribute('savor-color-folder', 'true'); }, onDisable: () => { document.documentElement.removeAttribute('savor-color-folder'); } },
|
|||
|
|
{ id: "headingDots", type: "feature", label: i18n.t("标题点标识"), styleId: "Sv-theme-color-标题点标识", attrName: "标题点标识", svg: "M18.533 15.467c-0.8 0-1.467 0.667-1.467 1.467s0.667 1.467 1.467 1.467 1.467-0.667 1.467-1.467-0.667-1.467-1.467-1.467zM13.467 20.4c-0.8 0-1.467 0.667-1.467 1.467s0.667 1.467 1.467 1.467 1.467-0.667 1.467-1.467c0-0.8-0.667-1.467-1.467-1.467zM18.533 20.4c-0.8 0-1.467 0.667-1.467 1.467s0.667 1.467 1.467 1.467 1.467-0.667 1.467-1.467c0-0.8-0.667-1.467-1.467-1.467zM13.467 15.467c-0.8 0-1.467 0.667-1.467 1.467s0.667 1.467 1.467 1.467 1.467-0.667 1.467-1.467-0.667-1.467-1.467-1.467zM18.533 13.467c0.8 0 1.467-0.667 1.467-1.467s-0.667-1.467-1.467-1.467-1.467 0.667-1.467 1.467 0.667 1.467 1.467 1.467zM13.467 10.667c-0.8 0-1.467 0.667-1.467 1.467s0.667 1.467 1.467 1.467 1.467-0.667 1.467-1.467c0-0.933-0.667-1.467-1.467-1.467z", onEnable: () => { document.documentElement.setAttribute('savor-heading-dots', 'true'); }, onDisable: () => { document.documentElement.removeAttribute('savor-heading-dots'); } },
|
|||
|
|
{ id: "typewriterMode", type: "feature", label: i18n.t("打字机模式"), styleId: "Sv-theme-typewriter-mode", attrName: "typewriterMode", svg: "M20.133 10.667c1.6 0 2.8 1.2 2.8 2.8v0 6.933c0 1.6-1.2 2.8-2.8 2.8v0h-8.267c-1.6 0-2.8-1.2-2.8-2.8v0-7.067c0-1.467 1.2-2.667 2.8-2.667 0 0 8.267 0 8.267 0zM20.133 12h-8.267c-0.8 0-1.333 0.533-1.333 1.333v0 6.933c0 0.8 0.533 1.333 1.333 1.333h8.533c0.8 0 1.333-0.533 1.333-1.333v-6.933c-0.133-0.667-0.667-1.333-1.6-1.333v0zM19.467 18.933c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667h-6.933c-0.4 0-0.667-0.267-0.667-0.667s0.267-0.667 0.667-0.667h6.933zM12.533 16.133c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667-0.667-0.267-0.667-0.667 0.267-0.667 0.667-0.667zM16 16.133c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667c-0.4 0-0.667-0.267-0.667-0.667s0.267-0.667 0.667-0.667zM19.467 16.133c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667v0c-0.4 0-0.667-0.267-0.667-0.667s0.267-0.667 0.667-0.667zM12.533 13.333c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667-0.667-0.267-0.667-0.667 0.267-0.667 0.667-0.667zM16 13.333c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667c-0.4 0-0.667-0.267-0.667-0.667s0.267-0.667 0.667-0.667zM19.467 13.333c0.4 0 0.667 0.267 0.667 0.667s-0.267 0.667-0.667 0.667v0c-0.4 0-0.667-0.267-0.667-0.667s0.267-0.667 0.667-0.667z", onEnable: () => { window.enableTypewriterMode?.(); }, onDisable: () => { window.disableTypewriterMode?.(); } },
|
|||
|
|
{ id: "sidebarMemo", type: "feature", label: i18n.t("侧边栏备注"), styleId: "Sv-theme-sidebar-memo", attrName: "sidebarMemo", svg: "M19.2 13.733h-6.4c-0.4 0-0.667 0.267-0.667 0.667s0.267 0.667 0.667 0.667h6.4c0.4 0 0.667-0.267 0.667-0.667s-0.267-0.667-0.667-0.667zM19.2 16.267h-6.4c-0.4 0-0.667 0.267-0.667 0.667s0.267 0.667 0.667 0.667h6.4c0.4 0 0.667-0.267 0.667-0.667s-0.267-0.667-0.667-0.667zM20.533 10.533h-9.067c-1.067 0-1.867 0.8-1.867 1.867v6.4c0 1.067 0.8 1.867 1.867 1.867h7.467l2.4 2.4c0.133 0.133 0.267 0.133 0.4 0.133s0.133 0 0.267 0c0.267-0.133 0.4-0.267 0.4-0.533v-10.267c0-1.067-0.8-1.867-1.867-1.867zM21.067 21.2l-1.467-1.467c-0.133-0.133-0.267-0.133-0.4-0.133h-7.733c-0.4 0-0.667-0.267-0.667-0.667v-6.533c0-0.4 0.267-0.667 0.667-0.667h8.933c0.4 0 0.667 0.267 0.667 0.667v8.8z", onEnable: () => {
|
|||
|
|
// 互斥功能:关闭另一个侧边栏功能
|
|||
|
|
if (config.get("sidebarBlockMemo") === "1") {
|
|||
|
|
config.set("sidebarBlockMemo", "0");
|
|||
|
|
document.documentElement.removeAttribute('savor-sidebar-block-memo');
|
|||
|
|
window.sidebarMemo?.openSideBar(false, true);
|
|||
|
|
// 更新按钮UI状态
|
|||
|
|
const blockMemoButton = document.getElementById("sidebarBlockMemo");
|
|||
|
|
if (blockMemoButton) {
|
|||
|
|
blockMemoButton.classList.remove("button_on");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
document.documentElement.setAttribute('savor-sidebar-memo', 'true');
|
|||
|
|
setTimeout(() => window.sidebarMemo?.openSideBar(true, true), 10);
|
|||
|
|
}, onDisable: () => { document.documentElement.removeAttribute('savor-sidebar-memo'); window.sidebarMemo?.openSideBar(false, true); } },
|
|||
|
|
{ id: "sidebarBlockMemo", type: "feature", label: i18n.t("行内顶部备注"), styleId: "Sv-theme-sidebar-block-memo", attrName: "sidebarBlockMemo", svg: "M19.2 13.733h-6.4c-0.4 0-0.667 0.267-0.667 0.667s0.267 0.667 0.667 0.667h6.4c0.4 0 0.667-0.267 0.667-0.667s-0.267-0.667-0.667-0.667zM19.2 16.267h-6.4c-0.4 0-0.667 0.267-0.667 0.667s0.267 0.667 0.667 0.667h6.4c0.4 0 0.667-0.267 0.667-0.667s-0.267-0.667-0.667-0.667zM20.533 10.533h-9.067c-1.067 0-1.867 0.8-1.867 1.867v6.4c0 1.067 0.8 1.867 1.867 1.867h7.467l2.4 2.4c0.133 0.133 0.267 0.133 0.4 0.133s0.133 0 0.267 0c0.267-0.133 0.4-0.267 0.4-0.533v-10.267c0-1.067-0.8-1.867-1.867-1.867zM21.067 21.2l-1.467-1.467c-0.133-0.133-0.267-0.133-0.4-0.133h-7.733c-0.4 0-0.667-0.267-0.667-0.667v-6.533c0-0.4 0.267-0.667 0.667-0.667h8.933c0.4 0 0.667 0.267 0.667 0.667v8.8z", onEnable: () => {
|
|||
|
|
// 互斥功能:关闭另一个侧边栏功能
|
|||
|
|
if (config.get("sidebarMemo") === "1") {
|
|||
|
|
config.set("sidebarMemo", "0");
|
|||
|
|
document.documentElement.removeAttribute('savor-sidebar-memo');
|
|||
|
|
window.sidebarMemo?.openSideBar(false, true);
|
|||
|
|
// 更新按钮UI状态
|
|||
|
|
const memoButton = document.getElementById("sidebarMemo");
|
|||
|
|
if (memoButton) {
|
|||
|
|
memoButton.classList.remove("button_on");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
document.documentElement.setAttribute('savor-sidebar-block-memo', 'true');
|
|||
|
|
setTimeout(() => window.sidebarMemo?.openSideBar(true, true), 10);
|
|||
|
|
}, onDisable: () => { document.documentElement.removeAttribute('savor-sidebar-block-memo'); window.sidebarMemo?.openSideBar(false, true); } },
|
|||
|
|
// 官方字体配色按钮
|
|||
|
|
{ id: "officialFontColors", type: "feature", label: i18n.t("官方字体配色"), styleId: "Sv-theme-official-font-colors", attrName: "officialFontColors", svg: "M13.067 10.667v7.467l2.933 2.933v-7.6l-2.933-2.8zM13.733 17.733v-5.333l1.733 1.6v5.333l-1.733-1.6zM9.333 22l3.733-3.733v-7.467l-3.733 3.6v7.6zM16 21.067l2.933-2.933v-7.467l-2.933 2.8v7.6zM18.933 10.667v7.467l3.733 3.733v-7.6l-3.733-3.6zM22 20.133l-2.533-2.4v-5.333l2.533 2.4v5.333z", onEnable: () => { document.documentElement.setAttribute('savor-official-font-colors', 'true'); }, onDisable: () => { document.documentElement.removeAttribute('savor-official-font-colors'); } }
|
|||
|
|
];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
export const getAllButtons = () => allButtons;
|
|||
|
|
|
|||
|
|
export const initButtons = async () => {
|
|||
|
|
await buildAllButtons();
|
|||
|
|
window.allButtons = allButtons;
|
|||
|
|
};
|