PregChan Download Button

Adds a button to image posts to download the image with it's original filename.

Versione datata 27/04/2020. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         PregChan Download Button
// @namespace    https://twitter.com/goawaynowgan
// @version      1.2
// @description  Adds a button to image posts to download the image with it's original filename.
// @author       GanBat
// @include      https://pregchan.com/*
// @include      http://pregchan.com/*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
// @grant        none
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4wIaEjM3ShSQNgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAOFSURBVGje7Zp/SJVXGMc/51Wudn316prVqP0GxbwYWc3Jqm0yphEZRbOgwf6K3ASj3AaDQa5/gzbaXUVCjf1g7I79YK4hhqQhajcKLGW6cIuJk7JM7y+9V+rsD03YvMv33ntevS/c75/v+/Kc7/ec5zzP93BeASAH3UsIP9iCFLUI1oOwA4LEggQmg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icons, licensed under Creative Commons Attribution 4.0 International.
// https://fontawesome.com/license
// The only change made to the icon is color.

(function() {
    'use strict';
    var $ = window.jQuery;
    $("head").append ('<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/solid.css" integrity="sha384-r/k8YTFqmlOaqRkZuSiE9trsrDXkh07mRaoGBMoDcmA58OHILZPsk29i2BsFng1B" crossorigin="anonymous">');
    $("head").append ('<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/fontawesome.css" integrity="sha384-4aon80D8rXCGx9ayDt85LbyUHeMWd3UiBaWliBlJ53yzm9hqN21A+o1pqoyK04h+" crossorigin="anonymous">');

    $('.fileinfo').each(function() {
        var $dlsrc = $(this).children("a").first();
        var fnorig
        if ( $(this).find("span.postfilename").attr('title') == undefined ) {
            fnorig = $(this).find("span.postfilename").html();
        } else {
            fnorig = $(this).find("span.postfilename").attr('title');
        }
        $dlsrc.after(' <a href="'+ $dlsrc.attr('href') +'" download="'+ fnorig +'"><i class="fas fa-download"></i></a>');
    });

})();