From f448c8fe6613603643f21bbc25f29d6dc75d0ed5 Mon Sep 17 00:00:00 2001 From: K3K <45266477+gamer2810@users.noreply.github.com> Date: Tue, 28 May 2024 11:06:24 +0700 Subject: [PATCH] Update index.html (#13) --- index.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 4f7cd67..b49ca0c 100644 --- a/index.html +++ b/index.html @@ -20,13 +20,18 @@ 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 () { @@ -34,7 +39,16 @@ $(".default").fadeIn("fast"); }); } + + if(interactive && vanityId != null) { + $('#includedContent').on('click', function(e){ + e.preventDefault(); + var url = $(this).attr('href'); + window.open(steamURL, '_blank'); + }); + } }); + });