Skip to content

Commit

Permalink
Added chatgpt.getHeaderDiv() + alias
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed May 9, 2024
1 parent 8551b56 commit f0aa6d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
return svg.parentNode.parentNode;
}},

getHeaderDiv: function() { return document.querySelector('main .sticky'); },
getLastPrompt: function() { return chatgpt.getChatData('active', 'msg', 'user', 'latest'); },
getLastResponse: function() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },

Expand Down Expand Up @@ -1877,6 +1878,7 @@ const functionAliases = [
['detectLanguage', 'getLanguage'],
['executeCode', 'codeExecute'],
['exportChat', 'chatExport', 'export'],
['getHeaderDiv', 'getHeader'],
['getLastPrompt', 'getLastQuery', 'getMyLastMsg', 'getMyLastQuery'],
['getTextarea', 'getTextArea', 'getChatbox', 'getChatBox'],
['isFullScreen', 'isFullscreen'],
Expand Down
12 changes: 12 additions & 0 deletions docs/USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
- [DOM related](#dom-related)
- [getChatBox](#getchatbox)
- [getContinueGeneratingButton](#getcontinuegeneratingbutton)
- [getHeaderDiv](#getheaderdiv)
- [getNewChatLink](#getnewchatlink)
- [getRegenerateButton](#getregeneratebutton)
- [getScrollToBottomButton](#getscrolltobottombutton)
Expand Down Expand Up @@ -1081,6 +1082,17 @@ const continueBtn = chatgpt.getContinueGeneratingButton();
continueBtn.click();
```

### getHeaderDiv

Returns the header div as an HTML element.

Example code:

```js
const headerDiv = chatgpt.getHeaderDiv();
headerDiv.style.display = none; // hide the header
```

### getNewChatLink

Returns the button which creates a new chat as an HTML element.
Expand Down

0 comments on commit f0aa6d5

Please sign in to comment.