chore: script

This commit is contained in:
lencx
2023-01-25 00:38:36 +08:00
parent 11e20e7f8c
commit 9a5c008a25

View File

@@ -64,6 +64,7 @@ async function init() {
topDom.id = "chatgpt-app-window-top"; topDom.id = "chatgpt-app-window-top";
document.body.appendChild(topDom); document.body.appendChild(topDom);
if (window.location.host === 'chat.openai.com') {
const nav = document.body.querySelector('nav'); const nav = document.body.querySelector('nav');
if (nav) { if (nav) {
const currentPaddingTop = parseInt(window.getComputedStyle(document.querySelector('nav'), null).getPropertyValue('padding-top').replace('px', ''), 10); const currentPaddingTop = parseInt(window.getComputedStyle(document.querySelector('nav'), null).getPropertyValue('padding-top').replace('px', ''), 10);
@@ -71,6 +72,7 @@ async function init() {
navStyleDom.innerHTML = `nav{padding-top:${currentPaddingTop + topDom.clientHeight}px !important}`; navStyleDom.innerHTML = `nav{padding-top:${currentPaddingTop + topDom.clientHeight}px !important}`;
document.head.appendChild(navStyleDom); document.head.appendChild(navStyleDom);
} }
}
topDom.addEventListener("mousedown", () => invoke("drag_window")); topDom.addEventListener("mousedown", () => invoke("drag_window"));
topDom.addEventListener("touchstart", () => invoke("drag_window")); topDom.addEventListener("touchstart", () => invoke("drag_window"));