fix: move page ai launcher to pi lab
This commit is contained in:
@@ -4624,15 +4624,29 @@
|
||||
|
||||
function installLauncher() {
|
||||
if (piLabLauncherEl) return;
|
||||
piLabLauncherEl = el('button', {
|
||||
type: 'button',
|
||||
className: 'wolai-page-ai-pi-lab-launcher',
|
||||
'data-page-ai-pi-lab-launcher': 'true',
|
||||
title: 'Pi Lab',
|
||||
'aria-label': '打开 Pi Lab',
|
||||
}, 'π');
|
||||
piLabLauncherEl.addEventListener('click', showPiLab);
|
||||
document.body.appendChild(piLabLauncherEl);
|
||||
var hostButton = document.querySelector('[data-mnote-action="open-page-ai-pi-lab"], [data-testid="wolai-floating-ai"]');
|
||||
if (hostButton instanceof HTMLElement) {
|
||||
piLabLauncherEl = hostButton;
|
||||
piLabLauncherEl.setAttribute('data-page-ai-pi-lab-launcher', 'true');
|
||||
piLabLauncherEl.setAttribute('data-mnote-action', 'open-page-ai-pi-lab');
|
||||
piLabLauncherEl.setAttribute('aria-label', '打开 Pi Lab');
|
||||
piLabLauncherEl.setAttribute('title', '打开 Pi Lab');
|
||||
piLabLauncherEl.textContent = 'π';
|
||||
} else {
|
||||
piLabLauncherEl = el('button', {
|
||||
type: 'button',
|
||||
className: 'wolai-page-ai-pi-lab-launcher',
|
||||
'data-page-ai-pi-lab-launcher': 'true',
|
||||
title: 'Pi Lab',
|
||||
'aria-label': '打开 Pi Lab',
|
||||
}, 'π');
|
||||
document.body.appendChild(piLabLauncherEl);
|
||||
}
|
||||
piLabLauncherEl.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
showPiLab();
|
||||
});
|
||||
}
|
||||
|
||||
function wireEvents() {
|
||||
|
||||
Reference in New Issue
Block a user