Post in forum #243758 - Some raw tumblr links not working

AnotherDay said:
This probably isn't the place to ask and I can understand if you don't care to answer, however what would this look like as, let's say, a tampermonkey script? You know, for those of us who don't code but at least know how to add scripts to something like tampermonkey?

I modified an extension that somebody posted in another thread. https://greasyfork.org/scripts/31873-use-tumblr-raw-image/code/Use%20Tumblr%20Raw%20Image.user.js

// ==UserScript==
// @name        Use Tumblr Raw Image
// @namespace   UseTumblrRawImage
// @description Changes all Tumblr hosted images to use the raw version
// @author      jcunews
// @version     1.0.3
// @include     http://*.tumblr.com/*
// @include     https://*.tumblr.com/*
// @grant       none
// @run-at      document-start(
// ==/UserScript==
(function() {
  var regex = /^(https?://)(?:\d+.)?media.tumblr.com(/[0-9a-f]{32}/tumblr_(?:inline_)?[0-9A-Za-z]{16,20}_)\d+(?:\w)?(.[a-z]+)$/i;
  function processSrc(ele) {
    if (!ele.src || (ele.tagName !== "IMG")) return;
    var match = ele.src.match(regex);
    if (!match) return;
    match = match[1] + "s3.amazonaws.com/data.tumblr.com" + match[2] + "raw" + match[3];
    if (ele.getAttribute("data-src") === ele.src) ele.setAttribute("data-src", match);
    ele.src = match;
    ele.style = "max-width: 100%";
  }
  function processContainer(container) {
    var eles = container.querySelectorAll('img[src*=".media.tumblr.com/"]');
    processSrc(container);
    Array.prototype.slice.call(eles).forEach(processSrc);
  }
  var observer = new MutationObserver(function(records) {
    records.forEach(function(record) {
      if (record.attributeName) {
        if (record.attributeName === "src") processSrc(record.target);
      } else {
        var nodes = Array.prototype.slice.call(record.addedNodes);
        nodes.forEach(function(node) {
          if (node.nodeType === 1) processContainer(node);
        });
      }
    });
  });
  addEventListener("load", function() {
    processContainer(document.body);
    observer.observe(document.body, {
      childList: true,
      attributes: true,
      subtree: true
    });
  });
})();