Last active
March 17, 2024 16:13
-
-
Save DarrenSem/8a51d21e480cbeb70a9f6a86ddce4236 to your computer and use it in GitHub Desktop.
OpenAIPlaygroundShowPresets.js -- Bookmarklet to fix March 2024 CSS regressive bug (~"GM_addStyle" but without TamperMonkey or GreaseMonkey)
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
// OpenAIPlaygroundShowPresets.js -- Bookmarklet to fix March 2024 CSS regressive bug (~"GM_addStyle" but without TamperMonkey or GreaseMonkey) | |
// by Darren Semotiuk, see: https://community.openai.com/t/playground-recent-ui-changes-broke-mobile-experience/687130 | |
// BOOKMARKLET* for those of us not running TamperMonkey or GreaseMonkey | |
// *Simply add the one-liner below as a Favorite/Bookmark in your browser, no extensions required! | |
javascript:void function(){globalThis.GM_addStyle=globalThis.GM_addStyle||function(a){let b=document,c=b.head||b.body,d=b.createElement("style");d.type="text/css",d.innerText=a,c&&c.appendChild(d)},GM_addStyle("@media(max-width:500px){.pg-header-actions,.pg-header-section-settings,.pg-preset-select-container{display:block !important}}")}(); | |
// raw source of above Bookmarklet: | |
globalThis.GM_addStyle = globalThis.GM_addStyle || ( function(innerText) { | |
let doc = document; | |
let head = doc.head || doc.body; | |
let style=doc.createElement("style"); | |
style.type="text/css"; | |
style.innerText=innerText; | |
if(head) head.appendChild(style); | |
} ); | |
GM_addStyle("@media(max-width:500px){.pg-header-actions,.pg-header-section-settings,.pg-preset-select-container{display:block !important}"); | |
// alert(document.styleSheets.length); // for testing to confirm it ran in OpenAI's JavaScript sandbox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More advanced CSS changes (might not look good in mobile though): "A better API playground look for coders - via Tampermonkey script CSS" -- by Jay F (_j) @ https://community.openai.com/t/a-better-api-playground-look-for-coders-via-tampermonkey-script-css/680264