Steam Community - Add Direct Join Group To Search

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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>');
    }
});