Skip to content

Instantly share code, notes, and snippets.

@kidGodzilla
Last active May 9, 2023 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidGodzilla/9e633b58ed26a29e4c158557a3d68429 to your computer and use it in GitHub Desktop.
Save kidGodzilla/9e633b58ed26a29e4c158557a3d68429 to your computer and use it in GitHub Desktop.
SiteGPT.AI Unofficial button API
// 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' },
}
@kidGodzilla
Copy link
Author

kidGodzilla commented May 9, 2023

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:

<script src="https://cdn.jsdelivr.net/gh/kidgodzilla/sitegpt-tools@latest/m.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment