steam一键移除

steam一键取关鉴赏家,取关游戏,清空愿望单。

  1. // ==UserScript==
  2. // @name steam一键移除
  3. // @version 0.7.8
  4. // @description steam一键取关鉴赏家,取关游戏,清空愿望单。
  5. // @namespace https://gf.qytechs.cn/users/133492
  6. // @author HCLonely
  7. // @iconURL https://store.steampowered.com/favicon.ico
  8. // @include *://store.steampowered.com/*
  9. // @include *://steamcommunity.com/*
  10. // @supportURL https://blog.hclonely.com/posts/6a0923b1/
  11. // @homepage https://blog.hclonely.com/posts/6a0923b1/
  12. // @require https://cdn.bootcss.com/sweetalert/2.1.2/sweetalert.min.js
  13. // @grant GM_xmlhttpRequest
  14. // @grant GM_addStyle
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17. // @run-at document-end
  18. // @connect steamcommunity.com
  19. // @connect steampowered.com
  20. // ==/UserScript==
  21.  
  22. (function($) {
  23. 'use strict';
  24.  
  25. const url=window.location.href;
  26. let div=document.createElement("div");
  27. div.setAttribute("id", "remove");
  28. div.setAttribute("style", "background-color: #181f27;position:fixed;border-radius: 20px;width: 800px;height: 500px;margin: auto;top: 0;left: 0;right: 0;bottom: 0;z-index: 99999999999;display:none");
  29. div.innerHTML=`
  30. <div class="button_container" style="margin: 40px 45px 15px 45px;">
  31. <div class="btn_wrapper">
  32. <a id="get_fcl" href="javascript:void(0)" class="big_button">
  33. 获取鉴赏家列表 </a>
  34. </div>
  35. <div class="btn_wrapper">
  36. <a id="get_fgl" href="javascript:void(0)" class="big_button">
  37. 获取关注游戏列表 </a>
  38. </div>
  39. <div class="btn_wrapper">
  40. <a id="get_wl" href="javascript:void(0)" class="big_button">
  41. 获取愿望单列表 </a>
  42. </div>
  43. <div class="btn_wrapper">
  44. <a id="unf_c" href="javascript:void(0)" class="big_button next disabled">
  45. 取关鉴赏家 </a>
  46. </div>
  47. <div class="btn_wrapper">
  48. <a id="unf_g" href="javascript:void(0)" class="big_button next disabled">
  49. 取关游戏 </a>
  50. </div>
  51. <div class="btn_wrapper">
  52. <a id="rem_g" href="javascript:void(0)" class="big_button next disabled">
  53. 移除愿望单 </a>
  54. </div>
  55. </div>
  56. <h2 id="pro" style="margin: 0 45px;"></h2>
  57. <div id="output">
  58. <div id="setting"></div>
  59. <div id="info"></div>
  60. </div>
  61. <h4 class="checkbox"><input id="selectAll" type="checkbox">全选 <input id="reverse" type="checkbox">反选</p>
  62. <a href="javascript:void(0)" style="position:absolute;top:5px;right:5px;font-size:24px;cursor:pointer" onClick="document.getElementById('remove').style.display='none'">X</a>
  63. `;
  64. document.getElementsByTagName("body")[0].appendChild(div);
  65. let a=document.createElement("a");
  66. a.setAttribute("id", "remove_btn");
  67. a.setAttribute("class", "menuitem supernav");
  68. a.setAttribute("style", "cursor:pointer");
  69. a.innerHTML="一键移除";
  70. $(".supernav_container:first").append(a);
  71.  
  72. a.onclick=function(){
  73. if(window.location.host=="steamcommunity.com"){
  74. if(confirm("此功能需要在商店页面运行,是否跳转?")) window.open("https://store.steampowered.com/","_self");
  75. }else if(g_AccountID==0){
  76. if(confirm("请先登录(不可用)!")) window.open("https://store.steampowered.com/login/","_self");
  77. }else{
  78. $('#remove').show();
  79. }
  80. };
  81. $("#get_fcl").click(()=>{
  82. $("#pro").text("");
  83. $("#selectAll").attr("checked", false);
  84. $("#reverse").attr("checked", false);
  85. get_curators();
  86. });
  87. $("#get_fgl").click(()=>{
  88. $("#pro").text("");
  89. $("#selectAll").attr("checked", false);
  90. $("#reverse").attr("checked", false);
  91. get_follow_games();
  92. });
  93. $("#get_wl").click(()=>{
  94. $("#pro").text("");
  95. $("#selectAll").attr("checked", false);
  96. $("#reverse").attr("checked", false);
  97. get_wishlist();
  98. });
  99.  
  100. $("#unf_c").click(function(){
  101. if(!$(this).hasClass("disabled")){
  102. let curators=[];
  103. let curatorsChecked=$("p.checkbox input:checkbox:checked");
  104. for(let i=0;i<curatorsChecked.length;i++){
  105. curators.push({"name":$(curatorsChecked[i]).attr("name"),"id":$(curatorsChecked[i]).val()});
  106. }
  107. curators.length>0?unfollow_curators(curators):alert("你还没有选中要取关的鉴赏家!");
  108. }
  109. });
  110. $("#unf_g").click(function(){
  111. if(!$(this).hasClass("disabled")){
  112. let games=[];
  113. let gamesChecked=$("p.checkbox input:checkbox:checked");
  114. for(let i=0;i<gamesChecked.length;i++){
  115. games.push({"name":$(gamesChecked[i]).attr("name"),"id":$(gamesChecked[i]).val()});
  116. }
  117. games.length>0?unfollow_games(games):alert("你还没有选中要取关的游戏!");
  118. }
  119. });
  120. $("#rem_g").click(function(){
  121. if(!$(this).hasClass("disabled")){
  122. let games=[];
  123. let gamesChecked=$("p.checkbox input:checkbox:checked");
  124. for(let i=0;i<gamesChecked.length;i++){
  125. games.push($(gamesChecked[i]).val());
  126. }
  127. games.length>0?remove_wishlist(games):alert("你还没有选中要移除愿望单的游戏!");
  128. }
  129. });
  130.  
  131. //一键取关+移除愿望单
  132. if(/https?:\/\/store.steampowered.com\/app\/[\w\W]*/.test(url)){
  133. $("div.queue_control_button.queue_btn_ignore").after(`<div class="queue_control_button queue_btn_remove"><div class="btnv6_blue_hoverfade btn_medium queue_btn_inactive" style="" data-tooltip-text="移除愿望单和取消关注。"><span>一键移除</span></div></div>`);
  134. $(".queue_btn_remove>.queue_btn_inactive").click(()=>{
  135. removeWishlist();
  136. unFollow();
  137. });
  138. }
  139.  
  140. let [curators,unfC,unfG,remG,page,steam64ID,userName]=[[],0,0,0,1,'',''];
  141. userName=$('a[data-miniprofile='+g_AccountID+']').text().trim();
  142. let xhr = new XMLHttpRequest();
  143. xhr.open("GET", "https://store.steampowered.com/wishlist/id/"+userName);
  144. xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
  145. xhr.onreadystatechange = function(){
  146. let XMLHttpReq = xhr;
  147. if (XMLHttpReq.readyState == 4) {
  148. if (XMLHttpReq.status == 200) {
  149. let data = XMLHttpReq.responseText;
  150. steam64ID = data.match(/var.*?g_strWishlistBaseURL.*?[\d]+?\\/gm)[0].match(/[\d]+/)[0];
  151. }else{
  152. swal('获取steam64位ID失败!','移除愿望单功能将不可用,其他功能可正常使用!','error');
  153. }
  154. }
  155. };
  156. xhr.send();
  157.  
  158. //获取鉴赏家列表
  159. function get_curators(){
  160. let p=document.createElement("p");
  161. p.setAttribute("style", "font-size:15px");
  162. p.innerHTML=`获取鉴赏家列表...`;
  163. $("#info").append(p);
  164. p.scrollIntoView();
  165.  
  166. GM_xmlhttpRequest({
  167. method: "GET",
  168. url: "https://store.steampowered.com/dynamicstore/userdata/?id="+userName+"&t="+new Date().getTime(),
  169. timeout: 1000*30,
  170. responseType: "json",
  171. onload: function (data) {
  172. if(data.status==200){
  173. p.innerHTML+='<font style="color:green">成功!</font>';
  174. let curator=data.response.rgCurators;
  175. let curators=[];
  176.  
  177. let checkbox='';
  178. Object.keys(curator).forEach(function(key){
  179. checkbox+=`<p class="checkbox"><input type="checkbox" name="${curator[key].name}" value="${curator[key].clanid}">${curator[key].name}</p>`;
  180. });
  181. $("#setting").html(checkbox);
  182.  
  183. if(Object.keys(curator).length>0){
  184. $(".next").addClass("disabled");
  185. $("#unf_c").removeClass("disabled");
  186. }else{
  187. p.innerHTML+="<br/>关注鉴赏家列表为空!";
  188. p.scrollIntoView();
  189. }
  190. }else{
  191. p.innerHTML+='<font style="color:green">失败!</font>请刷新重试';
  192. }
  193. }
  194. });
  195. }
  196. //读取cookie
  197. function getCookie(name) {
  198. let arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  199. if(arr=document.cookie.match(reg)){
  200. return unescape(arr[2]);
  201. }else{
  202. return null;
  203. }
  204. }
  205. //取关鉴赏家
  206. function unfollow_curators(curators,i=0){
  207. i==0?$("#pro")[0].innerHTML=`取关鉴赏家进度: <font id="ard">${i}</font> / ${curators.length}`:$("#ard")[0].innerHTML=`${i}`;
  208.  
  209. let p=document.createElement("p");
  210. p.innerHTML=`取关鉴赏家<a style="cursor:pointer" href=https://store.steampowered.com/curator/${curators[i].id} target="_blank">${curators[i].name}</a>...`;
  211. $("#info").append(p);
  212. p.scrollIntoView();
  213.  
  214. GM_xmlhttpRequest({
  215. method : "POST",
  216. url: "https://store.steampowered.com/curators/ajaxfollow",
  217. timeout: 1000*30,
  218. responseType: "json",
  219. headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
  220. data:`clanid=${curators[i].id}&sessionid=${g_sessionID}&follow=0`,
  221. onload: function (data) {
  222. if(data.status==200){
  223. if(data.response.success.success==1){
  224. p.innerHTML+='<font style="color:green">成功!</font>';
  225. unfC++;
  226. }else{
  227. p.innerHTML+='<font style="color:red">失败!</font>';
  228. }
  229. }else{
  230. p.innerHTML+='<font style="color:red">失败!</font>';
  231. }
  232. $("#ard")[0].innerHTML=`${i+1}`;
  233. if(i<curators.length-1){
  234. i++;
  235. setTimeout(()=>{unfollow_curators(curators,i)},1500);
  236. }else{
  237. let p=document.createElement("p");
  238. p.setAttribute("style", "font-size:15px");
  239. p.innerHTML=`取关所有鉴赏家完成,${unfC}个鉴赏家取关成功,${curators.length-unfC}个鉴赏家取关失败!<a href="https://store.steampowered.com/curators/mycurators/" target="_blank" style="cursor:pointer">点此</a>查看结果`;
  240. unfC=0;
  241. $("#info").append(p);
  242. p.scrollIntoView();
  243. }
  244. }
  245. });
  246. }
  247.  
  248. //获取关注游戏列表
  249. function get_follow_games(){
  250. let p=document.createElement("p");
  251. p.setAttribute("style", "font-size:15px");
  252. p.innerHTML=`获取已关注游戏列表...`;
  253. $("#info").append(p);
  254. p.scrollIntoView();
  255.  
  256. let url=steam64ID?("https://steamcommunity.com/profiles/"+steam64ID+"/followedgames/?t="+new Date().getTime()):("https://steamcommunity.com/id/"+userName+"/followedgames/?t="+new Date().getTime());
  257. GM_xmlhttpRequest({
  258. method: "GET",
  259. url: url,
  260. timeout: 1000*30,
  261. onload: function (data) {
  262. console.log(data);
  263. if(data.status==200){
  264. p.innerHTML+='<font style="color:green">成功!</font>';
  265. let followGame=data.responseText.match(/\<div class=\"gameListRowItemName\"\>\<a .*?\>[\w\W]*?\<\/a\>\<\/div\>/gim);
  266. if(followGame&&(followGame.length>0)){
  267. GM_setValue('session_id',data.responseText.match(/g_sessionID = \"(.+?)\";/)[1]);
  268. let gameList=unique(followGame.map((e)=>{
  269. return {'id':e.match(/app\/[\d]+?\"/gim)[0].match(/[\d]+/gim)[0],'name':e.replace(/\<div class=\"gameListRowItemName\"\>/gim,"").match(/\>[\w\W]+?\</gim)[0].replace(/\<|\>/gim,"")}
  270. }));
  271. let checkbox='';
  272. for(let i=0;i<gameList.length;i++){
  273. checkbox+=`<p class="checkbox"><input type="checkbox" name="${gameList[i].name}" value="${gameList[i].id}"><a href="https://steamcommunity.com/app/${gameList[i].id}" target="_blank">${gameList[i].name}</a></p>`;
  274. }
  275. $("#setting").html(checkbox);
  276.  
  277. $(".next").addClass("disabled");
  278. $("#unf_g").removeClass("disabled");
  279. }else{
  280. p.innerHTML+="<br/>关注游戏列表为空!";
  281. p.scrollIntoView();
  282. }
  283. }else{
  284. p.innerHTML+='<font style="color:green">失败!</font>请刷新重试';
  285. }
  286. }
  287. });
  288. }
  289. //取关游戏
  290. function unfollow_games(games,i=0){
  291. i==0?$("#pro")[0].innerHTML=`取关游戏进度: <font id="ard">${i}</font> / ${games.length}`:$("#ard")[0].innerHTML=`${i}`;
  292.  
  293. let gameId=games[i].id;
  294. let gameName=games[i].name;
  295. let p=document.createElement("p");
  296. p.innerHTML=`取关游戏<a style="cursor:pointer" href="https://store.steampowered.com/app/${gameId}" target="_blank">${gameName}</a>...`;
  297. $("#info").append(p);
  298. p.scrollIntoView();
  299.  
  300. GM_xmlhttpRequest({
  301. method : "POST",
  302. url: "https://steamcommunity.com/app/"+gameId+"/stopfollowing",
  303. timeout: 1000*30,
  304. headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
  305. data:`sessionid=${GM_getValue('session_id')}`,
  306. onload: function (data) {
  307. if(data.status==200&&(data.responseText=='null')){
  308. p.innerHTML+='<font style="color:green">成功!</font>';
  309. unfG++;
  310. }else{
  311. p.innerHTML+='<font style="color:red">失败!</font>';
  312. }
  313. $("#ard")[0].innerHTML=`${i+1}`;
  314. if(i<games.length-1){
  315. i++;
  316. setTimeout(()=>{unfollow_games(games,i)},1500);
  317. }else{
  318. let p=document.createElement("p");
  319. p.setAttribute("style", "font-size:15px");
  320. p.innerHTML=`取关所有游戏完成,${unfG}个游戏取关成功,${games.length-unfG}个游戏取关失败!<a href="https://steamcommunity.com/id/${userName}/followedgames/" target="_blank" style="cursor:pointer">点此</a>查看结果`;
  321. unfG=0;
  322. $("#info").append(p);
  323. p.scrollIntoView();
  324. }
  325. }
  326. });
  327. }
  328.  
  329. //获取愿望单列表
  330. function get_wishlist(){
  331. let p=document.createElement("p");
  332. p.setAttribute("style", "font-size:15px");
  333. p.innerHTML=`获取愿望单列表...`;
  334. $("#info").append(p);
  335. p.scrollIntoView();
  336.  
  337. GM_xmlhttpRequest({
  338. method: "GET",
  339. url: "https://store.steampowered.com/dynamicstore/userdata/?id="+userName+"&t="+new Date().getTime(),
  340. timeout: 1000*30,
  341. responseType: "json",
  342. onload: function (data) {
  343. //console.log(data);
  344. if(data.status==200){
  345. let wishlistGame=data.response.rgWishlist;
  346. let checkbox='';
  347. for(let i=0;i<wishlistGame.length;i++){
  348. checkbox+=`<p class="checkbox"><input type="checkbox" name="${wishlistGame[i]}" value="${wishlistGame[i]}"><a href="https://steamcommunity.com/app/${wishlistGame[i]}" target="_blank">${wishlistGame[i]}</a></p>`;
  349. }
  350. $("#setting").html(checkbox);
  351. p.innerHTML+='<font style="color:green">成功!</font>';
  352.  
  353. if(wishlistGame.length>0){
  354. $(".next").addClass("disabled");
  355. $("#rem_g").removeClass("disabled");
  356. }else{
  357. p.innerHTML+="<br/>愿望单为空!";
  358. p.scrollIntoView();
  359. }
  360. }else{
  361. p.innerHTML+='<font style="color:green">失败!</font>请刷新重试';
  362. }
  363. }
  364. });
  365. }
  366. //移除愿望单
  367. function remove_wishlist(wishlist,i=0){
  368. i==0?$("#pro")[0].innerHTML=`取关游戏进度: <font id="ard">${i}</font> / ${wishlist.length}`:$("#ard")[0].innerHTML=`${i}`;
  369.  
  370. let gameId=wishlist[i];
  371. let p=document.createElement("p");
  372. p.innerHTML=`移除游戏<a style="cursor:pointer" href="https://store.steampowered.com/app/${gameId}" target="_blank">${gameId}</a>...`;
  373. document.getElementById("info").appendChild(p);
  374. p.scrollIntoView();
  375.  
  376. GM_xmlhttpRequest({
  377. method : "POST",
  378. url: "https://store.steampowered.com/wishlist/profiles/"+userName+"/remove/",
  379. timeout: 1000*30,
  380. cache: false,
  381. responseType: "json",
  382. headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
  383. data:`appid=${gameId}&sessionid=${g_sessionID}`,
  384. onload: function (data) {
  385. if(data.status==200){
  386. if(data.response.success==1){
  387. p.innerHTML+='<font style="color:green">成功!</font>';
  388. remG++;
  389. }else{
  390. p.innerHTML+='<font style="color:red">失败!</font>';
  391. }
  392. }else{
  393. p.innerHTML+='<font style="color:red">失败!</font>';
  394. }
  395. $("#ard")[0].innerHTML=`${i+1}`;
  396. if(i<wishlist.length-1){
  397. i++;
  398. setTimeout(()=>{remove_wishlist(wishlist,i)},1500);
  399. }else{
  400. let p=document.createElement("p");
  401. p.setAttribute("style", "font-size:15px");
  402. p.innerHTML=`移除愿望单游戏完成,${remG}个游戏移除成功,${wishlist.length-remG}个游戏移除失败!<a href="https://store.steampowered.com/wishlist/id/${userName}" target="_blank" style="cursor:pointer">点此</a>查看结果`;
  403. remG=0;
  404. $("#info").append(p);
  405. p.scrollIntoView();
  406. }
  407. }
  408. });
  409. }
  410.  
  411. //一键取关+移除愿望单
  412. function getAppid(){
  413. return url.replace("https://store.steampowered.com/app/","").match(/[\d]+?\//)[0].replace("/","");
  414. }
  415. function removeWishlist(){
  416. $.ajax({
  417. type: "post",
  418. url: "https://store.steampowered.com/wishlist/profiles/"+steam64ID+"/remove/",
  419. datatype: "json",
  420. cache: false,
  421. data:{
  422. sessionid:g_sessionID,
  423. appid:getAppid(),
  424. },
  425. crossDomain:true,
  426. xhrFields: {
  427. withCredentials: true
  428. },
  429. success: function (data) {
  430. if(data.success==true){
  431. if($("#add_to_wishlist_area").length>0){
  432. $("#add_to_wishlist_area").show();
  433. }else{
  434. let btn=$("a.queue_btn_active:contains('已在愿望单中')");
  435. btn.removeClass("queue_btn_active");
  436. btn.html("<span>已移除</span>");
  437. }
  438. $("#add_to_wishlist_area_success").hide();
  439. }
  440. },
  441. });
  442. }
  443. function unFollow(){
  444. $.ajax({
  445. type: "post",
  446. url: '//store.steampowered.com/explore/followgame/',
  447. datatype: "json",
  448. cache: false,
  449. data:{
  450. sessionid:g_sessionID,
  451. appid:getAppid(),
  452. unfollow: '1',
  453. },
  454. crossDomain:true,
  455. xhrFields: {
  456. withCredentials: true
  457. },
  458. success: function (data) {
  459. if(data==true){
  460. $("div.queue_control_button.queue_btn_follow>.queue_btn_inactive").show();
  461. $("div.queue_control_button.queue_btn_follow>.queue_btn_active").hide();
  462. }
  463. }
  464. });
  465. }
  466. $("p.checkbox input:checkbox").click(()=>{
  467. $("#selectAll").attr("checked", false);
  468. });
  469. $("#selectAll").click(function() {
  470. let thisChexk=this.checked;
  471. $("p.checkbox input:checkbox").each(function() {
  472. $(this).attr("checked", thisChexk);
  473. });
  474. });
  475. $("#reverse").click(function() {
  476. $("#selectAll").attr("checked", false);
  477. $("p.checkbox input:checkbox").each(function() {
  478. this.checked = !this.checked;
  479. });
  480. });
  481.  
  482.  
  483. //数组去重
  484. function unique(arr){
  485. return [...new Set(arr)];
  486. }
  487.  
  488. GM_addStyle(`
  489. #output {
  490. background-color: #1e3a4c;
  491. border-radius: 3px;
  492. border: 1px solid rgba( 0, 0, 0, 0.3);
  493. box-shadow: 1px 1px 0px rgba( 255, 255, 255, 0.2);
  494. color: #fff;
  495. margin: 0 55px 0 45px;
  496. height: 320px;
  497. padding: 0 5px;
  498. }
  499.  
  500. #setting {
  501. width: 50%;
  502. height: 100%;
  503. position: relative;
  504. overflow-y: auto;
  505. overflow-x: hidden;
  506. }
  507.  
  508. #info {
  509. position: relative;
  510. left: 50%;
  511. top: -320px;
  512. width: 50%;
  513. height: 100%;
  514. border-left-style: dashed;
  515. padding-left: 5px;
  516. overflow-y: auto;
  517. overflow-x: hidden;
  518. }
  519.  
  520. .checkbox,#info p {
  521. font-size: 15px;
  522. }
  523.  
  524. h4.checkbox {
  525. bottom: -10px;
  526. z-index: 99999;
  527. margin: 10px 45px;
  528. }
  529.  
  530. .btn_wrapper {
  531. margin: 2px 0;
  532. margin-right: 8px;
  533. display: inline-block;
  534. }
  535.  
  536. .disabled {
  537. cursor: not-allowed !important;
  538. background: #6b7373 !important;
  539. color: #8da5a5 !important;
  540. }
  541.  
  542. .disabled:hover {
  543. cursor: not-allowed !important;
  544. background: #6b7373 !important;
  545. color: #8da5a5 !important;
  546. }
  547.  
  548. .big_button {
  549. cursor: pointer;
  550. width: 226px;
  551. height: 29px;
  552. font-family: "Motiva Sans", Sans-serif;
  553. font-weight: 300;
  554. display: inline-block;
  555. font-size: 18px;
  556. line-height: 28px;
  557. color: #66c0f4;
  558. text-align: center;
  559. background-image: url(//steamstore-a.akamaihd.net/public/images/v6/home/background_spotlight.jpg);
  560. background-position-y: -105px;
  561. border-radius: 3px;
  562. box-shadow: 0 0 4px #000;
  563. }
  564.  
  565. .queue_btn_remove {
  566. padding-left: 5px;
  567. }
  568. `);
  569.  
  570. })(jQuery);

QingJ © 2025

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