Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function encodeImageFileAsURL(callback) {
- var input = document.createElement('input');
- input.type = 'file';
- input.onchange = (e) => {
- var reader = new FileReader();
- reader.onloadend = function() {
- callback(reader.result);
- }
- reader.readAsDataURL(e.target.files[0]);
- }
- input.click();
- }
- function sendRequest(data){
- var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance
- var theUrl = 'https://www.geoguessr.com/api/v4/avatar';
- xmlhttp.open("POST", theUrl);
- xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
- xmlhttp.send(JSON.stringify({
- "skin": 6,
- "equippedIds": [],
- "mugshotPin": data,
- "fullBodyPin": data,
- }));
- }
- encodeImageFileAsURL(d => sendRequest(d));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement