Skip to content

Commit

Permalink
Update index.html (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
gamer2810 authored May 28, 2024
1 parent a6f4f3d commit f448c8f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,35 @@
let searchParams = new URLSearchParams(window.location.search);
let corsHost = "https://steam-miniprofile-cors.glitch.me/"
let steamId = searchParams.get('accountId') ? searchParams.get('accountId') : '238158335';
let interactive = searchParams.get('interactive') ? searchParams.get('lang') : false;
let vanityId = searchParams.get('vanity') ? searchParams.get('vanityId') : '';
// For list of available languages, check out README on https://github.com/gamer2810/steam-miniprofile
let language = searchParams.get('lang') ? searchParams.get('lang') : 'english';
let corsURL = `${corsHost}https%3A%2F%2Fsteamcommunity.com%2Fminiprofile%2F${steamId}?l=${language}`;
let steamURL = `https://steamcommunity.com/id/{vanityId}`;

if(steamId === 'YOUR_ACCOUNTID_HERE') {
steamId = '238158335';
}

$.get(`${corsHost}https%3A%2F%2Fsteamcommunity.com%2Fminiprofile%2F${steamId}?l=${language}`, function (data) {
$.get(corsURL, function (data) {
$("#includedContent").html(data).hide();
if ($("#includedContent").children().text().length != 0) {
$(".default").fadeOut("fast", function () {
$(".default").replaceWith(data);
$(".default").fadeIn("fast");
});
}

if(interactive && vanityId != null) {
$('#includedContent').on('click', function(e){
e.preventDefault();
var url = $(this).attr('href');
window.open(steamURL, '_blank');
});
}
});

});
</script>
</head>
Expand Down

0 comments on commit f448c8f

Please sign in to comment.