LargeBooru

Increases the thumbnail size for Danbooru

Stan na 12-11-2015. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name          LargeBooru
// @namespace     largebooru
// @version       1.02
// @description   Increases the thumbnail size for Danbooru
// @run-at        document-end
// @include       http://*.donmai.us/*
// @include       https://*.donmai.us/*
// @exclude       http://*.donmai.us/comments*
// @exclude       https://*.donmai.us/comments*
// ==/UserScript==

//----User defined variables----
var dimensions = 300
var gap = 10
//------------------------------

var db = dimensions + gap + "px";
var d = dimensions + "px";
var indexa = document.getElementsByClassName("post-preview");
var indexb = document.getElementsByTagName("img");

for (var x = 0; x < indexa.length; x++) {
    var Data = indexa[x];
    var Image = indexb[x];
    if (Image.id !== "image") {
        var ext = Data.getAttribute("data-file-ext");
        if (ext == "gif" || ext == "jpg" || ext == "png") {
            Image.setAttribute("src", Data.getAttribute("data-large-file-url"));
        } else if (ext == "webm" || ext == "zip") {
            var Video = document.createElement("video");    
            Video.setAttribute("autoplay","autoplay");
//          Video.setAttribute("controls","controls");
//          Video.setAttribute("id","image");
            Video.setAttribute("loop","loop");
            var Source = "data-file-url";
            if (ext == "zip") Source = "data-large-file-url";
            Video.setAttribute("src",Data.getAttribute(Source));
            Video.setAttribute("height",Data.getAttribute("data-height"));
            Video.setAttribute("width",Data.getAttribute("data-width"));
            Video.volume = 0.0;
            Image.parentNode.insertBefore(Video, Image);
            Video.style.maxHeight = d;
            Video.style.maxWidth = d;
        } else {
            var width = Data.getAttribute("data-width");
            var height = Data.getAttribute("data-height");
            var denom = Math.max(width, height) / dimensions;
            var newwidth = Math.round(width / denom);
            var newheight = Math.round(height / denom);
            Image.style.width = newwidth + 'px';
            Image.style.height = newheight + 'px';
        }
        Data.style.height = db;
        Data.style.width = db;
        Data.style.margin = 0;
        Data.style.lineHeight = db;
        Image.style.maxHeight = d;
        Image.style.maxWidth = d;
    }
}