-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
21 lines (16 loc) · 1.28 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
To have the id of the player I use the site:
https://api.year4000.net/minecraft/𝘶𝘴𝘦𝘳𝘯𝘢𝘮𝘦
Then I display the head of the player with the site :
https://crafatar.com/avatars/𝘪𝘥
?overlay&size=512" corresponds to the overlay setting (to display the 1.8 skin textures) and the render size
*/
document.querySelector("#nameinput").oninput = function(){ /* The '𝘰𝘯𝘪𝘯𝘱𝘶𝘵' event executes JavaScript when the user writes
something to an input. */
var request = new XMLHttpRequest();request.onload = function(){/* XMLHttpRequest creation and starting the function */
var uuid=JSON.parse(request.responseText).id;
if(typeof(uuid)=="undefined"){uuid="8667ba71-b85a-4004-af54-457a9734eed7";} /* 𝘞𝘩𝘦𝘯 𝘵𝘩𝘦 𝘶𝘴𝘦𝘳 𝘩𝘢𝘴𝘯'𝘵 𝘱𝘶𝘵 𝘶𝘶𝘪𝘥 */
document.getElementById("head").src="https://crafatar.com/avatars/"+uuid+"?overlay&size=512";
document.getElementById("iconID").href="https://crafatar.com/avatars/"+uuid+"?overlay&size=512";};
request.open("GET","https://api.year4000.net/minecraft/"+document.querySelector("#nameinput").value,true);
request.send();}