Last active
May 9, 2023 23:01
-
-
Save kidGodzilla/9e633b58ed26a29e4c158557a3d68429 to your computer and use it in GitHub Desktop.
SiteGPT.AI Unofficial button API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script to control SiteGPT.AI chat Interface elements | |
// Usage: | |
// _sitegpt.open() | |
// _sitegpt.hide() | |
// _sitegpt.show() | |
// etc. | |
window._sitegpt = { | |
is_open: function() { return !document.querySelector('#sitegpt-chat-icon img').src.includes('logo') }, | |
open: function() { if (!_sitegpt.is_open()) { _sitegpt.toggle() } }, | |
close: function() { if (_sitegpt.is_open()) { _sitegpt.toggle() } }, | |
toggle: function() { document.querySelector('#sitegpt-chat-icon').click() }, | |
show: function() { document.querySelector('#sitegpt-chat-icon').style.display = 'flex' }, | |
hide: function() { document.querySelector('#sitegpt-chat-icon').style.display = 'none' }, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an unofficial API to control the SiteGPT.ai interface elements that others might find useful. You can open, close, show, hide, or toggle the UI using this tiny script.
This is being moved to a new repository: https://github.com/kidGodzilla/sitegpt-tools
You can include the following on your website to import this gist: