小红点
This commit is contained in:
@@ -51,6 +51,11 @@ function forceMobileBarVisible(container) {
|
||||
container.style.setProperty('pointer-events', 'auto', 'important');
|
||||
}
|
||||
|
||||
function shouldUseMobileBar() {
|
||||
if (typeof window === 'undefined') return false;
|
||||
return window.matchMedia('(max-width: 767.98px)').matches;
|
||||
}
|
||||
|
||||
function applyWorkflowButtonPaint(button) {
|
||||
for (const [cls, bg, fg] of WORKFLOW_BUTTON_STYLES) {
|
||||
if (button.classList.contains(cls)) {
|
||||
@@ -104,10 +109,18 @@ patch(StatusBarButtons, {
|
||||
try {
|
||||
const mobileContainers = document.querySelectorAll('.o_statusbar_buttons_mobile_fixed');
|
||||
if (mobileContainers.length === 0) return;
|
||||
const useMobileBar = shouldUseMobileBar();
|
||||
|
||||
mobileContainers.forEach(container => {
|
||||
try {
|
||||
forceMobileBarVisible(container);
|
||||
if (useMobileBar) {
|
||||
forceMobileBarVisible(container);
|
||||
} else {
|
||||
container.style.setProperty('display', 'none', 'important');
|
||||
container.style.setProperty('visibility', 'hidden', 'important');
|
||||
container.style.setProperty('opacity', '0', 'important');
|
||||
return;
|
||||
}
|
||||
|
||||
// 同时修复容器内的按钮
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
@@ -178,7 +191,11 @@ patch(StatusBarButtons, {
|
||||
try {
|
||||
const desktopButtons = document.querySelectorAll('.o_form_statusbar > .o_statusbar_buttons:not(.o_statusbar_buttons_mobile_fixed .o_statusbar_buttons)');
|
||||
desktopButtons.forEach(btn => {
|
||||
btn.style.setProperty('display', 'none', 'important');
|
||||
if (useMobileBar) {
|
||||
btn.style.setProperty('display', 'none', 'important');
|
||||
} else {
|
||||
btn.style.removeProperty('display');
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('Error hiding desktop buttons in setup:', e);
|
||||
@@ -232,8 +249,14 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
|
||||
containers.forEach(container => {
|
||||
try {
|
||||
// 无条件强制底栏可见,避免主题在特定机型上把栏绘制成透明
|
||||
forceMobileBarVisible(container);
|
||||
if (shouldUseMobileBar()) {
|
||||
forceMobileBarVisible(container);
|
||||
} else {
|
||||
container.style.setProperty('display', 'none', 'important');
|
||||
container.style.setProperty('visibility', 'hidden', 'important');
|
||||
container.style.setProperty('opacity', '0', 'important');
|
||||
return;
|
||||
}
|
||||
|
||||
// 修复按钮的交互性和可见性
|
||||
const buttons = container.querySelectorAll('button, a.btn, .btn, a[role="button"], .o_statusbar_buttons > * > button, .o_statusbar_buttons > * > a');
|
||||
@@ -306,7 +329,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
});
|
||||
|
||||
// 在移动设备上,确保原始状态栏中的按钮被隐藏
|
||||
if (isMobileDevice()) {
|
||||
if (shouldUseMobileBar()) {
|
||||
try {
|
||||
const desktopButtons = document.querySelectorAll('.o_form_statusbar > .o_statusbar_buttons:not(.o_statusbar_buttons_mobile_fixed .o_statusbar_buttons)');
|
||||
desktopButtons.forEach(btn => {
|
||||
@@ -386,7 +409,7 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
||||
}, { passive: true });
|
||||
|
||||
// 定期检查按钮是否可见(防止被其他样式覆盖)
|
||||
if (isMobileDevice()) {
|
||||
if (shouldUseMobileBar()) {
|
||||
// 延迟启动定时器,避免影响页面加载
|
||||
setTimeout(() => {
|
||||
checkInterval = setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user