// ==UserScript== // @name Steam Store - Search Results Actions // @icon http://store.steampowered.com/favicon.ico // @namespace Royalgamer06 // @author Royalgamer06 // @version 1.0.1 // @description Add actions to steam store search results. // @match *://store.steampowered.com/search/* // @grant none // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js // @downloadURL none // ==/UserScript== // ==Code== this.$ = this.jQuery = jQuery.noConflict(true); $(document).ready(addButtons); function addButtons() { const html = `
Results actions
Add to your wishlist Follow Not interested
`; $("#additional_search_options").prepend(html); $("#btnWishlistResults").click(wishlistResults); $("#btnFollowResults").click(followResults); $("#btnIgnoreResults").click(ignoreResults); } function wishlistResults() { doAction(this, "/api/addtowishlist/"); } function followResults() { doAction(this, "/explore/followgame/"); } function ignoreResults() { doAction(this, "/recommended/ignorerecommendation/"); } function doAction(btn, action) { $(btn).prop("disabled", true).find("span").text("Loading..."); const appids = $(".search_result_row[data-ds-appid]:not(:hidden)").get().map(e => parseInt($(e).data("ds-appid"))); var ajaxDone = 0; appids.forEach(appid => { $.post(action, { sessionid: g_sessionID, appid: appid }, function() { ajaxDone++; if (ajaxDone === appids.length) { $(btn).find("span").text("Done"); } }); }); } // ==/Code==