VoidLayoutDesigner

Design AniList profile layouts

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         VoidLayoutDesigner
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Design AniList profile layouts
// @author       voidnyan
// @match        https://anilist.co/*
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const profileUserName = "voidnyan";
    const refreshIntervalInSeconds = 1;

    const banner = "";
    const pfp = "";
    const bio = "";
    const pinned = "";
    const colorRgb = "77, 199, 222";

    async function replaceImages() {
        const bannerElement = document.querySelector(".banner");
        const pfpElement = document.querySelector("img.avatar");
        const pfpLinkElements = document.querySelectorAll(`a.avatar[href*="${profileUserName}"]`);
        const bioElement = document.querySelector(".about img");
        const pinnedElement = document.querySelector(".activity-text:has(.pinned) img");
        const link = document.querySelector(".page-content > .user");

        if (colorRgb.length > 0) {
            link.style.setProperty("--color-blue", colorRgb);
            link.style.setProperty("--color-blue-dim", colorRgb);
        }

        if (banner.length > 0) {
            bannerElement.style = `background-image: url("${banner}")`;
        }

        if (pfp.length > 0) {
            pfpElement.src = pfp;
            for (const pfpLink of pfpLinkElements) {
                pfpLink.style = `background-image: url("${pfp}")`;
            }
        }

        if (bioElement && bio.length > 0){
            bioElement.src = bio;
        }
        if (pinnedElement && pinned.length > 0) {
            pinnedElement.src = pinned;

        }
    }

    let currentPath = "";
    let tryCount = 0;

    setInterval(() => {
        const path = window.location.pathname;
        if (path !== currentPath || tryCount < 3) {
            currentPath = path;
            if (path === `/user/${profileUserName}/`) {
                replaceImages();
            }
        }
    }, refreshIntervalInSeconds * 1000);

})();