SteamGifts ESGST
Convert "ESGST-53-43-6b-61-48" to proper URL (see https://github.com/revilheart/ESGST/blob/master/ESGST.user.js, decodeGiveawayCode func)
by Anton
HTML
<input id="text" type="text" value="ESGST-53-43-6b-61-48"/>
<button id="convert">
Convert
</button>
<br><a id="link" href="">Link</a>
CSS
#link {
display: none;
}
JavaScript
$('#convert').on('click', () => {
var text = $('#text').val(),
arr = text.split('-'),
code = [],
link = 'https://www.steamgifts.com/giveaway/';
arr.forEach((a, i) => {
if(i > 0) { // Skip "ESGST" part
var b = String.fromCharCode(parseInt(a, 16));
console.log(a + ' → ' + b);
code.push(b);
}
});
$('#link').show().attr(
'href',
link + rot(code.join(''), 13) + '/'
);
});
function rot(string, n) {
return string.replace(/[a-zA-Z]/g, function (char) {
return String.fromCharCode(((char <= `Z`) ? 90 : 122) >= ((char = char.charCodeAt(0) + n)) ? char : (char - 26));
});
}