G00DB0Y / Adult Tracker Cover Preview

// ==UserScript==
// @name         Adult Tracker Cover Preview
// @author       G00DB0Y
// @description  Shows cover images on various Private Adult Tracker pages
// @namespace    https://openuserjs.org/users/G00DB0Y
// @license      MIT
// @version      0.3
// @match        https://www.happyfappy.org/torrents.php*
// @match        https://www.empornium.is/torrents.php*
// @match        https://www.empornium.sx/torrents.php*
// @match        https://femdomcult.org/torrents.php*
// @match        https://www.enthralled.me/torrents.php*
// @match        https://www.homeporntorrents.club/torrents.php*
// @match        https://kufirc.com/torrents.php*
// @match        https://bitporn.eu/torrents.php*
// @match        https://pussytorrents.org/torrents/browse*
// @compatible   Greasemonkey, Tampermonkey
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js
// ==/UserScript==

// Functionality for general Adult Tracker pages (EMP,HF,FEM,ENT,HPT,KUFIRC)
$('#torrent_table td > a').each(function (index, value) {
    var id = $(value).attr("href");
    id = id.replace("/torrents.php?id=", "");

    if (typeof unsafeWindow["overlay" + id] !== 'undefined') {
        var popup = $.parseHTML(unsafeWindow["overlay" + id]);
        var src = $('img', popup).attr("src");

        $(value).append('<div><img src="' + src + '" style="max-width: 200px;"></div>');

    }
});

// Functionality specific to BitPorn
$('td.embedded').each(function (index, value) {
    $('img.imagePreview', value).attr("src", $('img', value).attr('data-src'));
    $(value).css('max-width', '200px');
    $(value).css('max-height', 'none');
    $(value).css('width', 'auto');
    $(value).css('height', 'auto');

    $('img.imagePreview', value).css('max-width', '200px');
    $('img.imagePreview', value).css('max-height', 'none');
    $('img.imagePreview', value).css('width', 'auto');
    $('img.imagePreview', value).css('height', 'auto');
});

// Functionality specific to PussyTorrents
var site = "https://pussytorrents.org";

var delay_milliseconds = 100;

// press F5
if (window.location.href.indexOf('#') > -1) {
  var new_url = window.location.href.replace(/\#/g, '?');
  window.location.href = new_url;
}

// images from description
$('tr.even, tr.odd').each(function (index, value) {

  setTimeout(function () {

    var item = $('<tr style="width: max-content; padding-top: 10px;">');

    $(value).after(item.load('/torrent/' + value.id + ' #torrentImages', function (responseText, textStatus, req) {

      $('#torrentImages', $(this)).replaceWith('<td colspan="8">' + $('#torrentImages', $(this)).html() + '</td>');

      $('a', $(this)).each(function (index2) {

        if (index2 < 3) {
          var image_url = $(this).attr('href');

          $('img', this).attr("src", image_url);
        }

      });

    }));

  }, (delay_milliseconds * (index + 1)));

});