[Mods Website] Changing Content-Disposition Header

A place to talk about the official Factorio mod portal (https://mods.factorio.com)
Geertje123
Burner Inserter
Burner Inserter
Posts: 19
Joined: Sun May 08, 2016 5:49 pm
Contact:

[Mods Website] Changing Content-Disposition Header

Post 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>");
        });
    });
})();

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [Mods Website] Changing Content-Disposition Header

Post by Nexela »

I have been using this.

viewtopic.php?f=189&t=30631

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [Mods Website] Changing Content-Disposition Header

Post by ssilk »

Moved from suggestions to mod portal discussions.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Post Reply

Return to “Mod portal Discussion”