feat: support function button custom
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
- Terminal 风格的响应式页面布局
|
- Terminal 风格的响应式页面布局
|
||||||
- 浅色, 深色和跟随系统 3 种外观模式, 页头按钮会显示太阳, 月亮或圆圈图标
|
- 浅色, 深色和跟随系统 3 种外观模式, 页头按钮会显示太阳, 月亮或圆圈图标
|
||||||
- 12 套内置配色和多套自定义配色
|
- 12 套内置配色和多套自定义配色
|
||||||
- 可分别控制页头的搜索, 配色选择, 外观切换和像素化按钮
|
- 可排序的页头功能按钮, 支持搜索, 配色选择, 外观切换, 像素化和自定义功能
|
||||||
- 常规图标和像素图标切换
|
- 常规图标和像素图标切换
|
||||||
- 内置 JetBrains Mono, Hack 和 Fira Code 字体, 也可使用访客系统字体
|
- 内置 JetBrains Mono, Hack 和 Fira Code 字体, 也可使用访客系统字体
|
||||||
- 支持多字体 fallback, PostScript Name 本地匹配和高级 `@font-face` 配置
|
- 支持多字体 fallback, PostScript Name 本地匹配和高级 `@font-face` 配置
|
||||||
@@ -63,15 +63,15 @@
|
|||||||
### 页头
|
### 页头
|
||||||
|
|
||||||
| 设置 | 配置名 | 说明 |
|
| 设置 | 配置名 | 说明 |
|
||||||
|---------|---------------------------------------|------------------|
|
|---------|------------------|---------------------|
|
||||||
| Logo 文本 | `header.logo` | 留空时使用 Halo 站点标题 |
|
| Logo 文本 | `header.logo` | 留空时使用 Halo 站点标题 |
|
||||||
| 搜索按钮 | `header.search_button_enable` | 搜索组件插件可用时展示 |
|
| 功能按钮 | `header.buttons` | 按数组顺序展示内置按钮和自定义功能按钮 |
|
||||||
| 配色切换按钮 | `header.color_scheme_switcher_enable` | 展示自动发现的配色列表 |
|
|
||||||
| 深浅切换按钮 | `header.appearance_switcher_enable` | 在浅色, 深色和跟随系统之间循环 |
|
|
||||||
| 像素化按钮 | `header.pixel_style_switcher_enable` | 切换像素字体和像素图标 |
|
|
||||||
|
|
||||||
搜索, 配色切换, 深浅切换和像素化按钮都可以自定义普通图标与像素风格图标. 深浅切换按钮可分别设置浅色, 深色和
|
`header.buttons` 默认包含搜索, 外观切换和像素化按钮. 在数组中添加, 删除或拖动条目即可控制按钮的显示与顺序;
|
||||||
跟随系统三种状态的图标. 只设置其中一种自定义图标时, 普通和像素模式都会使用该图标; 两者都留空时才使用主题内置图标.
|
搜索按钮仅在搜索组件插件可用时展示. 内置按钮可自定义普通和像素风格图标, 留空时使用主题内置图标.
|
||||||
|
|
||||||
|
自定义功能按钮需设置按钮名称, `onclick` JavaScript 和图标; 可选的像素风格图标留空时使用普通图标. `onclick` 中可使用
|
||||||
|
`event` 和 `this`; 代码会在访客点击按钮时执行, 只应填写可信任的 JavaScript.
|
||||||
|
|
||||||
外观切换顺序为 `浅色 -> 深色 -> 跟随系统`; 图标依次为太阳, 月亮和圆圈. 切换外观模式时会清除访客单独选择的配色,
|
外观切换顺序为 `浅色 -> 深色 -> 跟随系统`; 图标依次为太阳, 月亮和圆圈. 切换外观模式时会清除访客单独选择的配色,
|
||||||
让浅色和深色模式重新使用主题设置中对应的方案.
|
让浅色和深色模式重新使用主题设置中对应的方案.
|
||||||
|
|||||||
+85
-82
@@ -49,114 +49,117 @@ spec:
|
|||||||
name: logo
|
name: logo
|
||||||
value:
|
value:
|
||||||
help: 设置左上角 logo 文本, 不设置默认为 halo 中设置的站点标题
|
help: 设置左上角 logo 文本, 不设置默认为 halo 中设置的站点标题
|
||||||
- $formkit: checkbox
|
- $formkit: array
|
||||||
name: search_button_enable
|
name: buttons
|
||||||
id: search_button_enable
|
label: 功能按钮
|
||||||
label: 展示搜索按钮
|
value:
|
||||||
value: true
|
- value: search
|
||||||
help: 搜索组件插件可用时在页头展示搜索按钮
|
- value: color_scheme
|
||||||
|
- value: appearance
|
||||||
|
- value: pixel_style
|
||||||
|
help: 数组顺序即页头按钮顺序; 内置按钮每种建议只添加一次
|
||||||
|
itemLabels:
|
||||||
|
- type: "text"
|
||||||
|
if: "$value.value !== 'custom'"
|
||||||
|
label: "$value.value"
|
||||||
|
- type: "text"
|
||||||
|
if: "$value.value === 'custom'"
|
||||||
|
label: "$value.options.name"
|
||||||
|
children:
|
||||||
|
- $formkit: select
|
||||||
|
name: value
|
||||||
|
label: 按钮
|
||||||
|
validation: "required"
|
||||||
|
options:
|
||||||
|
- label: 搜索
|
||||||
|
value: search
|
||||||
|
- label: 配色切换
|
||||||
|
value: color_scheme
|
||||||
|
- label: 外观切换
|
||||||
|
value: appearance
|
||||||
|
- label: 像素化
|
||||||
|
value: pixel_style
|
||||||
|
- label: 自定义功能
|
||||||
|
value: custom
|
||||||
|
- $formkit: group
|
||||||
|
if: "$value.value !== 'custom'"
|
||||||
|
name: options
|
||||||
|
key: standard-button-options
|
||||||
|
label: 图标选项
|
||||||
|
children:
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(search_button_enable).value === true"
|
name: iconify
|
||||||
key: search-icon
|
label: 图标
|
||||||
name: search_icon
|
|
||||||
label: 搜索按钮图标
|
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
help: 留空时使用主题内置图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(search_button_enable).value === true"
|
name: pixel_iconify
|
||||||
key: search-pixel-icon
|
label: 像素风格图标
|
||||||
name: search_pixel_icon
|
|
||||||
label: 搜索按钮像素风格图标
|
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
help: 留空时优先使用自定义普通图标, 否则使用主题内置像素图标
|
||||||
- $formkit: checkbox
|
- $formkit: group
|
||||||
name: color_scheme_switcher_enable
|
if: "$value.value === appearance"
|
||||||
id: color_scheme_switcher_enable
|
name: options
|
||||||
label: 展示配色切换按钮
|
key: appearance-button-options
|
||||||
value: false
|
label: 外观切换
|
||||||
help: 在页头展示配色选择下拉框
|
children:
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(color_scheme_switcher_enable).value === true"
|
name: light_iconify
|
||||||
key: color-scheme-icon
|
|
||||||
name: color_scheme_icon
|
|
||||||
label: 配色切换按钮图标
|
|
||||||
format: svg
|
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
|
||||||
- $formkit: iconify
|
|
||||||
if: "$get(color_scheme_switcher_enable).value === true"
|
|
||||||
key: color-scheme-pixel-icon
|
|
||||||
name: color_scheme_pixel_icon
|
|
||||||
label: 配色切换按钮像素风格图标
|
|
||||||
format: svg
|
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
|
||||||
- $formkit: checkbox
|
|
||||||
name: appearance_switcher_enable
|
|
||||||
id: appearance_switcher_enable
|
|
||||||
label: 展示深浅切换按钮
|
|
||||||
value: true
|
|
||||||
help: 在页头展示浅色, 深色和跟随系统三态切换按钮
|
|
||||||
- $formkit: iconify
|
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
|
||||||
key: appearance-light-icon
|
|
||||||
name: appearance_light_icon
|
|
||||||
label: 浅色模式图标
|
label: 浅色模式图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
help: 留空时使用主题内置图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
name: light_pixel_iconify
|
||||||
key: appearance-light-pixel-icon
|
|
||||||
name: appearance_light_pixel_icon
|
|
||||||
label: 浅色模式像素风格图标
|
label: 浅色模式像素风格图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
help: 留空时优先使用自定义普通图标, 否则使用主题内置像素图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
name: dark_iconify
|
||||||
key: appearance-dark-icon
|
|
||||||
name: appearance_dark_icon
|
|
||||||
label: 深色模式图标
|
label: 深色模式图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
help: 留空时使用主题内置图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
name: dark_pixel_iconify
|
||||||
key: appearance-dark-pixel-icon
|
|
||||||
name: appearance_dark_pixel_icon
|
|
||||||
label: 深色模式像素风格图标
|
label: 深色模式像素风格图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
help: 留空时优先使用自定义普通图标, 否则使用主题内置像素图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
name: system_iconify
|
||||||
key: appearance-system-icon
|
|
||||||
name: appearance_system_icon
|
|
||||||
label: 跟随系统模式图标
|
label: 跟随系统模式图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
help: 留空时使用主题内置图标
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(appearance_switcher_enable).value === true"
|
name: system_pixel_iconify
|
||||||
key: appearance-system-pixel-icon
|
|
||||||
name: appearance_system_pixel_icon
|
|
||||||
label: 跟随系统模式像素风格图标
|
label: 跟随系统模式像素风格图标
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
help: 留空时优先使用自定义普通图标, 否则使用主题内置像素图标
|
||||||
- $formkit: checkbox
|
- $formkit: group
|
||||||
name: pixel_style_switcher_enable
|
if: "$value.value === custom"
|
||||||
id: pixel_style_switcher_enable
|
name: options
|
||||||
label: 展示像素化按钮
|
key: custom-button-options
|
||||||
value: true
|
label: 自定义功能按钮选项
|
||||||
help: 在页头展示像素风格切换按钮
|
children:
|
||||||
|
- $formkit: text
|
||||||
|
name: name
|
||||||
|
label: 按钮名称
|
||||||
|
validation: "required:trim|length:1,64"
|
||||||
|
help: 用于按钮的无障碍名称和鼠标提示
|
||||||
|
- $formkit: code
|
||||||
|
name: onclick
|
||||||
|
label: onclick
|
||||||
|
language: js
|
||||||
|
validation: "required:trim"
|
||||||
|
help: 点击按钮时执行的 JavaScript, 可使用 event 和 this
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(pixel_style_switcher_enable).value === true"
|
name: iconify
|
||||||
key: pixel-style-icon
|
label: 图标
|
||||||
name: pixel_style_icon
|
|
||||||
label: 像素化按钮图标
|
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义像素风格图标; 像素图标也未设置时使用内置图标
|
validation: "required"
|
||||||
- $formkit: iconify
|
- $formkit: iconify
|
||||||
if: "$get(pixel_style_switcher_enable).value === true"
|
name: pixel_iconify
|
||||||
key: pixel-style-pixel-icon
|
label: 像素风格图标
|
||||||
name: pixel_style_pixel_icon
|
|
||||||
label: 像素化按钮像素风格图标
|
|
||||||
format: svg
|
format: svg
|
||||||
help: 留空时使用自定义普通图标; 普通图标也未设置时使用内置像素图标
|
help: 留空时使用普通图标
|
||||||
- group: typography
|
- group: typography
|
||||||
label: 字体与排版
|
label: 字体与排版
|
||||||
formSchema:
|
formSchema:
|
||||||
|
|||||||
@@ -57,10 +57,7 @@ function populateColorSchemeMenu(menu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function syncColorSchemePicker() {
|
function syncPicker(picker) {
|
||||||
const picker = document.getElementById("color-scheme-picker");
|
|
||||||
if (!picker) return;
|
|
||||||
|
|
||||||
const storedScheme = getStoredPreference(PREFERENCE_KEYS.colorScheme);
|
const storedScheme = getStoredPreference(PREFERENCE_KEYS.colorScheme);
|
||||||
const options = Array.from(picker.querySelectorAll("[data-color-scheme]"));
|
const options = Array.from(picker.querySelectorAll("[data-color-scheme]"));
|
||||||
const hasStoredOption = storedScheme && options
|
const hasStoredOption = storedScheme && options
|
||||||
@@ -78,7 +75,7 @@ export function syncColorSchemePicker() {
|
|||||||
const selectedLabel = selectedScheme === "default"
|
const selectedLabel = selectedScheme === "default"
|
||||||
? "Default"
|
? "Default"
|
||||||
: selectedScheme;
|
: selectedScheme;
|
||||||
const trigger = picker.querySelector("#color-scheme-trigger");
|
const trigger = picker.querySelector(".color-scheme-trigger");
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
const currentLabel = getMessage("currentColorScheme", "Current color scheme");
|
const currentLabel = getMessage("currentColorScheme", "Current color scheme");
|
||||||
const description = `${currentLabel}: ${selectedLabel}`;
|
const description = `${currentLabel}: ${selectedLabel}`;
|
||||||
@@ -94,9 +91,13 @@ export function syncColorSchemePicker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function syncColorSchemePicker() {
|
||||||
|
document.querySelectorAll(".color-scheme-picker").forEach(syncPicker);
|
||||||
|
}
|
||||||
|
|
||||||
function setColorSchemeMenuOpen(picker, open) {
|
function setColorSchemeMenuOpen(picker, open) {
|
||||||
const trigger = picker.querySelector("#color-scheme-trigger");
|
const trigger = picker.querySelector(".color-scheme-trigger");
|
||||||
const menu = picker.querySelector("#color-scheme-menu");
|
const menu = picker.querySelector(".color-scheme-menu");
|
||||||
if (!trigger || !menu) return;
|
if (!trigger || !menu) return;
|
||||||
|
|
||||||
trigger.setAttribute("aria-expanded", String(open));
|
trigger.setAttribute("aria-expanded", String(open));
|
||||||
@@ -115,14 +116,15 @@ function focusColorSchemeOption(picker, direction) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function registerColorSchemePicker() {
|
export function registerColorSchemePicker() {
|
||||||
const picker = document.getElementById("color-scheme-picker");
|
if (typeof window.TerminalTheme?.applyColorScheme !== "function") return;
|
||||||
const trigger = picker?.querySelector("#color-scheme-trigger");
|
|
||||||
const menu = picker?.querySelector("#color-scheme-menu");
|
document.querySelectorAll(".color-scheme-picker").forEach(picker => {
|
||||||
if (!picker || !trigger || !menu
|
const trigger = picker.querySelector(".color-scheme-trigger");
|
||||||
|| typeof window.TerminalTheme?.applyColorScheme !== "function") return;
|
const menu = picker.querySelector(".color-scheme-menu");
|
||||||
|
if (!trigger || !menu) return;
|
||||||
|
|
||||||
populateColorSchemeMenu(menu);
|
populateColorSchemeMenu(menu);
|
||||||
syncColorSchemePicker();
|
syncPicker(picker);
|
||||||
|
|
||||||
trigger.addEventListener("click", function () {
|
trigger.addEventListener("click", function () {
|
||||||
const open = trigger.getAttribute("aria-expanded") !== "true";
|
const open = trigger.getAttribute("aria-expanded") !== "true";
|
||||||
@@ -182,4 +184,5 @@ export function registerColorSchemePicker() {
|
|||||||
setColorSchemeMenuOpen(picker, false);
|
setColorSchemeMenuOpen(picker, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,20 +31,19 @@ function syncAppearanceToggle(toggle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerSearchButton() {
|
function registerSearchButton() {
|
||||||
const searchButton = document.querySelector('[data-header-action="open-search"]');
|
document.querySelectorAll('[data-header-action="open-search"]').forEach(searchButton => {
|
||||||
if (!searchButton) return;
|
|
||||||
|
|
||||||
searchButton.addEventListener("click", function () {
|
searchButton.addEventListener("click", function () {
|
||||||
if (typeof window.SearchWidget?.open === "function") {
|
if (typeof window.SearchWidget?.open === "function") {
|
||||||
window.SearchWidget.open();
|
window.SearchWidget.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerAppearanceToggle() {
|
function registerAppearanceToggle() {
|
||||||
const toggle = document.getElementById("appearance-toggle");
|
if (typeof window.applyTheme !== "function") return;
|
||||||
if (!toggle || typeof window.applyTheme !== "function") return;
|
|
||||||
|
|
||||||
|
document.querySelectorAll(".appearance-toggle").forEach(toggle => {
|
||||||
syncAppearanceToggle(toggle);
|
syncAppearanceToggle(toggle);
|
||||||
|
|
||||||
toggle.addEventListener("click", function () {
|
toggle.addEventListener("click", function () {
|
||||||
@@ -55,15 +54,14 @@ function registerAppearanceToggle() {
|
|||||||
|
|
||||||
window.applyTheme(nextMode, {clearColorScheme: true});
|
window.applyTheme(nextMode, {clearColorScheme: true});
|
||||||
setStoredPreference(PREFERENCE_KEYS.themeMode, nextMode);
|
setStoredPreference(PREFERENCE_KEYS.themeMode, nextMode);
|
||||||
syncAppearanceToggle(toggle);
|
document.querySelectorAll(".appearance-toggle").forEach(syncAppearanceToggle);
|
||||||
syncColorSchemePicker();
|
syncColorSchemePicker();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerPixelToggle() {
|
function registerPixelToggle() {
|
||||||
const pixelToggle = document.getElementById("pixel-toggle");
|
document.querySelectorAll(".pixel-toggle").forEach(pixelToggle => {
|
||||||
if (!pixelToggle) return;
|
|
||||||
|
|
||||||
pixelToggle.addEventListener("click", function () {
|
pixelToggle.addEventListener("click", function () {
|
||||||
const storedStatus = getStoredPreference(PREFERENCE_KEYS.pixelStyle);
|
const storedStatus = getStoredPreference(PREFERENCE_KEYS.pixelStyle);
|
||||||
const currentStatus = storedStatus
|
const currentStatus = storedStatus
|
||||||
@@ -74,10 +72,40 @@ function registerPixelToggle() {
|
|||||||
setStoredPreference(PREFERENCE_KEYS.pixelStyle, newStatus);
|
setStoredPreference(PREFERENCE_KEYS.pixelStyle, newStatus);
|
||||||
window.TerminalTheme?.syncPixelFont?.();
|
window.TerminalTheme?.syncPixelFont?.();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerCustomButtons() {
|
||||||
|
document.querySelectorAll('[data-header-action="custom"]').forEach(button => {
|
||||||
|
const source = button.dataset.onclick?.trim();
|
||||||
|
if (!source || button.dataset.customActionReady === "true") return;
|
||||||
|
|
||||||
|
let handler;
|
||||||
|
try {
|
||||||
|
handler = new Function("event", source);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Invalid custom header button onclick:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.dataset.customActionReady = "true";
|
||||||
|
button.addEventListener("click", function (event) {
|
||||||
|
try {
|
||||||
|
const result = handler.call(this, event);
|
||||||
|
if (result === false) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Custom header button onclick failed:", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerHeaderActions() {
|
export function registerHeaderActions() {
|
||||||
registerSearchButton();
|
registerSearchButton();
|
||||||
registerAppearanceToggle();
|
registerAppearanceToggle();
|
||||||
registerPixelToggle();
|
registerPixelToggle();
|
||||||
|
registerCustomButtons();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,10 +71,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#color-scheme-trigger,
|
.color-scheme-trigger,
|
||||||
#appearance-toggle,
|
.header-action-button {
|
||||||
#search-button,
|
|
||||||
#pixel-toggle {
|
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--color-theme-control);
|
color: var(--color-theme-control);
|
||||||
border: var(--width-theme-border) var(--style-theme-border) var(--color-theme-control);
|
border: var(--width-theme-border) var(--style-theme-border) var(--color-theme-control);
|
||||||
@@ -82,9 +80,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#appearance-toggle,
|
.header-action-button {
|
||||||
#search-button,
|
|
||||||
#pixel-toggle {
|
|
||||||
margin-left: calc(var(--size-theme-font) * 0.5);
|
margin-left: calc(var(--size-theme-font) * 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,15 +25,16 @@ html[data-pixel-style='true'] .icon-pixel {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
#appearance-toggle .appearance-icon {
|
.appearance-toggle .appearance-icon.icon-regular,
|
||||||
|
.appearance-toggle .appearance-icon.icon-pixel {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-pixel-style='false'][data-theme-mode='light'] #appearance-toggle .icon-regular[data-appearance-mode='light'],
|
html[data-pixel-style='false'][data-theme-mode='light'] .appearance-toggle .icon-regular[data-appearance-mode='light'],
|
||||||
html[data-pixel-style='false'][data-theme-mode='dark'] #appearance-toggle .icon-regular[data-appearance-mode='dark'],
|
html[data-pixel-style='false'][data-theme-mode='dark'] .appearance-toggle .icon-regular[data-appearance-mode='dark'],
|
||||||
html[data-pixel-style='false'][data-theme-mode='system'] #appearance-toggle .icon-regular[data-appearance-mode='system'],
|
html[data-pixel-style='false'][data-theme-mode='system'] .appearance-toggle .icon-regular[data-appearance-mode='system'],
|
||||||
html[data-pixel-style='true'][data-theme-mode='light'] #appearance-toggle .icon-pixel[data-appearance-mode='light'],
|
html[data-pixel-style='true'][data-theme-mode='light'] .appearance-toggle .icon-pixel[data-appearance-mode='light'],
|
||||||
html[data-pixel-style='true'][data-theme-mode='dark'] #appearance-toggle .icon-pixel[data-appearance-mode='dark'],
|
html[data-pixel-style='true'][data-theme-mode='dark'] .appearance-toggle .icon-pixel[data-appearance-mode='dark'],
|
||||||
html[data-pixel-style='true'][data-theme-mode='system'] #appearance-toggle .icon-pixel[data-appearance-mode='system'] {
|
html[data-pixel-style='true'][data-theme-mode='system'] .appearance-toggle .icon-pixel[data-appearance-mode='system'] {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,17 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
id="search-button"
|
th:each="button, buttonStat : ${theme.config.header.buttons}"
|
||||||
th:with="regularIcon=${theme.config.header.search_icon != null ? theme.config.header.search_icon.value : null},
|
th:id="|search-button-${buttonStat.index}|"
|
||||||
pixelIcon=${theme.config.header.search_pixel_icon != null ? theme.config.header.search_pixel_icon.value : null}"
|
class="header-action-button search-button"
|
||||||
|
th:with="buttonOptions=${button.options},
|
||||||
|
regularIcon=${buttonOptions?.iconify?.value},
|
||||||
|
pixelIcon=${buttonOptions?.pixel_iconify?.value}"
|
||||||
th:attr="aria-label=#{header.search.open}"
|
th:attr="aria-label=#{header.search.open}"
|
||||||
|
th:style="|order: ${buttonStat.index}|"
|
||||||
type="button"
|
type="button"
|
||||||
data-header-action="open-search"
|
data-header-action="open-search"
|
||||||
th:if="${theme.config.header.search_button_enable != false and pluginFinder.available('PluginSearchWidget')}">
|
th:if="${button.value == 'search' and pluginFinder.available('PluginSearchWidget')}">
|
||||||
<span class="icon-regular button-icon" aria-hidden="true">
|
<span class="icon-regular button-icon" aria-hidden="true">
|
||||||
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
||||||
th:utext="${not #strings.isEmpty(regularIcon) ? regularIcon : pixelIcon}"></th:block>
|
th:utext="${not #strings.isEmpty(regularIcon) ? regularIcon : pixelIcon}"></th:block>
|
||||||
@@ -38,19 +42,21 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
id="color-scheme-picker"
|
th:each="button, buttonStat : ${theme.config.header.buttons}"
|
||||||
|
th:id="|color-scheme-picker-${buttonStat.index}|"
|
||||||
class="color-scheme-picker"
|
class="color-scheme-picker"
|
||||||
th:if="${theme.config.header.color_scheme_switcher_enable == true}">
|
th:with="buttonOptions=${button.options},
|
||||||
|
regularIcon=${buttonOptions?.iconify?.value},
|
||||||
|
pixelIcon=${buttonOptions?.pixel_iconify?.value}"
|
||||||
|
th:style="|order: ${buttonStat.index}|"
|
||||||
|
th:if="${button.value == 'color_scheme'}">
|
||||||
<button
|
<button
|
||||||
id="color-scheme-trigger"
|
|
||||||
class="color-scheme-trigger"
|
class="color-scheme-trigger"
|
||||||
th:with="regularIcon=${theme.config.header.color_scheme_icon != null ? theme.config.header.color_scheme_icon.value : null},
|
|
||||||
pixelIcon=${theme.config.header.color_scheme_pixel_icon != null ? theme.config.header.color_scheme_pixel_icon.value : null}"
|
|
||||||
type="button"
|
type="button"
|
||||||
th:attr="aria-label=#{header.color_scheme.open}"
|
th:attr="aria-label=#{header.color_scheme.open},
|
||||||
|
aria-controls=|color-scheme-menu-${buttonStat.index}|"
|
||||||
aria-haspopup="listbox"
|
aria-haspopup="listbox"
|
||||||
aria-expanded="false"
|
aria-expanded="false">
|
||||||
aria-controls="color-scheme-menu">
|
|
||||||
<span class="icon-regular button-icon" aria-hidden="true">
|
<span class="icon-regular button-icon" aria-hidden="true">
|
||||||
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
||||||
th:utext="${not #strings.isEmpty(regularIcon) ? regularIcon : pixelIcon}"></th:block>
|
th:utext="${not #strings.isEmpty(regularIcon) ? regularIcon : pixelIcon}"></th:block>
|
||||||
@@ -69,7 +75,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
id="color-scheme-menu"
|
th:id="|color-scheme-menu-${buttonStat.index}|"
|
||||||
class="color-scheme-menu"
|
class="color-scheme-menu"
|
||||||
role="listbox"
|
role="listbox"
|
||||||
th:attr="aria-label=#{header.color_scheme.list}"
|
th:attr="aria-label=#{header.color_scheme.list}"
|
||||||
@@ -85,15 +91,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
id="appearance-toggle"
|
th:each="button, buttonStat : ${theme.config.header.buttons}"
|
||||||
th:with="lightRegularIcon=${theme.config.header.appearance_light_icon != null ? theme.config.header.appearance_light_icon.value : null},
|
th:id="|appearance-toggle-${buttonStat.index}|"
|
||||||
lightPixelIcon=${theme.config.header.appearance_light_pixel_icon != null ? theme.config.header.appearance_light_pixel_icon.value : null},
|
class="header-action-button appearance-toggle"
|
||||||
darkRegularIcon=${theme.config.header.appearance_dark_icon != null ? theme.config.header.appearance_dark_icon.value : null},
|
th:with="buttonOptions=${button.options},
|
||||||
darkPixelIcon=${theme.config.header.appearance_dark_pixel_icon != null ? theme.config.header.appearance_dark_pixel_icon.value : null},
|
lightRegularIcon=${buttonOptions?.light_iconify?.value},
|
||||||
systemRegularIcon=${theme.config.header.appearance_system_icon != null ? theme.config.header.appearance_system_icon.value : null},
|
lightPixelIcon=${buttonOptions?.light_pixel_iconify?.value},
|
||||||
systemPixelIcon=${theme.config.header.appearance_system_pixel_icon != null ? theme.config.header.appearance_system_pixel_icon.value : null}"
|
darkRegularIcon=${buttonOptions?.dark_iconify?.value},
|
||||||
|
darkPixelIcon=${buttonOptions?.dark_pixel_iconify?.value},
|
||||||
|
systemRegularIcon=${buttonOptions?.system_iconify?.value},
|
||||||
|
systemPixelIcon=${buttonOptions?.system_pixel_iconify?.value}"
|
||||||
th:attr="aria-label=#{header.appearance.current}"
|
th:attr="aria-label=#{header.appearance.current}"
|
||||||
th:if="${theme.config.header.appearance_switcher_enable != false}"
|
th:style="|order: ${buttonStat.index}|"
|
||||||
|
th:if="${button.value == 'appearance'}"
|
||||||
type="button">
|
type="button">
|
||||||
<span class="appearance-icon icon-regular button-icon" data-appearance-mode="light" aria-hidden="true">
|
<span class="appearance-icon icon-regular button-icon" data-appearance-mode="light" aria-hidden="true">
|
||||||
<th:block th:if="${not #strings.isEmpty(lightRegularIcon) or not #strings.isEmpty(lightPixelIcon)}"
|
<th:block th:if="${not #strings.isEmpty(lightRegularIcon) or not #strings.isEmpty(lightPixelIcon)}"
|
||||||
@@ -145,11 +155,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
id="pixel-toggle"
|
th:each="button, buttonStat : ${theme.config.header.buttons}"
|
||||||
th:with="regularIcon=${theme.config.header.pixel_style_icon != null ? theme.config.header.pixel_style_icon.value : null},
|
th:id="|pixel-toggle-${buttonStat.index}|"
|
||||||
pixelIcon=${theme.config.header.pixel_style_pixel_icon != null ? theme.config.header.pixel_style_pixel_icon.value : null}"
|
class="header-action-button pixel-toggle"
|
||||||
|
th:with="buttonOptions=${button.options},
|
||||||
|
regularIcon=${buttonOptions?.iconify?.value},
|
||||||
|
pixelIcon=${buttonOptions?.pixel_iconify?.value}"
|
||||||
th:attr="aria-label=#{header.pixel_style.toggle}"
|
th:attr="aria-label=#{header.pixel_style.toggle}"
|
||||||
th:if="${theme.config.header.pixel_style_switcher_enable != false}"
|
th:style="|order: ${buttonStat.index}|"
|
||||||
|
th:if="${button.value == 'pixel_style'}"
|
||||||
type="button">
|
type="button">
|
||||||
<span class="icon-pixel button-icon" aria-hidden="true">
|
<span class="icon-pixel button-icon" aria-hidden="true">
|
||||||
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
<th:block th:if="${not #strings.isEmpty(regularIcon) or not #strings.isEmpty(pixelIcon)}"
|
||||||
@@ -168,6 +182,29 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
<th:block th:each="button, buttonStat : ${theme.config.header.buttons}">
|
||||||
|
<button
|
||||||
|
class="header-action-button custom-header-button"
|
||||||
|
type="button"
|
||||||
|
data-header-action="custom"
|
||||||
|
th:with="buttonOptions=${button.options},
|
||||||
|
regularIcon=${buttonOptions?.iconify?.value},
|
||||||
|
pixelIcon=${buttonOptions?.pixel_iconify?.value}"
|
||||||
|
th:if="${button.value == 'custom'
|
||||||
|
and button.options != null
|
||||||
|
and not #strings.isEmpty(button.options.name)
|
||||||
|
and (not #strings.isEmpty(button.options.iconify?.value)
|
||||||
|
or not #strings.isEmpty(button.options.pixel_iconify?.value))}"
|
||||||
|
th:style="|order: ${buttonStat.index}|"
|
||||||
|
th:attr="aria-label=${buttonOptions.name},
|
||||||
|
title=${buttonOptions.name},
|
||||||
|
data-onclick=${buttonOptions.onclick}">
|
||||||
|
<span class="icon-regular button-icon" aria-hidden="true"
|
||||||
|
th:utext="${not #strings.isEmpty(regularIcon) ? regularIcon : pixelIcon}"></span>
|
||||||
|
<span class="icon-pixel button-icon" aria-hidden="true"
|
||||||
|
th:utext="${not #strings.isEmpty(pixelIcon) ? pixelIcon : regularIcon}"></span>
|
||||||
|
</button>
|
||||||
|
</th:block>
|
||||||
</div>
|
</div>
|
||||||
<nav class="navigation-menu">
|
<nav class="navigation-menu">
|
||||||
<ul th:if="${menu != null} and ${not #lists.isEmpty(menu.menuItems)}"
|
<ul th:if="${menu != null} and ${not #lists.isEmpty(menu.menuItems)}"
|
||||||
|
|||||||
Reference in New Issue
Block a user