YouTube Video Preview and Ratings Keyless

Instant video previews in popup player by hovering or clicking video thumbs. Video ratings and resolution data shown on the thumbs. Gets video information without using a YouTube API key, which can be banned or limited.

< Feedback on YouTube Video Preview and Ratings Keyless

مراجعة: Good - script works

Deleted user 25884
§
Posted: 23-08-2021

Request: Please allow percentage ranges instead of a gradient. I miss the old setting, where I could set >90 green, 80-90 orange and <80 red. A gradient is sometimes hard to read for me and there really are terrible videos, not just those below 50%.

I tried changing the code but I couldn't get a satisfying result on my end.

Deleted user 25884
§
Posted: 23-08-2021
Edited: 23-08-2021
        if (rating > 0) {
            var perc = Math.round((rating/5)*100);
            var scaled = perc/100;
            var hex;
            if (scaled > 0.9){
            hex = `#33cc33`;
            }
            else if (scaled > 0.8 && scaled <= 0.9){
            hex = `#ff9933`;
            }
            else if (scaled <= 0.8){
            hex = `#cc0000`;
            }

            newElem("div",
                    { "class": "vpp_meta_rate",
                      "style": `background:${hex} !important;`,
                      "title": `${Number(views).toLocaleString()} views`
                    },
                    `${perc}`,
                    parent);
            parent.setAttribute("vpp_meta_rate", "");
        }

Never mind, fix was trivial.

Post reply

تسجيل الدخول إلى مرحلة ما بعد الرد.