/gim,"").match(/\>[\w\W]+?\/gim,"")}
}));
let checkbox='';
for(let i=0;i
${gameList[i].name}`;
}
$("#setting").html(checkbox);
$(".next").addClass("disabled");
$("#unf_g").removeClass("disabled");
}else{
p.innerHTML+="
关注游戏列表为空!";
p.scrollIntoView();
}
}else{
p.innerHTML+='失败!请刷新重试';
}
}
});
}
//取关游戏
function unfollow_games(games,i=0){
i==0?$("#pro")[0].innerHTML=`取关游戏进度: ${i} / ${games.length}`:$("#ard")[0].innerHTML=`${i}`;
let gameId=games[i].id;
let gameName=games[i].name;
let p=document.createElement("p");
p.innerHTML=`取关游戏${gameName}...`;
$("#info").append(p);
p.scrollIntoView();
GM_xmlhttpRequest({
method : "POST",
url: "https://steamcommunity.com/app/"+gameId+"/stopfollowing",
timeout: 1000*30,
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
data:`sessionid=${GM_getValue('session_id')}`,
onload: function (data) {
if(data.status==200&&(data.responseText=='null')){
p.innerHTML+='成功!';
unfG++;
}else{
p.innerHTML+='失败!';
}
$("#ard")[0].innerHTML=`${i+1}`;
if(i{unfollow_games(games,i)},1500);
}else{
let p=document.createElement("p");
p.setAttribute("style", "font-size:15px");
p.innerHTML=`取关所有游戏完成,${unfG}个游戏取关成功,${games.length-unfG}个游戏取关失败!点此查看结果`;
unfG=0;
$("#info").append(p);
p.scrollIntoView();
}
}
});
}
//获取愿望单列表
function get_wishlist(){
let p=document.createElement("p");
p.setAttribute("style", "font-size:15px");
p.innerHTML=`获取愿望单列表...`;
$("#info").append(p);
p.scrollIntoView();
GM_xmlhttpRequest({
method: "GET",
url: "https://store.steampowered.com/dynamicstore/userdata/?id="+userName+"&t="+new Date().getTime(),
timeout: 1000*30,
responseType: "json",
onload: function (data) {
//console.log(data);
if(data.status==200){
let wishlistGame=data.response.rgWishlist;
let checkbox='';
for(let i=0;i${wishlistGame[i]}`;
}
$("#setting").html(checkbox);
p.innerHTML+='成功!';
if(wishlistGame.length>0){
$(".next").addClass("disabled");
$("#rem_g").removeClass("disabled");
}else{
p.innerHTML+="
愿望单为空!";
p.scrollIntoView();
}
}else{
p.innerHTML+='失败!请刷新重试';
}
}
});
}
//移除愿望单
function remove_wishlist(wishlist,i=0){
i==0?$("#pro")[0].innerHTML=`取关游戏进度: ${i} / ${wishlist.length}`:$("#ard")[0].innerHTML=`${i}`;
let gameId=wishlist[i];
let p=document.createElement("p");
p.innerHTML=`移除游戏${gameId}...`;
document.getElementById("info").appendChild(p);
p.scrollIntoView();
GM_xmlhttpRequest({
method : "POST",
url: "https://store.steampowered.com/wishlist/profiles/"+userName+"/remove/",
timeout: 1000*30,
cache: false,
responseType: "json",
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
data:`appid=${gameId}&sessionid=${g_sessionID}`,
onload: function (data) {
if(data.status==200){
if(data.response.success==1){
p.innerHTML+='成功!';
remG++;
}else{
p.innerHTML+='失败!';
}
}else{
p.innerHTML+='失败!';
}
$("#ard")[0].innerHTML=`${i+1}`;
if(i{remove_wishlist(wishlist,i)},1500);
}else{
let p=document.createElement("p");
p.setAttribute("style", "font-size:15px");
p.innerHTML=`移除愿望单游戏完成,${remG}个游戏移除成功,${wishlist.length-remG}个游戏移除失败!点此查看结果`;
remG=0;
$("#info").append(p);
p.scrollIntoView();
}
}
});
}
//一键取关+移除愿望单
function getAppid(){
return url.replace("https://store.steampowered.com/app/","").match(/[\d]+?\//)[0].replace("/","");
}
function removeWishlist(){
$.ajax({
type: "post",
url: "https://store.steampowered.com/wishlist/profiles/"+steam64ID+"/remove/",
datatype: "json",
cache: false,
data:{
sessionid:g_sessionID,
appid:getAppid(),
},
crossDomain:true,
xhrFields: {
withCredentials: true
},
success: function (data) {
if(data.success==true){
if($("#add_to_wishlist_area").length>0){
$("#add_to_wishlist_area").show();
}else{
let btn=$("a.queue_btn_active:contains('已在愿望单中')");
btn.removeClass("queue_btn_active");
btn.html("已移除");
}
$("#add_to_wishlist_area_success").hide();
}
},
});
}
function unFollow(){
$.ajax({
type: "post",
url: '//store.steampowered.com/explore/followgame/',
datatype: "json",
cache: false,
data:{
sessionid:g_sessionID,
appid:getAppid(),
unfollow: '1',
},
crossDomain:true,
xhrFields: {
withCredentials: true
},
success: function (data) {
if(data==true){
$("div.queue_control_button.queue_btn_follow>.queue_btn_inactive").show();
$("div.queue_control_button.queue_btn_follow>.queue_btn_active").hide();
}
}
});
}
$("p.checkbox input:checkbox").click(()=>{
$("#selectAll").attr("checked", false);
});
$("#selectAll").click(function() {
let thisChexk=this.checked;
$("p.checkbox input:checkbox").each(function() {
$(this).attr("checked", thisChexk);
});
});
$("#reverse").click(function() {
$("#selectAll").attr("checked", false);
$("p.checkbox input:checkbox").each(function() {
this.checked = !this.checked;
});
});
//数组去重
function unique(arr){
return [...new Set(arr)];
}
GM_addStyle(`
#output {
background-color: #1e3a4c;
border-radius: 3px;
border: 1px solid rgba( 0, 0, 0, 0.3);
box-shadow: 1px 1px 0px rgba( 255, 255, 255, 0.2);
color: #fff;
margin: 0 55px 0 45px;
height: 320px;
padding: 0 5px;
}
#setting {
width: 50%;
height: 100%;
position: relative;
overflow-y: auto;
overflow-x: hidden;
}
#info {
position: relative;
left: 50%;
top: -320px;
width: 50%;
height: 100%;
border-left-style: dashed;
padding-left: 5px;
overflow-y: auto;
overflow-x: hidden;
}
.checkbox,#info p {
font-size: 15px;
}
h4.checkbox {
bottom: -10px;
z-index: 99999;
margin: 10px 45px;
}
.btn_wrapper {
margin: 2px 0;
margin-right: 8px;
display: inline-block;
}
.disabled {
cursor: not-allowed !important;
background: #6b7373 !important;
color: #8da5a5 !important;
}
.disabled:hover {
cursor: not-allowed !important;
background: #6b7373 !important;
color: #8da5a5 !important;
}
.big_button {
cursor: pointer;
width: 226px;
height: 29px;
font-family: "Motiva Sans", Sans-serif;
font-weight: 300;
display: inline-block;
font-size: 18px;
line-height: 28px;
color: #66c0f4;
text-align: center;
background-image: url(//steamstore-a.akamaihd.net/public/images/v6/home/background_spotlight.jpg);
background-position-y: -105px;
border-radius: 3px;
box-shadow: 0 0 4px #000;
}
.queue_btn_remove {
padding-left: 5px;
}
`);
})(jQuery);