NZBKing Search Helper

Changes the design and layout of NZBKing, to better help with searches.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         NZBKing Search Helper
// @namespace    nzbking.userscripts.soon.to
// @version      0.1
// @description  Changes the design and layout of NZBKing, to better help with searches.
// @author       Fox
// @match        https://www.nzbking.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Remove elements with "wide-banner" or "narrow-banner" classes
    var banners = document.querySelectorAll('.wide-banner, .narrow-banner');
    banners.forEach(function(banner) {
        banner.remove();
    });

    // Restyle the table.
    // Remove the border of elements with class "search-results"
    var searchResults = document.querySelectorAll('.search-results');
    searchResults.forEach(function(result) {
        result.style.border = 'none';
    });

    // Change bright colors
    var allGood = document.querySelectorAll('.allgood');
    allGood.forEach(function(result) {
        result.style.color = '#b3d9b3';
    });

    // Function to make text blue up to the first <br> tag and check for filetypes: .EXE
    function processSearchSubject(element) {
        // Create a range
        var range = document.createRange();
        range.setStart(element.firstChild, 0);

        // Find the first <br> within the element
        var brElement = element.querySelector('br');

        // Check if <br> is found
        if (brElement) {
            range.setEnd(brElement.previousSibling, brElement.previousSibling.textContent.length);
        } else {
            // If <br> is not found, set the end to the end of the text node
            range.setEnd(element.firstChild, element.firstChild.textContent.length);
        }

        // Create a span element with blue color
        var span = document.createElement('span');
        span.style.color = '#354fd9';
        span.style.fontSize = '18px';
        span.style.fontWeight = 'bold';

        // Extract the content of the range and append it to the span
        span.appendChild(range.extractContents());

        // Insert the span before the first child (text content)
        element.insertBefore(span, element.firstChild);

        // Check if the text contains "filetypes: .EXE"
        if (element.textContent.includes('.EXE')) {
            // Add additional styling or perform actions if needed
            var parentElement = element.parentNode;
            parentElement.style.opacity = '0.3';
        }
    }

    // Get all elements with class "search-subject"
    var searchSubjects = document.querySelectorAll('.search-subject');

    // Loop through each element
    searchSubjects.forEach(processSearchSubject);

})();