Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
integrity="sha256-nWBTbvxhJgjslRyuAKJHK+XcZPlCnmIAAMixz6EefVk="
crossorigin="anonymous"
></script>
<script src=script.js></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
Expand Down Expand Up @@ -89,9 +90,10 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisee gravida sem sit amet molestie porttitor.
</p>
</li>

<li class="write-new">
<form action="#" method="post">
<div align= "center">
<form >
<textarea placeholder="Write your comment here" name="comment"></textarea>

<div>
Expand All @@ -101,10 +103,12 @@
alt="Profile of Bradley Jones"
title="Bradley Jones"
/>
<button type="submit">Submit</button>
<button type="button" onclick ="Additem()">Submit</button>
</div>
</form>
</div>
</li>
</ul>

</body>
</html>
41 changes: 41 additions & 0 deletions src/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function Additem(){
let li= document.createElement('li');
li.classList.add("comment");
li.classList.add('author-comment');

var div = document.createElement('div');
div.classList.add('info');

var span= document.createElement('span');

div.innerHTML='<a href="#">Jack Smith</a>';
div.appendChild(span);
li.appendChild(div);

li.innerHTML ='<a class="avatar" href="#"><img src="https://api.adorable.io/avatars/285/avatar_user_3.png" width="35" alt="Profile Avatar" title="Jack Smith"></a>'
let para=document.createElement('p');

para.innerHTML = document.getElementsByTagName('textarea')[0].value;

li.appendChild(para);

var box = document.getElementsByClassName('write-new')[0];
var ul = document.getElementsByTagName('ul')[0];
ul.insertBefore(li,box);


function datetime(){
start_date /=1000;

var seconds= Math.round(start_date);

var timeText;

if(seconds <60){
timeTt = seconds+"sec" +(seconds < 2 ? " ": "s")+"ago";

}
span.innerHTML= "10 minutes ago";
}

}
7 changes: 7 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ html {
overflow: hidden;
white-space: nowrap;
padding: 10px 0 3px 0;
font-weight: bold;
color: black;

}

.comment .info span {
Expand Down Expand Up @@ -95,14 +98,18 @@ html {
width: 50%;
position: relative;
word-wrap: break-word;
color: black;
}

.comment.user-comment p {
background-color: #f3f3f3;
color: black;
}

.comment.author-comment p {
/* change background color to light blue */
background-color: lightblue;

order: 1;
}

Expand Down