Real likes

Script by Punsh

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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
    })
})();