Real likes

Script by Punsh

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Real likes
// @namespace    http://tampermonkey.net/
// @version      2024-05-26
// @description  Script by Punsh
// @author       You
// @match        https://lolz.live/threads/7112292/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lolz.live
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    const users = document.querySelectorAll(".userText")

    let html = document.createElement("div")

    users.forEach(user => {
        let link = user.querySelector("span a.username")

        fetch(`https://lolz.live/${link.getAttribute("href")}`).then(resul => resul.text().then(htmlText => {
            let noReaction = 0

            html.innerHTML = htmlText

            let reaction = Number(html.querySelector(".count").textContent.replace(" ", ""))

            fetch(`https://lolz.live/${link.getAttribute("href")}likes?type=gotten&content_type=post&stats=1`).then(resul => {
                resul.text().then(htmlText => {
                    html.innerHTML = htmlText

                    let allReaction = html.querySelectorAll(".node ")

                    allReaction.forEach(el => {
                        if (el.querySelector(".muted").textContent.toLowerCase().indexOf("розыгрыш") !== -1) {
                            noReaction += Number(el.querySelector(".counter").textContent.replace(" ", ""))
                        }
                    })

                    const element = `<i class="userCounterIcon fas fa-heart"></i>${reaction - noReaction}`
                    if (user.querySelector(".userCounters span")) {
                        user.querySelector(".userCounters span").innerHTML = element
                    } else {
                        user.insertAdjacentHTML("beforeend", `<span class="userCounter item muted">${element}</span>`)
                    }
                })
            })
        }))
    })

    const observ = new MutationObserver(obser => {
        const window = `<div style="position: absolute; left: -999999px; top: -999999px; width: 100px; height: 100px; overflow: scroll;"><div style="height: 200px; width: 100%;"></div></div>`

        const reaction = document.querySelectorAll(".memberCardInner")

        if (obser[0].addedNodes[0]) {
            if (obser[0].addedNodes[0].outerHTML == window) {
                let link = reaction[reaction.length - 1].querySelector(".username.NoOverlay").getAttribute("href")
                let noReaction = 0

                fetch(`https://lolz.live/${link}likes?type=gotten&content_type=post&stats=1`).then(resul => {
                    resul.text().then(htmlText => {
                        html.innerHTML = htmlText

                        let allReaction = html.querySelectorAll(".node ")

                        allReaction.forEach(el => {
                            if (el.querySelector(".muted").textContent.toLowerCase().indexOf("розыгрыш") !== -1) {
                                noReaction += Number(el.querySelector(".counter").textContent.replace(" ", ""))
                            }
                        })

                        const element = `<i class="counterIcon likeCounterIcon"></i>${Number(reaction[reaction.length - 1].querySelector("a.counter").textContent.replace(" ", "")) - noReaction}`
                        reaction[reaction.length - 1].querySelector("a.counter").innerHTML = element
                    })
                })
            }
        }
    })

    observ.observe(document.body, {
        childList: true,
        subtree: false
    })
})();