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

fix: mac titlebar

This commit is contained in:
lencx 2023-07-01 00:22:58 +08:00
parent 00aa242c2a
commit ce6344b534
2 changed files with 8 additions and 7 deletions

13
scripts/core.js vendored
View File

@ -1,6 +1,6 @@
/**
* @name core.js
* @version 0.1.0
* @version 0.1.1
* @url https://github.com/lencx/ChatGPT/tree/main/scripts/core.js
*/
@ -85,6 +85,7 @@ function coreInit() {
if (window.location.host === 'chat.openai.com') {
const nav = document.body.querySelector('nav');
const top = topDom.clientHeight + 5;
if (nav) {
const currentPaddingTop = parseInt(
window
@ -95,26 +96,26 @@ function coreInit() {
);
const navStyleDom = document.createElement('style');
navStyleDom.innerHTML = `nav{
padding-top:${currentPaddingTop + topDom.clientHeight}px !important
padding-top:${currentPaddingTop + top}px !important
}
button[aria-label="Show sidebar"]{
margin-top:${topDom.clientHeight}px !important
margin-top:${top}px !important
}
`;
document.head.appendChild(navStyleDom);
} else {
const navStyleDom = document.createElement('style');
navStyleDom.innerHTML = `nav{
padding-top:${topDom.clientHeight}px !important
padding-top:${top}px !important
}
button[aria-label="Show sidebar"]{
margin-top:${topDom.clientHeight}px !important
margin-top:${top}px !important
}
`;
document.head.appendChild(navStyleDom);
const main = document.querySelector('main');
if (main && main.parentElement.children.length > 1) {
main.parentElement.children[0].style.paddingTop = topDom.clientHeight + 'px';
main.parentElement.children[0].style.paddingTop = top + 'px';
}
}
}

View File

@ -14,7 +14,7 @@
},
{
"name": "core.js",
"version": "0.1.0"
"version": "0.1.1"
},
{
"name": "dalle2.js",