Skip to content

Commit

Permalink
Added chatgpt.getFooterDiv() + alias
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed May 9, 2024
1 parent 924ce8f commit e1e6fef
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;
}},

getFooterDiv: function() { return document.querySelector('main form').parentNode.parentNode.nextElementSibling; },
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 @@ -1878,6 +1879,7 @@ const functionAliases = [
['detectLanguage', 'getLanguage'],
['executeCode', 'codeExecute'],
['exportChat', 'chatExport', 'export'],
['getFooterDiv', 'getFooter'],
['getHeaderDiv', 'getHeader'],
['getLastPrompt', 'getLastQuery', 'getMyLastMsg', 'getMyLastQuery'],
['getTextarea', 'getTextArea', 'getChatbox', 'getChatBox'],
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)
- [getFooterDiv](#getfooterdiv)
- [getHeaderDiv](#getheaderdiv)
- [getNewChatLink](#getnewchatlink)
- [getRegenerateButton](#getregeneratebutton)
Expand Down Expand Up @@ -1082,6 +1083,17 @@ const continueBtn = chatgpt.getContinueGeneratingButton();
continueBtn.click();
```

### getFooterDiv

Returns the footer div as an HTML element.

Example code:

```js
const footerDiv = chatgpt.getFooterDiv();
footerDiv.style.padding = '15px'; // make the footer taller
```

### getHeaderDiv

Returns the header div as an HTML element.
Expand Down

0 comments on commit e1e6fef

Please sign in to comment.