Steam Community - Add Direct Join Group To Search

Adds a button to join the steam group for each steam group search result.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steam Community - Add Direct Join Group To Search
// @namespace    Royalgamer06
// @version      1.0
// @description  Adds a button to join the steam group for each steam group search result.
// @author       Royalgamer06
// @include      /^http(s)?\:\/\/steamcommunity\.com\/search.+/
// @grant        none
// @run-at       document-start
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// ==/UserScript==
$("body").on("click", ".joingroup", function(ev) {
    let btn = $(this).parent();
    $(btn).html("Joining...");
    $.post($(btn).parent().find(".searchPersonaName").attr("href"), { action: "join", sessionID: g_sessionID }, function(data) {
        if ($(".error_ctn", data).length > 0) {
            $(btn).html("Failed to join");
        } else {
            $(btn).html("Successfully joined");
        }
    });
}).on("DOMNodeInserted", ".search_row", function() {
    if ($(this).find(".joinGroupArea, .search_gamegroup_avatar_holder").length === 0 && $(this).hasClass("group")) {
        $(this).find(".searchPersonaInfo").append('<div style="padding-top: 12px;" class="joinGroupArea"><a class="btn_green_white_innerfade btn_medium joingroup"><span>Join Group</span></a></div>');
    }
});