better_drunkenslug_preview

Better Thumbnail preview for drunkenslug

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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();
        }
    });
})();