Derpibooru Download Fix

Restores Derpibooru download button

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name Derpibooru Download Fix
// @namespace Violentmonkey Scripts
// @match *://derpibooru.org/*
// @description  Restores Derpibooru download button
// @author       novacrazy
// @version      0.0.1
// @license      MIT
// @grant none
// @run-at document-end
// ==/UserScript==

(function() {
  
  for(let e of document.getElementsByClassName("image-metabar")) {
    e.style.setProperty("width", "100%", "important");
    e.style.setProperty("max-width", "100%", "important");
  }
  
  for(let e of document.getElementsByClassName("flex--spaced-out")) {
    e.style.setProperty("justify-content", "normal", "important");
  }
 
  for(let dropdown of document.getElementsByClassName("dropdown block__header__dropdown-tab")) {
    let short = dropdown.children[0];

    // Filter out Galleries dropdown
    if(!short.href.endsWith('#')) {
      if(short.title.includes("Download")) {
        let long = dropdown.children[1].children[0];
        
        dropdown.innerHTML = `</i><div><a href=${long.href}><i class="fa fa-download"> Download</a></div>`;
      }
    }
  }
})();