Extend script to change selected to have bacgroud taken from image // ==UserScript== //…
- User
Extend script to change selected to have bacgroud taken from image
// ==UserScript== // @name Replace Image Sources // @namespace http://tampermonkey.net/ // @version 1.0 // @description Replace image sources based on a mapping // @author You // @match :///* // @grant none // ==/UserScript==
(function() { 'use strict';
// Define your mapping here: old src -> new src const srcMap = { "https://example.com/old-image1.jpg": "https://example.com/new-image1.jpg", "https://example.com/old-image2.png": "https://example.com/new-image2.png", // Add more mappings as needed }; // Function to replace image sources function replaceImageSources() { const images = document.querySelectorAll('img'); images.forEach(img => { if (img.src in srcMap) { img.src = srcMap[img.src]; console.log(`Replaced image src: ${img.src}`); } }); } // Run on page load window.addEventListener('load', replaceImageSources); // Optional: Also run after DOM changes (if images load dynamically) const observer = new MutationObserver(replaceImageSources); observer.observe(document.body, { childList: true, subtree: true });
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.