Skip to content
Permalink
44b673bf1b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
49 lines (38 sloc) 1.43 KB
let usernameInput = document.querySelector("#usernameInput");
let statusInput = document.querySelector("#statusInput");
let profilePicInput = document.querySelector("#profilePicInput");
let profileSaveInput = document.querySelector("#profileSaveInput");
let profilePicDisplayElement = document.querySelector("#profilePicDisplay")
let profilePic = localStorage.getItem("") //|| "unknown.jpg"
// setting the input values default
usernameInput.value = localStorage.getItem('username');
statusInput.value = localStorage.getItem('userStatus');
function saveProfileImageLocally() {
if (profilePicInput.files && profilePicInput.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
localStorage.setItem("userProfilePic", reader.result);
}
reader.readAsDataURL(profilePicInput.files[0]);
}
}
profileSaveInput.addEventListener( 'click', function(e) {
e.preventDefault();
localStorage.setItem("username", usernameInput.value);
localStorage.setItem("userStatus", statusInput.value);
saveProfileImageLocally();
});
function mew(){
let src = 'img/meow.mp3';
let audio = new Audio(src);
audio.play();
}
function savedProfile() {
alert("You have saved your profile, Congrats!")
var text = document.getElementById("showText");
if (text.style.display === "none") {
text.style.display = "block";
} else {
text.style.display = "none";
}
}