gpt-4.1-mini-2025-04-14· OpenAI
LMArena Human Preference 140K
A page I'm browsing has a bunch of images like this: <a…
- User
A page I'm browsing has a bunch of images like this:
<a href="loading06.jpg">loading06.jpg</a>Please write me a Bookmarklet script that replaces all of those in the page with an image tag that displays them. - Assistant
Sure! Here's a bookmarklet that will find all
<a>elements whosehrefends with.jpg(you can easily extend it to other image types if you want) and replace their content with an<img>tag displaying the image:javascript:(function(){ var links = document.querySelectorAll('a[href$=".jpg"]'); links.forEach(function(link){ var img = document.createElement('img'); img.src = link.href; img.alt = link.textContent || 'image'; img.style.maxWidth = '200px'; // optional: limit image size img.style.maxHeight = '200px'; link.textContent = ''; // clear the link text link.appendChild(img); }); })();How to use:
- Copy the entire code above.
- Create a new bookmark in your browser.
- Paste the code into the URL/location field of the bookmark.
- Save it.
- When you are on the page with those links, click the bookmarklet.
- All
.jpglinks will be replaced with the actual images.
If you want to support more image types (like
.png,.gif), just let me know!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.