Steam Store - Search Results Actions

Add actions to steam store search results.

  1. // ==UserScript==
  2. // @name Steam Store - Search Results Actions
  3. // @icon http://store.steampowered.com/favicon.ico
  4. // @namespace Royalgamer06
  5. // @author Royalgamer06
  6. // @version 1.1.1
  7. // @description Add actions to steam store search results.
  8. // @match *://store.steampowered.com/search/*
  9. // @grant none
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
  11. // ==/UserScript==
  12.  
  13. // ==Code==
  14. this.$ = this.jQuery = jQuery.noConflict(true);
  15. $(document).ready(addButtons);
  16.  
  17. function addButtons() {
  18. const html = `<div class="block">
  19. <div class="block_header">
  20. <div>Actions for all search results</div>
  21. </div>
  22. <div class="block_content block_content_inner">
  23. <a class="btnv6_blue_hoverfade btn_medium" data-store-tooltip="Add these products to your wishlist." style="width:100%;text-align:center;margin-bottom:3px;" id="btnWishlistResults">
  24. <span>Add to your wishlist</span>
  25. </a>
  26. <a class="btnv6_blue_hoverfade btn_medium" data-store-tooltip="Add these products to cart" style="width:100%;text-align:center;margin-bottom:3px;" id="btnCartResults">
  27. <span>Add to cart</span>
  28. </a>
  29. <a class="btnv6_blue_hoverfade btn_medium" data-store-tooltip="Follow these products" style="width:100%;text-align:center;margin-bottom:3px;" id="btnFollowResults">
  30. <span>Follow</span>
  31. </a>
  32. <a class="btnv6_blue_hoverfade btn_medium" data-store-tooltip="Ignore these products" style="width:100%;text-align:center;margin-bottom:3px;" id="btnIgnoreResults">
  33. <span>Not interested</span>
  34. </a>
  35. </div>
  36. </div>`;
  37. $("#additional_search_options").prepend(html);
  38. $("#btnWishlistResults").click(wishlistResults);
  39. $("#btnCartResults").click(cartResults);
  40. $("#btnFollowResults").click(followResults);
  41. $("#btnIgnoreResults").click(ignoreResults);
  42. }
  43.  
  44. function wishlistResults() {
  45. doAction(this, "/api/addtowishlist/");
  46. }
  47.  
  48. function cartResults() {
  49. doAction(this, "/app/{{appid}}/?addtocart=1");
  50. }
  51.  
  52. function followResults() {
  53. doAction(this, "/explore/followgame/");
  54. }
  55.  
  56. function ignoreResults() {
  57. doAction(this, "/recommended/ignorerecommendation/");
  58. }
  59.  
  60. function doAction(btn, action) {
  61. $(btn).prop("disabled", true).find("span").text("Loading...");
  62. const appids = $(".search_result_row[data-ds-appid]").get().filter(e => $(e).height() > 0).map(e => parseInt($(e).data("ds-appid")));
  63. var ajaxDone = 0;
  64. appids.forEach(appid => {
  65. $.post(action.replace("{{appid}}", appid), {
  66. sessionid: g_sessionID,
  67. appid: appid
  68. }, function() {
  69. ajaxDone++;
  70. if (ajaxDone === appids.length) {
  71. $(btn).find("span").text("Done");
  72. }
  73. });
  74. });
  75. }
  76. // ==/Code==

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址