OnlyFakes easy prompt copy

Simply click on the images to copy the prompt

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name            OnlyFakes easy prompt copy
// @namespace       Violentmonkey Scripts
// @match           https://uncensoredai.io/*
// @grant           none
// @version         0.1.1
// @author          vipprograms
// @description     Simply click on the images to copy the prompt
// @grant           GM_addStyle
// ==/UserScript==
GM_addStyle(`
:root{
  --offwhite:color: hsl(0, 0%, 98%);
}
p{  white-space: pre;}

.oepc_popup{position:absolute; top:0; left:0; transform:translate(-50%,-50%); padding:10px 20px; background-color:hsla(0,0%,0%,70%);
  color:var(--offwhite); border-radius:5px; z-index:1000; backdrop-filter:blur(20px);
}
`);

const showPopup = (text) => {
  const popup = document.createElement('div');
  popup.innerHTML = `<div class="oepc_popup">${text}</div>`;
  document.body.appendChild(popup);

  // Get the current mouse position
  const mouseX = window.innerWidth / 2;
  const mouseY = window.innerHeight / 2;

  // Set the position of the popup immediately
  const scrollY = window.scrollY;
  popup.firstChild.style.position = 'absolute';
  popup.firstChild.style.left = `${mouseX}px`;
  popup.firstChild.style.top = `${mouseY + scrollY}px`;

  setTimeout(() => {
    const innerDiv = popup.firstChild;
    innerDiv.style.transition = 'opacity 0.5s';
    innerDiv.style.opacity = '0';
    setTimeout(() => {
      popup.remove();
    }, 600);
  }, 1000);
};



const copyPrompt = async (prompt) => {
  await navigator.clipboard.writeText(prompt);
};

const processImages = () => {
  document.querySelectorAll('img[alt^="Image made with A"]:not([data-listener-added])').forEach(img => {
    img.setAttribute('data-listener-added', 'true');
    img.addEventListener('click', () => {
      const prompt = img.alt.split('Prompt: ')[1];
      if (!prompt) return;
      copyPrompt(prompt);

      let text = `Copied!<br><br>Prompt:<br>${prompt}`;

      showPopup(text);

    });
  });
};

document.addEventListener('DOMContentLoaded', processImages);
window.addEventListener('scroll', processImages);