Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaverickDe committed Jun 16, 2022
1 parent 3236840 commit 5bebfbf
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 27 deletions.
31 changes: 23 additions & 8 deletions home.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
display: flex;
flex-direction: column;
align-items: center;
z-index: 6;

}

Expand Down Expand Up @@ -219,6 +220,14 @@

}

.room{
text-transform: capitalize;

}
.des{
text-transform: uppercase;
}




Expand Down Expand Up @@ -430,13 +439,16 @@
.connected-users>h4{
height: 50px;
margin-bottom: 10px;
text-align: center;
width: 100%;
border-bottom: 1px solid red;
}

.connected-users>div{
height: 50px;
width: 100%;
display: flex;


border-bottom: 1px solid blue;
align-items: center;
Expand Down Expand Up @@ -484,7 +496,10 @@

.message>h4{
height: 50px;
width: 100%;
text-align: center;
margin-bottom: 10px;
border-bottom: 1px solid red;
}

.message>div{
Expand Down Expand Up @@ -518,9 +533,9 @@
/* background-color: red; */
}
.message>div>fieldset>p{
max-width: 310px;
/* max-width: 310px; */

width:100%;
max-width:100%;
word-break: break-all;

background-color: rgb(255, 0, 119);
Expand Down Expand Up @@ -640,7 +655,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 6;
z-index: 5;
/* display: none; */
}

Expand Down Expand Up @@ -1035,7 +1050,7 @@ <h4>messages</h4>


<div class="_message_">
<fieldset>
<!-- <fieldset>
<legend>john</legend>
<p>hello
Expand All @@ -1046,16 +1061,16 @@ <h4>messages</h4>
<p>hello
Lorem ipsum, dolor sit amet consectetur adipisicing elit. In deserunt mollitia veniam cum fuga numquam ea soluta error aliquid ratione provident, sit quis facere, earum ad tenetur possimus debitis, odit dolor optio iusto qui dignissimos incidunt nemo. Cupiditate, earum id beatae saepe impedit, quis molestiae veritatis aliquam ea, consectetur pariatur laudantium hic necessitatibus debitis deleniti modi laboriosam veniam non natus laborum nihil? Exercitationem iure odit sunt fugiat a id? Rem velit nesciunt consequatur officiis qui optio quam dolores quae vero laborum quod, tempore corrupti mollitia cupiditate dolorem quasi non fuga possimus maiores unde, quo omnis, quis sunt totam? Possimus, aperiam.
</p>
</fieldset>
</fieldset> -->
</div>

</div>

<div class="type_message">
<textarea></textarea>
<textarea placeholder="send a message"></textarea>
<div>

<button class="send"></button>
<button class="send">send</button>
</div>

</div>
Expand Down
100 changes: 81 additions & 19 deletions public/home.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,69 @@


(async ()=>{


const main = document.querySelector(".main")

const submain = document.querySelector(".sub-main")
const submaindiv = submain.querySelectorAll(".sub-main1")

const options = document.querySelector(" .options")
const connected_users= document.querySelector(" .connected-users")
const comment_users = document.querySelector(" .comment_users")
const room= document.querySelector(".room")


const maindiv = [main,...submaindiv]
let clientxx = 0



document.addEventListener("touchstart",e=>{
clientxx = e.changedTouches[0].clientX

// comment_users.style.position= `absolute`


})

let clientmovexx = 0
document.addEventListener("touchmove",e=>{
clientmovexx = e.changedTouches[0].clientX





})


document.addEventListener("touchend",e=>{
if( clientxx >=window.innerWidth-250 ){
if(Math.sign(clientmovexx-clientxx) == -1 ){

comment_users.classList.add("comment_users_active")
options.classList.remove("options_active")
}else{
comment_users.classList.remove("comment_users_active")

}

}
if( clientxx <=150 ){
if(Math.sign(clientmovexx-clientxx) == 1 ){

comment_users.classList.remove("comment_users_active")
options.classList.add("options_active")
}else{
options.classList.remove("options_active")

}

}
console.log(Math.sign(clientmovexx-clientxx) == 1,clientxx,window.innerWidth-200)
})


function err(msg){
let errdiv = document.querySelector(".notification")
Expand Down Expand Up @@ -54,16 +117,9 @@


// return
const main = document.querySelector(".main")

const submain = document.querySelector(".sub-main")
const submaindiv = submain.querySelectorAll(".sub-main1")

const options = document.querySelector(" .options")
const connected_users= document.querySelector(" .connected-users")


const maindiv = [main,...submaindiv]



let socket =io()
let insession = false
let eventtt = {};
Expand Down Expand Up @@ -316,7 +372,7 @@

// ondragstart

const comment_users= document.querySelector(" .comment_users")
// const comment_users= document.querySelector(" .comment_users")

console.log(comment_users)

Expand Down Expand Up @@ -781,11 +837,7 @@

createandjoin.querySelector("button").addEventListener("click", async (e)=>{
e.preventDefault()
console.log(
createandjoindescription.innerText,
createandjoinname.innerText,

)

if(createandjoindescription.value==""||createandjoinname.value=="" || createandjoinroomname.value==""){
notification("input all fields")
return
Expand Down Expand Up @@ -1131,6 +1183,7 @@
</div>`
if(peercon!=""){
peercon.forEach(e=>{
room.innerHTML=""
if(e.rtc){
e.rtc.close()
}
Expand Down Expand Up @@ -1230,7 +1283,8 @@


const _message_ = document.querySelector("._message_")
document.querySelector(".send").addEventListener("click",e=>{
console.log(_message_.children.length==0)
function sendmsg(e){
let textarea = document.querySelector("textarea")
if(peercon!=" " && textarea.value!= ""){
send("message",{message:textarea.value})
Expand All @@ -1240,7 +1294,7 @@
fieldset.innerHTML=
`
<legend class =`+`${myinformation.id}`+`>${(()=>{if(_message_.children[_message_.children.length-1].querySelector("legend").getAttribute("class")==myinformation.id){return""}return "Me"})()}</legend>
<legend class =`+`${myinformation.id}`+`>${(()=>{if(_message_.children.length!=0 && _message_.children[_message_.children.length-1].querySelector("legend").getAttribute("class")==myinformation.id){return""}return "Me"})()}</legend>
<p>
${textarea.value}
Expand All @@ -1260,10 +1314,16 @@
_message_.appendChild(fieldset)

}
}
document.querySelector(".send").addEventListener("click",sendmsg)
document.querySelector("textarea").addEventListener("keypress",e=>{
if(e.key=="Enter"){
sendmsg()
}
})


console.log(_message_.children[1],"lastcild")
// console.log(_message_.children[1],"lastcild")


socket.on("allusernotification",e=>{
Expand Down Expand Up @@ -1756,6 +1816,8 @@ msnot(_e)
console.log(_e,"information")
myinformation = _e.myinformation
document.querySelector(".link").innerText=myinformation.roomid
document.querySelector(".room").innerText=myinformation.roomname

document.querySelector(".des").innerText=myinformation.description


Expand Down
1 change: 1 addition & 0 deletions server2.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ async function joincall(socket,_e){
})
io.sockets.in(e.roomnameid).emit("name",JSON.stringify({name:e.name,id}))
socket.information.description=master.information.description
socket.information.roomname=master.information.roomname
msg(socket,"myinformation",{myinformation:socket.information})
msg(socket,"masterid",{masterid,name:master.information.name,type:"master"})
msg(master,"incoming_user",{id})
Expand Down

0 comments on commit 5bebfbf

Please sign in to comment.