Greasy Fork

Greasy Fork is available in English.

Steam 好友动态自动点赞

让Steam成为动态朋友圈,为她/他点赞o( ̄▽ ̄)d

当前为 2019-03-11 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Steam 好友动态自动点赞
// @namespace    https://steamcommunity.com/id/GarenMorbid/
// @version      1.3
// @description  让Steam成为动态朋友圈,为她/他点赞o( ̄▽ ̄)d
// @author       Garen
// @match        https://steamcommunity.com/id/*/home/
// @grant        none
// ==/UserScript==

(function() {
    // 获取添加按钮的父元素
    var parentNode = document.getElementsByClassName('blotter_page_title');
    // 创新点赞按钮
    var thumbsUpBtn = document.createElement("div");
    // 给点赞按钮添加各种样式与排版
    thumbsUpBtn.setAttribute("style","float:right;margin-right: 3%;margin-top: -2%;");
    thumbsUpBtn.innerHTML = '<div id="thumbsUpBtn" style="border-radius:2px;border:0;padding:1px;display:inline-block;cursor:pointer;text-decoration:none!important;color:#fff!important;background:#acb5bd;background:-webkit-linear-gradient(top,#acb5bd 5%,#414a52 95%);background-color: #21D4FD;background-image: linear-gradient(19deg, #21D4FD 0%, #B721FF 100%);"><span style="line-height: 22px;margin:0 10px 0 10px;font-size:13px;">为他们点赞!</span></div>';
    // 将点赞按钮添加到页面
    parentNode[0].appendChild(thumbsUpBtn);
    // 绑定点击事件
    document.getElementById('thumbsUpBtn').onclick = function thumbsUp(){
        // 批量点赞,支持好友动态以及评测动态
        var list = document.getElementsByClassName('thumb_up');
        // 需要点赞的动态数
        var count = 0;
        // 循环遍历点赞
        for(var i = 0;i < list.length; i++){
            if (list[i].parentNode.parentNode.getAttribute('class').indexOf('active') == -1) {
                list[i].click();
                count++;
            }
        }
        // 添加友好提示
        if (count != 0) {
            alert("已经为你点赞" + count + "动态~");
            console.log("%c已经为你点赞" + count + "动态~ By Garen","color:white;font-weight:bold;font-family:'微软雅黑';background:#000;padding:5px;");
        } else {
            alert("目前没有动态可以点赞,请稍后再来~");
            console.log("%c目前没有动态可以点赞,请稍后再来~ By Garen","color:white;font-weight:bold;font-family:'微软雅黑';background:#000;padding:5px;");
        }
    }
})();