Last active
February 20, 2023 19:37
-
-
Save Gavin0x0/9d5c68090428aff15e09f7ed9efa49d7 to your computer and use it in GitHub Desktop.
Adds a button to ChatGPT to take a screenshot of the conversation
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
// ==UserScript== | |
// @name Chat Snapshot | |
// @namespace ChatGPT_Plugin | |
// @version 1 | |
// @author Gavin | |
// @description Adds a button to ChatGPT to take a screenshot of the conversation | |
// @match https://chat.openai.com/* | |
// @grant GM_download | |
// @require https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.0/html2canvas.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Add button to ChatGPT UI | |
var button = document.createElement("button"); | |
button.innerHTML = "📸"; | |
button.className = "btn flex cursor-pointer absolute bottom-[124px] md:bottom-[120px] z-10 ounded-full border border-gray-200 bg-gray-50 text-gray-600 dark:border-white/10 dark:bg-white/10 dark:text-gray-200"; | |
button.style.right = "60px"; | |
button.onclick = function() { | |
takeScreenshot(); | |
}; | |
document.body.appendChild(button); | |
// Define function to take screenshot | |
function takeScreenshot() { | |
html2canvas(document.querySelector(".flex.flex-col.items-center.text-sm")).then(canvas => { | |
var imageData = canvas.toDataURL(); | |
GM_download({ | |
url: imageData, | |
name: "chatGPT_snapshot_"+Date.now() + ".png" | |
}); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment