Add Links back to IP2Always

Add old links back to IP2Always

Tính đến 03-02-2025. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Add Links back to IP2Always
// @namespace   Violentmonkey Scripts
// @match       https://communities.win/c/ip2always
// @match       https://communities.win/c/ip2always/active
// @match       https://communities.win/c/ip2always/new
// @match       https://communities.win/c/ip2always/rising
// @match       https://communities.win/c/ip2always/top
// @grant       none
// @version     1.0.2
// @license     MIT
// @author      Tammer
// @description Add old links back to IP2Always
// ==/UserScript==

(function() {
    'use strict';

    function addLinks() {
        // Find menu div
        let menuDiv = document.querySelector('.sc-1ifomfq-5.cKDyLg');

        if (!menuDiv) {
            console.log("Menu not found, retrying...");
            setTimeout(addLinks, 500); // Try again after 1 second
            return;
        }

        // Prevent duplicate injection
        if (document.getElementById('custom-links-container')) {
            return;
        }

        // Create a new div for links
        let linksContainer = document.createElement('div');
        linksContainer.id = 'custom-links-container';
        linksContainer.style.position = "absolute";
        linksContainer.style.marginTop = "-1.5pt";
        linksContainer.style.marginLeft = "200px";

        // Define links
        let links = [
            { text: "HOT", url: "https://communities.win/c/ip2always" },
            { text: "ACTIVE", url: "https://communities.win/c/ip2always/active" },
            { text: "NEW", url: "https://communities.win/c/ip2always/new" },
            { text: "RISING", url: "https://communities.win/c/ip2always/rising" },
            { text: "TOP", url: "https://communities.win/c/ip2always/top" }

        ];

        // Generate links and append links
        links.forEach(linkData => {
            let link = document.createElement('a');
            link.href = linkData.url;
            link.textContent = linkData.text;
            link.style.marginRight = "20px";
            link.style.fontSize = "17px"
            link.style.letterSpacing = "2pt"
            linksContainer.appendChild(link);
        });

        // Append links next to mew existing stupid dropdown menu
        menuDiv.appendChild(linksContainer);
    }

    // Run script when DOM is fully loaded
    window.addEventListener('load', addLinks);
})();