Skip to main content
4 of 5
Updated to use a new, more appropriate API value

###Oneboxing Steam Store links

customSites['store.steampowered.com'] = function(link, $obj) { // http://store.steampowered.com/app/377840/
    $('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/shu8/SE-Chat-Custom-Oneboxes/a043cfaae462d918f94558e188749089ef9d97cb/steam.css">');
    var id = link.split('/')[4];
    $.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22"+encodeURIComponent('http://store.steampowered.com/api/appdetails?appids='+id)+"%22&format=json&diagnostics=true&callback=", function(d) {
        data = d.query.results['_'+id.slice(1)].data;  
        tags = '';
        $.each(data.categories, function() { tags += '<span class="ob-post-tag">' + $(this)[0].description + '</span>'; })
        var template = "<div class='steam-container'> \
                            <img src='"+data.header_image+"' /> \
                            <div class='title'><a href='"+link+"'>"+data.name+"</a></div> \
                            <div class='tags'>" + tags + "</div> \
                            <div class='desc'>"+data.short_description+"</div> \
                        </div>";
        $obj.html(template);
    }); 
};
ᔕᖺᘎᕊ
  • 4.4k
  • 2
  • 16
  • 37