博客园自动点赞代码

<script>
    window.onload = function () {
        // 判断登陆
        var navbarAnonymous     = document.querySelector(".navbar-anonymous");
        if (navbarAnonymous.style.display == "inline") {
            return console.log("未登陆");
        }
        // 判断自己
        if(window.location.href.indexOf(document.querySelector("#navblog-myblog-icon").href) !== -1){
            return console.log("自己的博客不操作");
        }
        // 关注
        var pBFollow            = document.querySelector("#p_b_follow");
        var greenChannelFollow  = document.querySelector("#green_channel_follow");
        if (pBFollow.innerText  == "+加关注" && greenChannelFollow) {
            console.log("关注完毕");
            greenChannelFollow.click();
        }
        // 点赞
        var diggTips            = document.querySelector("#digg_tips");
        var diggit              = document.querySelector(".diggit");
        if (diggTips.innerText  != "您已支持过" && diggit) {
            console.log("点赞完毕");
            diggit.click();
        }
    }
</script>

 

上一篇:JS-DOM


下一篇:2020-12-25