// ==UserScript== // @name Steam Blocked Helper // @name:zh-CN Steam队列锁区辅助 // @namespace https://store.steampowered.com/agecheck/app/* // @version 0.3.3 // @description Add action buttons to the blocked games and remove them from the queue // @description:zh-CN 为锁区的游戏添加按钮选项并从队列中移除 // @author wweeiiyyiinn // @match https://store.steampowered.com/agecheck/app/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function createElement(tag, attr){ var elm = document.createElement(tag); Object.keys(attr||{}).forEach(function(i){elm[i] = attr[i];}); return elm; } function load_script(){ var gamejs = createElement('script', {type: "text/javascript", src: "https://steamstore-a.akamaihd.net/public/javascript/game.js"}); document.head.appendChild(gamejs); function loadcss(href){ var css = createElement('link', {rel:'stylesheet', type:'text/css', href: href}); document.head.appendChild(css); } loadcss('https://steamstore-a.akamaihd.net/public/css/v6/game.css'); loadcss('https://steamstore-a.akamaihd.net/public/shared/css/buttons.css'); } function add_actions(){ function init() { if (window.InitQueueControls && document.getElementById('add_to_wishlist_area')){ window.InitQueueControls(Number(appid), Number(appid), 955560, '1_5_9_'); } else { setTimeout(init, 50); } } init(); } function check_wishlist(){ var wishlist = createElement('html'); window.jQuery.get("https://store.steampowered.com/wishlist/", function(data){ var listJson = data.match(/var g_rgWishlistData = (\[[^\]]+\])/)[1]; var re = new RegExp('"appid":'+appid+','); if (listJson.match(re)) { $JFromIDOrElement('add_to_wishlist_area').hide(); $JFromIDOrElement('add_to_wishlist_area_success').show(); } }); } function add_UI(appid){ function get_cn_buttons(){ return ('
' + '' + '查看您的队列   ' + '' + '' + '' + '' + '
' + '
关注
' + '' + '
' + '
' + '
忽略
' + '' + '
' + '
' + '查看 Steam Database' + '
'); } function get_en_buttons(){ return ('
' + '' + 'View Your Queue   ' + '' + '' + '' + '' + '
' + '
Follow
' + '' + '
' + '
' + '
Ignore
' + '' + '
' + '
' + 'View in Steam Database' + '
'); } function add_buttons(){ var buttonsHTML; if (document.children[0].lang === 'zh-cn') { buttonsHTML = get_cn_buttons(); } else { buttonsHTML = get_en_buttons(); } var buttons = createElement('div', {classList: ['queue_overflow_ctn'], innerHTML: buttonsHTML.replace(/appid/g, appid)}); box.style.paddingBottom = '0px'; content.appendChild(buttons); } function add_header_img(){ var headerImg = createElement('img', {src: 'https://steamcdn-a.akamaihd.net/steam/apps/appid/header.jpg'.replace('appid', appid)}); content.appendChild(headerImg); } var box = document.getElementById('error_box'); var content = box.parentElement; if (isLogin) { load_script(); add_buttons(); add_actions(); check_wishlist(); } add_header_img(); } function remove_from_queue(appid){ window.jQuery.post("/app/7", { sessionid: window.g_sessionID, appid_to_clear_from_queue: appid }); } if (!document.title.match(/Steam/)){ var appid = location.href.match(/\/app\/(\d+)\//)[1]; var isLogin = Boolean(document.getElementById('account_pulldown')); if (isLogin){ remove_from_queue(appid); } add_UI(appid); } })();