Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
before submit
  • Loading branch information
yuh19027 committed May 6, 2020
1 parent 28900f5 commit 0fd66e4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
3 changes: 1 addition & 2 deletions final/css/main.css
Expand Up @@ -125,9 +125,8 @@ div > span > h2{
div:not(.Me) > span > p{

margin-top: 5px;
margin-right: 0;
background-color: #f9d861;
-webkit-border-radius: 8px;
-webkit-border-top-left-radius: 0;
-moz-border-radius: 8px;
-moz-border-radius-topleft: 0;
border-radius: 8px;
Expand Down
28 changes: 23 additions & 5 deletions final/js/main.js
Expand Up @@ -27,10 +27,27 @@ let inputBox = document.querySelector("#newmsg");
let curr_date = new Date();
let month = curr_date.getMonth() + 1;
let dateStr = month.toString() + "/" + curr_date.getDate().toString() + "/" + curr_date.getFullYear().toString();


let realTime = new Date();
let hours = realTime.getHours();
let minutes = realTime.getMinutes();

//Add AM and PM system
let amPm = (hours < 12 ) ? "AM" : "PM";
//convert the hours component to 12-hour format
hours = (hours > 12) ? hours - 12 : hours;
//pad the hours, minutes and seconds with leading zeros
hours = ("0" + hours).slice(-2);
minutes = ("0" + minutes).slice(-2);
let timeStr = hours + ":" + minutes + " " + amPm;

let curr_time = new Date();
let timeStr = curr_time.getHours().toString() + ":" + curr_time.getMinutes().toString();
// document.getElementById("time").innerHTML = timeStr;
// //Display the time
// document.getElementById('clock').innerHTML =
// hours + " : " + minutes + " " + amPm;
// var t = setTimeout(displayTime, 500);

// }

function makeMessage(msg) {

Expand All @@ -49,7 +66,7 @@ function makeMessage(msg) {


name.innerHTML=msg.sentBy;
timeStamp.innerHTML=msg.timeStr + " " + msg.dateStr;
timeStamp.innerHTML=timeStr + " " + dateStr;
message.innerHTML=msg.message;


Expand Down Expand Up @@ -85,8 +102,9 @@ document.querySelector("#sendBtn").addEventListener('click', () => {

let userMsg = {
sentBy: localStorage.userName,
//dateStamp: date_str,
dateStr: month.toString() + "/" + curr_date.getDate().toString() + "/" + curr_date.getFullYear().toString(),
// timeStr: curr_time.getHours().toString() + ":" + curr_time.getMinutes().toString(),
timeStamp: msg.timeStr + " " + msg.dateStr,
message: msg

}
Expand Down
6 changes: 3 additions & 3 deletions final/js/profile.js
@@ -1,7 +1,7 @@

let userName = localStorage.getItem('userName') || "Yucheng";
let userStatus = localStorage.getItem('userStatus') || "update your profile to display a status";
let userProfilePic = localStorage.getItem('userProfilePic') || "profile.png" ;
let userName = localStorage.getItem('userName') || "Username";
let userStatus = localStorage.getItem('userStatus') || "Status";
let userProfilePic = localStorage.getItem('userProfilePic') || "imgs/change-profile.png" ;
let usernameInput = document.querySelector("#usernameInput");
let statusInput = document.querySelector("#statusInput");
// let emailInput = document.querySelector("#emailInput");
Expand Down

0 comments on commit 0fd66e4

Please sign in to comment.