Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name AI Studio Anti-Censorship by SetW (VIBECODED)
- // @namespace http://tampermonkey.net/
- // @version 7.0
- // @description Mobile optimized UI, numbered vault, dynamic buttons.
- // @match https://aistudio.google.com/*
- // @grant none
- // @icon https://ih1.redbubble.net/image.296402979.3147/st,small,507x507-pad,600x600,f8f8f8.u3.jpg
- // ==/UserScript==
- (function() {
- 'use strict';
- let shieldedText = "";
- let tempBuffer = "";
- const STORAGE_KEY = "ai_studio_vault";
- let currentViewId = null;
- // Paleta de colores nueva
- const COLORS = {
- bg0: '#050505', // Fondo ultra oscuro (modal overlay)
- bg1: '#101010', // Fondo principal (modal content)
- bg2: '#1a1a1a', // Fondo secundario (sidebar, cards)
- border: '#2a2a2a', // Bordes sutiles
- accent: '#90D5FF', // Verde Matrix brillante (bordes activos, títulos)
- textMain: '#e0e0e0', // Texto principal
- textMuted: '#888888', // Texto secundario
- btnRescue: '#333333', // Fondo botón flotante (verde muy oscuro)
- btnRescueText: '#90D5FF', // Texto botón flotante
- btnCopy: '#4CAF50', // Verde estándar para copiar
- btnSave: '#008CBA', // Azul estándar para guardar (lo mantenemos para diferenciar)
- btnDel: '#d9534f', // Rojo estándar para borrar (lo mantenemos por seguridad visual)
- btnDef: '#333333' // Botón gris por defecto (Close, Vault inactivo)
- };
- const getSavedTexts = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]");
- const saveTextToVault = (text) => {
- const saved = getSavedTexts();
- saved.push({ id: Date.now(), text: text });
- localStorage.setItem(STORAGE_KEY, JSON.stringify(saved));
- renderSidebar();
- };
- const deleteTextFromVault = (id) => {
- let saved = getSavedTexts();
- saved = saved.filter(item => item.id !== id);
- localStorage.setItem(STORAGE_KEY, JSON.stringify(saved));
- renderSidebar();
- };
- // --- BOTÓN ARRASTRABLE ---
- const rescueBtn = document.createElement('button');
- rescueBtn.innerText = "🚨 Rescue Text";
- // Aplicando nuevos colores
- rescueBtn.style.cssText = `position:fixed;bottom:20px;right:20px;z-index:99999;background:${COLORS.btnRescue};color:${COLORS.btnRescueText};border:1px solid ${COLORS.accent};border-radius:8px;padding:12px 20px;font-family:monospace;font-size:14px;font-weight:bold;cursor:pointer;box-shadow:0 0 10px rgba(0,255,65,0.3);transition:transform 0.2s, box-shadow 0.2s;touch-action:none;`;
- document.body.appendChild(rescueBtn);
- let isDragging = false, dragStartX, dragStartY, moved = false;
- const dragStart = (e) => {
- moved = false;
- const clientX = e.type.includes('mouse') ? e.clientX : e.touches[0].clientX;
- const clientY = e.type.includes('mouse') ? e.clientY : e.touches[0].clientY;
- dragStartX = clientX - rescueBtn.getBoundingClientRect().left;
- dragStartY = clientY - rescueBtn.getBoundingClientRect().top;
- rescueBtn.style.bottom = 'auto';
- rescueBtn.style.right = 'auto';
- rescueBtn.style.transition = 'none';
- if (e.type.includes('mouse')) {
- document.addEventListener('mousemove', drag);
- document.addEventListener('mouseup', dragEnd);
- } else {
- document.addEventListener('touchmove', drag, { passive: false });
- document.addEventListener('touchend', dragEnd);
- }
- };
- const drag = (e) => {
- moved = true; isDragging = true;
- e.preventDefault();
- const clientX = e.type.includes('mouse') ? e.clientX : e.touches[0].clientX;
- const clientY = e.type.includes('mouse') ? e.clientY : e.touches[0].clientY;
- rescueBtn.style.left = (clientX - dragStartX) + 'px';
- rescueBtn.style.top = (clientY - dragStartY) + 'px';
- rescueBtn.style.boxShadow = `0 0 20px ${COLORS.accent}`; // Brillo extra al mover
- };
- const dragEnd = (e) => {
- rescueBtn.style.transition = 'transform 0.2s, box-shadow 0.2s';
- rescueBtn.style.boxShadow = `0 0 10px rgba(0,255,65,0.3)`;
- setTimeout(() => { isDragging = false; }, 50);
- if (e.type.includes('mouse')) {
- document.removeEventListener('mousemove', drag);
- document.removeEventListener('mouseup', dragEnd);
- } else {
- document.removeEventListener('touchmove', drag);
- document.removeEventListener('touchend', dragEnd);
- }
- };
- rescueBtn.addEventListener('mousedown', dragStart);
- rescueBtn.addEventListener('touchstart', dragStart, { passive: false });
- rescueBtn.addEventListener('mouseover', () => { if(!isDragging) rescueBtn.style.transform = "scale(1.05)"; });
- rescueBtn.addEventListener('mouseout', () => rescueBtn.style.transform = "scale(1)");
- // --- MODAL Y UI (Colores actualizados) ---
- const modal = document.createElement('div');
- // Fondo overlay negro casi puro
- modal.style.cssText = `display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background:${COLORS.bg0}da;z-index:100000;justify-content:center;align-items:center;`;
- const modalContent = document.createElement('div');
- // Fondo principal negro, borde verde Matrix
- modalContent.style.cssText = `background:${COLORS.bg1};width:95%;max-width:1100px;height:85vh;border-radius:12px;border:2px solid ${COLORS.accent};display:flex;flex-direction:row;box-shadow:0 0 30px rgba(0,255,65,0.2);overflow:hidden;`;
- const mainPanel = document.createElement('div');
- mainPanel.style.cssText = `flex:1;min-width:0;padding:15px;display:flex;flex-direction:column;border-right:1px solid ${COLORS.border};`;
- const title = document.createElement('h3');
- title.innerText = "Recovered Text";
- // Título en verde Matrix
- title.style.cssText = `color:${COLORS.accent};margin-top:0;margin-bottom:10px;font-family:monospace;font-size:16px;text-transform:uppercase;letter-spacing:1px;`;
- const textArea = document.createElement('textarea');
- // Fondo negro puro para el texto, texto gris claro
- textArea.style.cssText = `flex-grow:1;background:#000000;color:${COLORS.textMain};border:1px solid ${COLORS.border};border-radius:6px;padding:15px;font-family:monospace;font-size:14px;resize:none;outline:none;margin-bottom:15px;width:100%;box-sizing:border-box;line-height:1.5;`;
- textArea.readOnly = true;
- const buttonRow = document.createElement('div');
- buttonRow.style.cssText = `display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;`;
- const copyBtn = document.createElement('button');
- copyBtn.innerText = "📋 Copy";
- copyBtn.style.cssText = `background:${COLORS.btnCopy};color:#fff;border:none;border-radius:6px;padding:10px;cursor:pointer;font-weight:bold;transition:0.2s;flex-grow:1;max-width:100px;font-family:sans-serif;`;
- copyBtn.addEventListener('click', () => {
- navigator.clipboard.writeText(textArea.value);
- copyBtn.innerText = "✅ Copied!";
- copyBtn.style.background = "#3d8b40";
- setTimeout(() => { copyBtn.innerText = "📋 Copy"; copyBtn.style.background = COLORS.btnCopy; }, 2000);
- });
- const saveBtn = document.createElement('button');
- saveBtn.innerText = "💾 Save";
- saveBtn.style.cssText = `background:${COLORS.btnSave};color:#fff;border:none;border-radius:6px;padding:10px;cursor:pointer;font-weight:bold;transition:0.2s;flex-grow:1;max-width:100px;font-family:sans-serif;`;
- saveBtn.addEventListener('click', () => {
- if(textArea.value && !textArea.value.includes("Vault is empty")) {
- saveTextToVault(textArea.value);
- saveBtn.innerText = "✅ Saved!";
- saveBtn.style.background = "#006f94";
- setTimeout(() => { saveBtn.innerText = "💾 Save"; saveBtn.style.background = COLORS.btnSave; }, 2000);
- }
- });
- const deleteBtn = document.createElement('button');
- deleteBtn.innerText = "🗑️ Delete";
- deleteBtn.style.cssText = `background:${COLORS.btnDel};color:#fff;border:none;border-radius:6px;padding:10px;cursor:pointer;font-weight:bold;transition:0.2s;flex-grow:1;max-width:100px;display:none;font-family:sans-serif;`;
- deleteBtn.addEventListener('click', () => {
- if (currentViewId) {
- deleteTextFromVault(currentViewId);
- currentViewId = null;
- textArea.value = shieldedText || "Vault is empty. The filter attacked before anything was generated.";
- title.innerText = "Recovered Text";
- updateActionButtons();
- }
- });
- const closeBtn = document.createElement('button');
- closeBtn.innerText = "Close";
- closeBtn.style.cssText = `background:${COLORS.btnDef};color:${COLORS.textMain};border:none;border-radius:6px;padding:10px;cursor:pointer;font-weight:bold;flex-grow:1;max-width:100px;font-family:sans-serif;`;
- closeBtn.addEventListener('click', () => modal.style.display = "none");
- const updateActionButtons = () => {
- if (currentViewId) {
- saveBtn.style.display = "none";
- deleteBtn.style.display = "block";
- } else {
- saveBtn.style.display = "block";
- deleteBtn.style.display = "none";
- }
- };
- buttonRow.appendChild(copyBtn);
- buttonRow.appendChild(saveBtn);
- buttonRow.appendChild(deleteBtn);
- buttonRow.appendChild(closeBtn);
- mainPanel.appendChild(title);
- mainPanel.appendChild(textArea);
- mainPanel.appendChild(buttonRow);
- const sidebar = document.createElement('div');
- // Fondo negro ligeramente más claro que el principal
- sidebar.style.cssText = `width:60px;padding:15px 5px;display:flex;flex-direction:column;background:${COLORS.bg2};overflow-y:auto;align-items:center;flex-shrink:0;`;
- const savedList = document.createElement('div');
- savedList.style.cssText = `display:flex;flex-direction:column;gap:15px;width:100%;align-items:center;`;
- sidebar.appendChild(savedList);
- const renderSidebar = () => {
- savedList.replaceChildren();
- const items = getSavedTexts();
- const btnMain = document.createElement('button');
- btnMain.innerText = "🚨";
- btnMain.title = "Current Rescue";
- // Si está seleccionado, brilla en verde. Si no, borde gris oscuro.
- btnMain.style.cssText = `width:40px;height:40px;border-radius:50%;background:${COLORS.bg1};color:#fff;border:1px solid ${currentViewId === null ? COLORS.accent : COLORS.border};box-shadow: ${currentViewId === null ? `0 0 10px ${COLORS.accent}` : 'none'};font-weight:bold;cursor:pointer;transition:0.2s;display:flex;justify-content:center;align-items:center;`;
- btnMain.addEventListener('click', () => {
- currentViewId = null;
- textArea.value = shieldedText || "Vault is empty. The filter attacked before anything was generated.";
- title.innerText = "Recovered Text";
- updateActionButtons();
- renderSidebar();
- });
- savedList.appendChild(btnMain);
- const divider = document.createElement('div');
- divider.style.cssText = `width:30px;height:1px;background:${COLORS.border};margin:5px 0;`;
- savedList.appendChild(divider);
- items.forEach((item, index) => {
- const btn = document.createElement('button');
- const isSelected = currentViewId === item.id;
- btn.innerText = index + 1;
- // Números en grismuted, seleccionados brillan en verde.
- btn.style.cssText = `width:40px;height:40px;border-radius:50%;background:${COLORS.bg1};color:${isSelected ? COLORS.accent : COLORS.textMuted};border:1px solid ${isSelected ? COLORS.accent : COLORS.border}; box-shadow: ${isSelected ? `0 0 10px ${COLORS.accent}` : 'none'}; font-weight:bold;cursor:pointer;transition:0.2s;display:flex;justify-content:center;align-items:center;font-size:16px;font-family:monospace;`;
- btn.addEventListener('click', () => {
- currentViewId = item.id;
- textArea.value = item.text;
- title.innerText = `Vault Text #${index + 1}`;
- updateActionButtons();
- renderSidebar();
- });
- savedList.appendChild(btn);
- });
- };
- modalContent.appendChild(mainPanel);
- modalContent.appendChild(sidebar);
- modal.appendChild(modalContent);
- document.body.appendChild(modal);
- rescueBtn.addEventListener('click', (e) => {
- if (moved || isDragging) { e.preventDefault(); return; }
- currentViewId = null;
- title.innerText = "Recovered Text";
- if (shieldedText.trim() === "") {
- textArea.value = "Vault is empty. The filter attacked before anything was generated.";
- } else {
- textArea.value = shieldedText;
- }
- updateActionButtons();
- renderSidebar();
- modal.style.display = "flex";
- });
- const observer = new MutationObserver(() => {
- const containers = document.querySelectorAll('.model-prompt-container');
- if (containers.length === 0) return;
- const lastContainer = containers[containers.length - 1];
- const currentText = lastContainer.innerText || lastContainer.textContent || "";
- if (currentText.includes("Content blocked") || currentText.includes("warning")) return;
- if (currentText.length > tempBuffer.length) {
- tempBuffer = currentText;
- shieldedText = currentText;
- } else if (currentText.length < tempBuffer.length) {
- tempBuffer = currentText;
- }
- });
- observer.observe(document.body, { childList: true, subtree: true, characterData: CHARACTER_DATA });
- })();
Advertisement
Add Comment
Please, Sign In to add comment