F95Zone for RDLP torrent Search button

Adds a button to search on RDLP when you are on the game thread.

11.11.2024 itibariyledir. En son verisyonu görün.

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        F95Zone for RDLP torrent Search button
// @namespace   Violentmonkey Scripts
// @match       https://f95zone.to/threads/*
// @grant       none
// @version     1.0
// @author      UglyOldLazyBastard
// @license WTFPL http://www.wtfpl.net/faq/
// @description Adds a button to search on RDLP when you are on the game thread.
// ==/UserScript==

(function() {
    'use strict';

      function removeSpecials(str) {
        var lower = str.toLowerCase();
        var upper = str.toUpperCase();

        var res = "";
        for(var i=0; i<lower.length; ++i) {
            if(lower[i] != upper[i] || lower[i].trim() === '')
                res += str[i];
        }
        return res;
      }



    // Function to create and add the button
    function addRDLPSearchButton() {
        // Get the text from h1.p-title-value
        const titleElement = document.querySelector('h1.p-title-value');
        if (!titleElement) return;

        let searchText = Array.from(titleElement.childNodes)
            .filter(node => node.nodeType === Node.TEXT_NODE)
            .map(node => node.textContent.trim())
            .join(' ')
            .trim();
        searchText = searchText.split("[")[0].trim();
        searchText = removeSpecials(searchText);
        console.log(searchText);

        // Create the new button
        const newButton = document.createElement('a');
        newButton.href = `https://dl.rpdl.net/torrents?search=${encodeURIComponent(searchText)}`;
        newButton.className = 'button--link button';
        newButton.innerHTML = '<span class="button-text">Search on RDLP</span>';

        // Find the .buttonGroup element
        const buttonGroup = document.querySelector('.buttonGroup');
        if (buttonGroup) {
            // Add the new button to the button group
            buttonGroup.appendChild(newButton);
        }
    }



    // Run the function when the page is fully loaded
    window.addEventListener('load', addRDLPSearchButton);
})();