-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatgpt-image-save.js
More file actions
29 lines (24 loc) · 968 Bytes
/
chatgpt-image-save.js
File metadata and controls
29 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==UserScript==
// @name chatgpt Auto Mirror
// @version 2023-12-17
// @description Auto mirror all dalle images from chatgpt
// @author Goofables
// @match https://chat.openai.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=openai.com
// ==/UserScript==
function getElementsByXPath(xpath, parent) {
let results = [];
let query = document.evaluate(xpath, parent || document,
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (let i = 0, length = query.snapshotLength; i < length; ++i) {
results.push(query.snapshotItem(i));
}
return results;
}
function mirror_all() {
const images = getElementsByXPath("//img[@alt='Generated by DALL·E' and contains(@src, 'files.oaiusercontent.com') and not(contains(@src, 'i.mxsmp.com'))]");
for (const image of images) {
image.src = "https://i.mxsmp.com/a:chatgpt/" + image.src;
}
}
setInterval(mirror_all, 250);