<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Render BBCode for the description on old website]]></title><description><![CDATA[<p dir="auto">People often use BBCode in torrent descriptions, but the old(and default for now) website does not support rendering it, so I used AI to create a script for rendering BBCode, which can be imported into TamperMonkey.<br />
Before and after comparison:<br />
<img src="/assets/uploads/files/1781648003014-6285ef58c8c5.jpg" alt="2026 06 05 210645" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1781648003353-09b77fa83aa5.jpg" alt="2026 06 05 210629" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1781648003656-61d1f4bfd5d2.jpg" alt="2026 06 05 210704" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1781648003900-90292c69866a.jpg" alt="2026 06 05 210727" class=" img-fluid img-markdown" /></p>
<pre><code>// ==UserScript==
// @name         Gaytor.rent BBCode Renderer
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Auto-renders BBCode on gaytor.rent details and search pages, with smart color filtering for dark background compatibility.
// @author       Lln
// @match        https://www.gaytor.rent/details.php?id=*
// @match        https://www.gaytor.rent/search.php*
// @icon         https://www.google.com/s2/favicons?sz=64&amp;domain=gaytor.rent
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Luminance detection function: Check if a color is too dark
    function isDarkColor(colorStr) {
        // Clean quotes and convert to lowercase
        let color = colorStr.replace(/['"]/g, '').trim().toLowerCase();
        let r, g, b;

        // 1. Handle common dark color names
        const darkNames = ['black', '#000', '#000000', 'navy', 'darkblue', 'darkgreen', 'darkred', 'maroon', 'purple', 'indigo'];
        if (darkNames.includes(color)) return true;

        // 2. Parse HEX colors (e.g., #3a3a3a or #333)
        let hexMatch = color.match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);
        if (hexMatch) {
            let hex = hexMatch[1];
            if (hex.length === 3) {
                hex = hex.split('').map(c =&gt; c + c).join('');
            }
            r = parseInt(hex.substring(0, 2), 16);
            g = parseInt(hex.substring(2, 4), 16);
            b = parseInt(hex.substring(4, 6), 16);
        }
        // 3. Parse RGB colors (e.g., rgb(58, 58, 58))
        else if (color.startsWith('rgb')) {
            let rgbMatch = color.match(/\d+/g);
            if (rgbMatch &amp;&amp; rgbMatch.length &gt;= 3) {
                r = parseInt(rgbMatch[0]);
                g = parseInt(rgbMatch[1]);
                b = parseInt(rgbMatch[2]);
            }
        }

        // If RGB values are successfully parsed, calculate perceived luminance (Luma)
        if (r !== undefined &amp;&amp; g !== undefined &amp;&amp; b !== undefined) {
            // Luma formula (range 0-255)
            let luma = 0.299 * r + 0.587 * g + 0.114 * b;
            return luma &lt; 120; // Considered dark if luminance is below 120
        }

        return false; // Default to allowing the color if it cannot be parsed
    }

    // Core BBCode rendering function
    function renderBBCode(str) {
        if (!str) return str;

        const bbcodeMap = [
            // Basic formatting
            [/\[b\]([\s\S]*?)\[\/b\]/gi, '&lt;strong&gt;$1&lt;/strong&gt;'],
            [/\[i\]([\s\S]*?)\[\/i\]/gi, '&lt;em&gt;$1&lt;/em&gt;'],
            [/\[u\]([\s\S]*?)\[\/u\]/gi, '&lt;u&gt;$1&lt;/u&gt;'],
            [/\[s\]([\s\S]*?)\[\/s\]/gi, '&lt;del&gt;$1&lt;/del&gt;'],

            // Alignment
            [/\[center\]([\s\S]*?)\[\/center\]/gi, '&lt;div style="text-align: center;"&gt;$1&lt;/div&gt;'],
            [/\[left\]([\s\S]*?)\[\/left\]/gi, '&lt;div style="text-align: left;"&gt;$1&lt;/div&gt;'],
            [/\[right\]([\s\S]*?)\[\/right\]/gi, '&lt;div style="text-align: right;"&gt;$1&lt;/div&gt;'],
            [/\[align=(left|center|right|justify)\]([\s\S]*?)\[\/align\]/gi, '&lt;div style="text-align: $1;"&gt;$2&lt;/div&gt;'],

            // Links
            [/\[url=(.+?)\]([\s\S]*?)\[\/url\]/gi, '&lt;a href="$1" target="_blank" style="color: #4a90e2; text-decoration: underline;"&gt;$2&lt;/a&gt;'],
            [/\[url\]([\s\S]*?)\[\/url\]/gi, '&lt;a href="$1" target="_blank" style="color: #4a90e2; text-decoration: underline;"&gt;$1&lt;/a&gt;'],

            // Color handling: Filter out dark colors for dark mode compatibility
            [/\[color=(.+?)\]([\s\S]*?)\[\/color\]/gi, function(match, colorCode, content) {
                if (isDarkColor(colorCode)) {
                    // If considered dark, strip the color style to inherit the default bright text color
                    return `&lt;span&gt;${content}&lt;/span&gt;`;
                }
                return `&lt;span style="color: ${colorCode.replace(/['"]/g, '')}"&gt;${content}&lt;/span&gt;`;
            }],

            // Size and Font
            [/\[size=(.+?)\]([\s\S]*?)\[\/size\]/gi, function(match, size, content) {
                let sizeMap = {"1":"10px", "2":"13px", "3":"16px", "4":"18px", "5":"24px", "6":"32px", "7":"48px"};
                let cssSize = sizeMap[size] || (size.includes('px') || size.includes('em') ? size : size + 'px');
                return `&lt;span style="font-size: ${cssSize}"&gt;${content}&lt;/span&gt;`;
            }],
            [/\[font=(.+?)\]([\s\S]*?)\[\/font\]/gi, '&lt;span style="font-family: $1"&gt;$2&lt;/span&gt;'],

            // Lists
            [/\[ul\]([\s\S]*?)\[\/ul\]/gi, '&lt;ul style="margin-left: 25px; list-style-type: disc;"&gt;$1&lt;/ul&gt;'],
            [/\[ol\]([\s\S]*?)\[\/ol\]/gi, '&lt;ol style="margin-left: 25px; list-style-type: decimal;"&gt;$1&lt;/ol&gt;'],
            [/\[li\]([\s\S]*?)\[\/li\]/gi, '&lt;li style="margin-bottom: 4px;"&gt;$1&lt;/li&gt;'],

            // Media and Quotes
            [/\[img\]([\s\S]*?)\[\/img\]/gi, '&lt;img src="$1" style="max-width: 100%; border-radius: 4px;" /&gt;'],
            [/\[quote\]([\s\S]*?)\[\/quote\]/gi, '&lt;blockquote style="border-left: 4px solid #888; margin: 10px 0; padding: 10px 15px; background: rgba(255,255,255,0.05);"&gt;$1&lt;/blockquote&gt;']
        ];

        let previous;
        // Handle nested tags by looping until no more replacements can be made
        do {
            previous = str;
            bbcodeMap.forEach(([regex, replacement]) =&gt; {
                str = str.replace(regex, replacement);
            });
        } while (str !== previous);

        return str;
    }

    // --- Scenario 1: Process the Details page ---
    const labels = document.querySelectorAll('td.tabledescription');
    for (let label of labels) {
        if (label.textContent.trim() === 'Description:') {
            let descContentCell = label.nextElementSibling;
            if (descContentCell) {
                descContentCell.innerHTML = renderBBCode(descContentCell.innerHTML);
            }
            break;
        }
    }

    // --- Scenario 2: Process Search pages ---
    // Find full description boxes
    const listDescriptions = document.querySelectorAll('div.description_text');
    listDescriptions.forEach(div =&gt; {
        div.innerHTML = renderBBCode(div.innerHTML);
    });

})();
</code></pre>
]]></description><link>https://community.gaytor.rent/topic/69244/render-bbcode-for-the-description-on-old-website</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 11:26:13 GMT</lastBuildDate><atom:link href="https://community.gaytor.rent/topic/69244.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 05 Jun 2026 13:49:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Render BBCode for the description on old website on Sun, 07 Jun 2026 18:06:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joker" aria-label="Profile: Joker">@<bdi>Joker</bdi></a> new site looks great! love it!</p>
]]></description><link>https://community.gaytor.rent/post/341090</link><guid isPermaLink="true">https://community.gaytor.rent/post/341090</guid><dc:creator><![CDATA[nightly34]]></dc:creator><pubDate>Sun, 07 Jun 2026 18:06:30 GMT</pubDate></item><item><title><![CDATA[Reply to Render BBCode for the description on old website on Sun, 07 Jun 2026 17:53:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/llln" aria-label="Profile: Llln">@<bdi>Llln</bdi></a> Fixed — thanks for the two examples, that made it easy to track down.</p>
<p dir="auto">Those descriptions were written on the old site with a very dark text colour: it looked fine on the old white background but disappeared against the new dark one. The site now automatically catches text colours that are too dark to read on the dark theme and falls them back to the normal readable colour, while genuine accents (headings, links) stay as the uploader set them.</p>
<p dir="auto">Both torrents you linked read properly now — just give the page a reload.</p>
]]></description><link>https://community.gaytor.rent/post/341089</link><guid isPermaLink="true">https://community.gaytor.rent/post/341089</guid><dc:creator><![CDATA[Joker]]></dc:creator><pubDate>Sun, 07 Jun 2026 17:53:39 GMT</pubDate></item><item><title><![CDATA[Reply to Render BBCode for the description on old website on Sun, 07 Jun 2026 14:45:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joker" aria-label="Profile: Joker">@<bdi>Joker</bdi></a> After switching to the new website, I found the descriptions for these two torrents almost unreadable. Could you make some optimizations?</p>
<p dir="auto"><a href="https://www.gaytor.rent/details.php?id=w3ypFRjE7ZRaFTNzIjzf7w" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.gaytor.rent/details.php?id=w3ypFRjE7ZRaFTNzIjzf7w</a><br />
<a href="https://www.gaytor.rent/details.php?id=ZRCqWt-hnfJHYkrCteq0Wg" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.gaytor.rent/details.php?id=ZRCqWt-hnfJHYkrCteq0Wg</a></p>
<p dir="auto"><img src="/assets/uploads/files/1781647576503-175755770b90.png" alt="2026 06 07 223917" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.gaytor.rent/post/341079</link><guid isPermaLink="true">https://community.gaytor.rent/post/341079</guid><dc:creator><![CDATA[Llln]]></dc:creator><pubDate>Sun, 07 Jun 2026 14:45:28 GMT</pubDate></item><item><title><![CDATA[Reply to Render BBCode for the description on old website on Sat, 06 Jun 2026 21:26:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/llln" aria-label="Profile: Llln">@<bdi>Llln</bdi></a> Thanks for putting this together — genuinely nice work.</p>
<p dir="auto">Good news: you won't need the script. The new version of the site renders BBCode in torrent descriptions natively — bold, colours, images and the rest show up properly formatted, and it already keeps the text readable against the dark background.</p>
<p dir="auto">You can switch over to it here:<br />
<a href="https://www.gaytor.rent/setproxy.php?v=develgt" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.gaytor.rent/setproxy.php?v=develgt</a></p>
<p dir="auto">One heads-up: the new site is becoming the default, so for normal accounts the switch sticks for now — but I'm confident you'll be glad you made it. Once you're on, open any torrent and the descriptions will render just like your script does.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.gaytor.rent/post/341008</link><guid isPermaLink="true">https://community.gaytor.rent/post/341008</guid><dc:creator><![CDATA[Joker]]></dc:creator><pubDate>Sat, 06 Jun 2026 21:26:02 GMT</pubDate></item></channel></rss>