1
0
mirror of https://github.com/lencx/ChatGPT.git synced 2024-10-01 01:06:13 -04:00

chore: script

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

View File

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