Gelbooru Show Original Resolution on Resized Notice

Shows the dimensions of the original image together with the prompt to show it.

Från och med 2020-11-25. Se den senaste versionen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Gelbooru Show Original Resolution on Resized Notice
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Shows the dimensions of the original image together with the prompt to show it.
// @author       Xerodusk
// @homepage     https://greasyfork.org/en/users/460331-xerodusk
// @include      https://gelbooru.com/index.php*page=post&s=view*
// @grant        none
// @icon         https://gelbooru.com/favicon.png
// ==/UserScript==
/* jshint esversion: 6 */
(function() {
    'use strict';

    // Get the resized status alert if exists, otherwise nothing to do
    const resizedNotice = document.getElementById('resized_notice');
    if (!resizedNotice || resizedNotice.classList.contains('alert-info-deleted')) {
        return;
    }

    // Get functionally-buttons-but-presented-as-links
    let buttons = resizedNotice.getElementsByTagName('a');
    if (buttons.length != 3) {
        return;
    }
    buttons = Array.from(buttons).map(button => button.cloneNode(true));

    // Clear current notice
    while (resizedNotice.firstChild) {
        resizedNotice.removeChild(resizedNotice.firstChild);
    }

    // Construct new notice with extra text inserted into the middle
    resizedNotice.appendChild(document.createTextNode('This image has been resized. Click '));
    resizedNotice.appendChild(buttons[0]);
    resizedNotice.appendChild(document.createTextNode(' to view the original ' + window.image.width + 'x' + window.image.height + ' image. '));
    resizedNotice.appendChild(buttons[1]);
    resizedNotice.appendChild(document.createTextNode(' | '));
    resizedNotice.appendChild(buttons[2]);
    resizedNotice.appendChild(document.createTextNode('.'));
})();