better_drunkenslug_preview

Better Thumbnail preview for drunkenslug

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         better_drunkenslug_preview
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Better Thumbnail preview for drunkenslug
// @author       takuto
// @match        https://drunkenslug.com/*
// @grant        none
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    function createImagePreview(link) {
        let div = document.createElement('div');
        div.style.display = 'inline-block';
        div.style.margin = '10px';

        let img = document.createElement('img');
        img.src = link.href;
        img.style.maxWidth = '400px';
        img.style.maxHeight = '400px';
        img.style.display = 'block';

        div.appendChild(img);
        link.parentNode.insertBefore(div, link.nextSibling);
    }

    let links = document.querySelectorAll('a[href]');
    links.forEach(link => {
        if (link.href.match(/\.(jpeg|jpg|gif|png)$/)) {
            createImagePreview(link);
        }
    });
})();

(function() {
    'use strict';
    function containsText(node, text) {
        return node && node.textContent.includes(text);
    }

    let rows = document.querySelectorAll('tr');

    rows.forEach(row => {
        let containsBtnsDiv = row.querySelector('div.btns');

        let containsThumbnail = Array.from(row.querySelectorAll('a')).some(link => link.textContent.trim() === 'Thumbnail');

        if ((containsBtnsDiv && !containsThumbnail)) {
            row.remove();

//        let contains2160p = containsText(row, '2160');
//        let male = containsText(row, 'a.b.multimedia.erotica.male');
//
//        if ((containsBtnsDiv && !containsThumbnail) || contains2160p || male) {
//            row.remove();

        }
    });
})();

(function() {
    'use strict';

    let links = document.querySelectorAll('a');

    links.forEach(link => {
        if (link.textContent.trim() === 'Thumbnail') {
            link.remove();
        }
    });
})();