Greasy Fork is available in English.

Steam Info

快速查询Steam游戏信息

Stan na 08-08-2015. Zobacz najnowsza wersja.

// ==UserScript==
// @name        Steam Info
// @namespace   http://userscripts.org/users/deparsoul
// @description 快速查询Steam游戏信息
// @include     http://steamdb.sinaapp.com/sync
// @grant       GM_xmlhttpRequest
// @version     0.36
// ==/UserScript==

if(document.URL == 'http://steamdb.sinaapp.com/sync'){
    exec('setScriptVersion('+addslashes(GM_info.script.version)+')');
    
    var nocache = '_='+Math.floor(Math.random()*100000);
    load('http://steamcommunity.com/my/games?tab=all', 'own');
    load('http://store.steampowered.com/dynamicstore/userdata/?'+nocache, 'userdata');
    load('http://www.desura.com/games/ajax/json/all?collection=t&'+nocache, 'desura');
}else{
    var script = document.createElement("script");
    script.setAttribute("src", "http://steamdb.sinaapp.com/steam_info.js");
    document.body.appendChild(script);
}

//Script Injection
function exec(fn) {
    var script = document.createElement('script');
    script.setAttribute("type", "application/javascript");
    script.textContent = fn;
    document.body.appendChild(script);
    document.body.removeChild(script);
}

//Load url and call proc function
function load(url, id){
    GM_xmlhttpRequest({
        method: "GET",
        url: url,
        onload: function(response) {
            exec('proc_'+id+'("'+addslashes(response.responseText)+'")');
        }
    });
}

//Add slashes to string
function addslashes(string) {
    return string.replace(/\\/g, '\\\\').
        replace(/\u0008/g, '\\b').
        replace(/\t/g, '\\t').
        replace(/\n/g, '\\n').
        replace(/\f/g, '\\f').
        replace(/\r/g, '\\r').
        replace(/'/g, '\\\'').
        replace(/"/g, '\\"');
}