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.

< 脚本YouTube Video Preview and Ratings Keyless的反馈

评价:好评 - 脚本运行良好

Deleted user 25884
§
发表于:2021-08-23

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
§
发表于:2021-08-23
编辑于:2021-08-23
        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.

发表回复

登录以发表回复。