Last active
August 2, 2023 18:55
-
-
Save zudsniper/14abaa7a89f5636764d9509430c70abc to your computer and use it in GitHub Desktop.
ChatGPT broke link previews as of writing this (2023-08-02) so this userscript removes them as they're added.
This file contains hidden or 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
// ==UserScript== | |
// @name ChatGPT Remove Link Previews | |
// @namespace http://zod.tf/ | |
// @version 1.0.1 | |
// @description Disable link previews on ChatGPT interface | |
// @author zudsniper | |
// @icon https://chat.openai.com/favicon.ico | |
// @match https://chat.openai.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// heres the raw gist link to this file without a commit version | |
// https://gist.github.com/zudsniper/14abaa7a89f5636764d9509430c70abc/raw/chatgpt_remove_link_previews.user.js | |
// Create an observer instance linked to the callback function | |
const observer = new MutationObserver((mutationsList, observer) => { | |
// Look through all mutations that just occured | |
for(let mutation of mutationsList) { | |
// If the addedNodes property has one or more nodes | |
if(mutation.addedNodes.length){ | |
mutation.addedNodes.forEach(node => { | |
if(node.querySelector){ | |
let linkPreviews = node.querySelectorAll('div.relative.h-full.w-full'); | |
linkPreviews.forEach(link => link.style.display = "none"); | |
} | |
}); | |
} | |
} | |
}); | |
// Start observing the document with the configured parameters | |
observer.observe(document, { childList: true, subtree: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment