Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name read gifs to links
- // @description Make gifs in read messages into links on some of Something Awful's image heavy threads
- // @include http://forums.somethingawful.com/showthread.php*threadid=3457178*
- // ==/UserScript==
- /*jslint browser: true, maxerr: 50, indent: 4, plusplus: true */
- /* Instead of downloading the 200 megs of gifs that you've already seen,
- it should only download the 20 megs of gifs that you haven't seen yet. (or old gifs someone quotes)
- WORKSFORME WONTFIX
- */
- window.addEventListener('DOMContentLoaded', function () {
- "use strict";
- var readImgs = document.querySelectorAll(".post .seen2 .postbody img, .post .seen1 .postbody img"),
- i,
- img,
- a,
- sa_pattern = /https?:\/\/\w*\.?somethingawful\.com\//,
- src;
- for (i = 0; i < readImgs.length; i++) {
- img = readImgs[i];
- if (sa_pattern.test(img.src)) { // skip emoticons and avatars
- continue;
- }
- src = img.src;
- delete img.src;
- a = document.createElement('a');
- a.href = src;
- a.target = '_blank';
- a.appendChild(document.createTextNode(src));
- img.parentNode.replaceChild(a, img);
- }
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement