Page 1 of 1

[Mods Website] Changing Content-Disposition Header

Posted: Mon Dec 05, 2016 8:46 am
by Geertje123
Hello,

I can't seem to view the full sizes of images on the mods website. Clicking the attached thumbnails won't open a lightbox or a full version of the picture. It does nothing at all, even though the cursor goes to a pointer and a yellow edge is brought around the thumbnail which makes you expect the behaviour I mentioned earlier. (example: https://mods.factorio.com/mods/FunCrafter_2/Funs-Mod)
For this reason I decided to fix it myself by writing a script that opens the full version of the image in a new tab by removing the ".thumb" from the image url.

example:
https://mods-data.factorio.com/pub_data ... .thumb.png
https://mods-data.factorio.com/pub_data ... QJSL8v.png

Now as you can see by clicking that image, it does not nicely open it for you in a new tab but forces you to download it. This is because the header and value "Content-Disposition: attachment;" are given back from the server. My request is if you could remove this header when an image is requested, or make the mods website so that you can actually view full sized images when clicking the thumbnails.

For now I created a temporary (and ugly) fix for this problem, if anyone is interested in using it:
(Use TamperMonkey for Chrome or GreaseMonkey for Firefox)

Code: Select all

// ==UserScript==
// @name         FixFactorioWebsite
// @namespace    http://factorio.com/
// @version      0.1
// @description  This will fix a few things on the website
// @author       Geertje123
// @match        https://mods.factorio.com/mods/*
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $("document").ready(function () {
        $(".gallery-thumbnail").click(function () {
            var url = $(this).find("img").attr("src").replace(".thumb", "");
            $(window.open().document.body).html("<!DOCTYPE html><html><head><style>body{margin:0;}</style></head><body><img src='" + url +"' style='height: 100vh;'></body></html>");
        });
    });
})();

Re: [Mods Website] Changing Content-Disposition Header

Posted: Mon Dec 05, 2016 9:06 am
by Nexela
I have been using this.

viewtopic.php?f=189&t=30631

Re: [Mods Website] Changing Content-Disposition Header

Posted: Mon Dec 05, 2016 10:04 am
by ssilk
Moved from suggestions to mod portal discussions.