better_drunkenslug_preview

Better Thumbnail preview for drunkenslug

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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