Danboodu - Old image urls

Reverts raw image links on danbooru to old format, adds key bind for said links (~)

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Danboodu - Old image urls
// @namespace    iwsfg
// @version      0.1.8
// @description  Reverts raw image links on danbooru to old format, adds key bind for said links (~)
// @author       Iwasawafag
// @include      http://*.donmai.us/posts/*
// @include      https://*.donmai.us/posts/*
// ==/UserScript==

$(function() {
    'use strict';

    $('#post-information a')
        .filter(function(i, el) {
            // Could be one of at least 3 different variants
            //
            // Post 3062641: "https://danbooru.donmai.us/data/__inubashiri_momiji_..."
            // Post 2716443: "https://hijiribe.donmai.us/data/__original_drawn_by_..."
            // Post 784297:  "https://raikou1.donmai.us/b0/05/__kiss_shot_a...__b005c471d483f..."
            return (/^(?:https?:\/\/[a-z0-9]+\.donmai\.us\/?)?\/(data\/|[a-f0-9/]{5}\/)(__).*?__([a-f0-9]+)\.[a-z]+$/i).test(el.href);
        })
        .add('#image-resize-link') // Links above large images that say "Resized to 42% of original (view original)"
        .each(function(i) {
            var link = $(this);
            var oldHref = $(this).attr('href');

            link.attr('href', oldHref.replace(/\/[^\/]*?([^_-]+$)/i, '/$1'));

            if (i > 0) return;

            $(document).keydown(function(e) {
                if (e.keyCode === 192) document.location.href = link.attr('href');
            });
        });
});