
7 changed files with 0 additions and 340 deletions
@ -1,66 +0,0 @@
|
||||
.conversationList li{ |
||||
list-style: none; |
||||
padding-top: 1em; |
||||
} |
||||
|
||||
.convoListContainer{ |
||||
margin-left: 1%; |
||||
border-radius: 5px; |
||||
border: 1px solid black; |
||||
overflow-y: scroll; |
||||
} |
||||
|
||||
.chatContent{ |
||||
padding-right: 5%; |
||||
} |
||||
|
||||
.connectStatus{ |
||||
float: right; |
||||
} |
||||
|
||||
.friendsTitle{ |
||||
text-align: center; |
||||
display: block; |
||||
} |
||||
|
||||
/* |
||||
.chatInput{ |
||||
position: fixed; |
||||
bottom: 0; |
||||
} |
||||
*/ |
||||
.chatInput{ |
||||
margin-top: -3em; |
||||
} |
||||
.chatInput textarea{ |
||||
resize: none; |
||||
} |
||||
.chatInput textarea::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ |
||||
color: black; |
||||
opacity: 1; /* Firefox */ |
||||
} |
||||
|
||||
.from{ |
||||
margin-top: 1em; |
||||
display: block; |
||||
padding-bottom: 0.5em; |
||||
} |
||||
|
||||
.chatFeed{ |
||||
display: block; |
||||
max-height: 500px; |
||||
overflow-y: scroll; |
||||
min-height: 100%; |
||||
padding-top: 4em; |
||||
transform: rotate(180deg); |
||||
direction: rtl; |
||||
} |
||||
|
||||
.messageEntry{ |
||||
transform: rotate(180deg); |
||||
direction: ltr; |
||||
} |
||||
|
||||
#messageEntryTemplate{ |
||||
display: none; |
||||
} |
@ -1,106 +0,0 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta charset='utf-8'> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<title> |
||||
Onionr Chat |
||||
</title> |
||||
<link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'> |
||||
<link rel="stylesheet" href="/gettheme"> |
||||
<link rel="stylesheet" href="/chat/css/convos.css"> |
||||
<script defer src='/shared/misc.js'></script> |
||||
<script defer src='/shared/direct-connections.js'></script> |
||||
<script defer src='/chat/js/messages.js'></script> |
||||
<script defer src='/chat/js/message-feed.js'></script> |
||||
<script defer src='/chat/js/resizes.js'></script> |
||||
<script defer src='/chat/js/change-convo.js'></script> |
||||
<script defer src="/shared/navbar.js"></script> |
||||
<script defer src='/chat/js/main.js'></script> |
||||
</head> |
||||
|
||||
<body> |
||||
|
||||
<nav class="navbar is-dark" role="navigation" aria-label="main navigation"> |
||||
<div class="navbar-brand"> |
||||
<a class="navbar-item idLink" href="/"> |
||||
<img src="/shared/images/favicon.ico" class="navbarLogo"> |
||||
</a> |
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" |
||||
data-target="navbarBasic"> |
||||
<span aria-hidden="true"></span> |
||||
<span aria-hidden="true"></span> |
||||
<span aria-hidden="true"></span> |
||||
</a> |
||||
</div> |
||||
|
||||
<div id="navbarBasic" class="navbar-menu"> |
||||
<div class="navbar-start"> |
||||
<a class="navbar-item idLink" href="/mail/">Mail</a> |
||||
<a class="navbar-item idLink" href="/friends/">Friends</a> |
||||
<a class="navbar-item idLink" href="/board/">Circles</a> |
||||
<a class="navbar-item idLink" href="/chat/">Chat</a> |
||||
</div> |
||||
</div> |
||||
</nav> |
||||
|
||||
<!--Hero (Dark Section)--> |
||||
<section class="hero is-small is-dark"> |
||||
<div class="hero-body"> |
||||
<div class="container"> |
||||
<div class="columns"> |
||||
<div class="column"> |
||||
<h1 class="title"> |
||||
Onionr Chat |
||||
</h1> |
||||
<h2 class="subtitle"> |
||||
Instant Messaging |
||||
</h2> |
||||
</div> |
||||
<div class="column is-7"> |
||||
<div class="field"> |
||||
<div class="field has-addons"> |
||||
<p class="control"> |
||||
<a class="button is-static">Identity</a> |
||||
</p> |
||||
<p class="control is-expanded"> |
||||
<input id="myPub" class="input myPub" type="text" readonly> |
||||
</p> |
||||
<p class="control"> |
||||
<a id="myPubCopy" class="button is-primary">Copy</a> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
||||
|
||||
<div class="messageEntry" id="messageEntryTemplate"> |
||||
<span class="from has-text-primary">Jenny</span> |
||||
<div class="messageContent">I'll stay right here</div> |
||||
</div> |
||||
<br> |
||||
|
||||
<div class="columns chatContent"> |
||||
<div class="column has-background-grey-dark has-text-light is-one-fifths content convoListContainer"> |
||||
<span class='friendsTitle'>Friends</span> |
||||
<hr> |
||||
<ul class='conversationList'></ul> |
||||
</div> |
||||
<div class="column chatBox has-text-light has-background-dark is-four-fifths"> |
||||
<span class="chatFeed"> |
||||
</span> |
||||
<div class="field has-addons"> |
||||
<p class="control chatInput"> |
||||
<textarea class="textarea has-dark-text" name="message-to-send" id="message-to-send" placeholder="Type your message" rows="1"></textarea> |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
|
||||
</html> |
@ -1,6 +0,0 @@
|
||||
var conversationListElements = document.getElementsByClassName('conversationList') |
||||
for (i = 0; i < conversationListElements.length; i++){ |
||||
conversationListElements[i].onclick = function(e){ |
||||
|
||||
} |
||||
} |
@ -1,77 +0,0 @@
|
||||
/* |
||||
Onionr - Private P2P Communication |
||||
|
||||
Main Onionr chat UI script |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/ |
||||
friendList = {} |
||||
convoListElement = document.getElementsByClassName('conversationList')[0] |
||||
firstConvoLoad = true |
||||
activeConvo = null; |
||||
|
||||
function createConvoList(){ |
||||
convoListElement.innerHTML = "" |
||||
for (friend in friendList){ |
||||
let convoEntry = document.createElement('li') |
||||
let connectStatus = document.createElement('span') |
||||
connectStatus.classList.add("connectStatus") |
||||
if (firstConvoLoad){ |
||||
connectStatus.innerText = " ⌛" |
||||
} |
||||
else{ |
||||
connectStatus.innerText = " X" |
||||
connectStatus.style.color = "red" |
||||
console.log(direct_connections) |
||||
if (direct_connections.hasOwnProperty(friend)){ |
||||
connectStatus.innerText = " ✅" |
||||
connectStatus.style.color = "green" |
||||
} |
||||
} |
||||
|
||||
convoEntry.classList.add('convoEntry') |
||||
convoEntry.setAttribute('data-pubkey', friend) |
||||
convoEntry.innerText = friendList[friend] |
||||
convoEntry.appendChild(connectStatus) |
||||
convoListElement.append(convoEntry) |
||||
firstConvoLoad = false |
||||
} |
||||
setTimeout(function(){createConvoList()}, 3000) |
||||
} |
||||
|
||||
fetch('/friends/list', { |
||||
headers: { |
||||
"token": webpass |
||||
}}) |
||||
.then((resp) => resp.json()) // Transform the data into json
|
||||
.then(function(resp) { |
||||
var keys = [] |
||||
for(var k in resp) keys.push(k) |
||||
for (var i = 0; i < keys.length; i++){ |
||||
friendList[keys[i]] = resp[keys[i]]['name'] |
||||
// Create a connection to each peer
|
||||
createConnection(keys[i]) |
||||
} |
||||
createConvoList() |
||||
}) |
||||
|
||||
// Correct conversation list height
|
||||
function correctConvoList(){ |
||||
margin = 50 |
||||
els = document.getElementsByClassName('convoListContainer') |
||||
for (x = 0; x < els.length; x++){ |
||||
els[x].style.height = window.innerHeight - (2 * margin) + 'px' |
||||
} |
||||
} |
||||
setInterval(function(){correctConvoList()}, 30) |
@ -1,25 +0,0 @@
|
||||
/* |
||||
Onionr - Private P2P Communication |
||||
|
||||
This file manages chat messages in the chat UI |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/ |
||||
|
||||
let showMessages = function(){ |
||||
let feeds = document.getElementsByClassName("chatFeed") |
||||
for (x=0; x < feeds.length; x++){ |
||||
|
||||
} |
||||
} |
@ -1,36 +0,0 @@
|
||||
/* |
||||
Onionr - Private P2P Communication |
||||
|
||||
Onionr chat message objects |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/ |
||||
chatMessages = {} |
||||
let Message = class { |
||||
constructor(text, peer, outgoing){ |
||||
this.text = text // raw message string
|
||||
this.peer = peer // peer by public key
|
||||
this.outgoing = outgoing // boolean. false = outgoing message
|
||||
this.time = new Date().toISOString() // store message time
|
||||
this.tempIdentifier = Math.floor(Math.random() * 100000000000000000) // assign a random id, doesnt need to be secure
|
||||
|
||||
// Add the message to the peer message feed object chatMessages
|
||||
if (chatMessages.hasOwnProperty(peer)){ |
||||
chatMessages[peer].push(this) |
||||
} |
||||
else{ |
||||
chatMessages[peer] = [this] |
||||
} |
||||
} |
||||
} |
@ -1,24 +0,0 @@
|
||||
/* |
||||
Onionr - Private P2P Communication |
||||
|
||||
Resize chat elements to help with responsiveness |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
*/ |
||||
let doResize = function(){ |
||||
let chatInput = document.getElementsByClassName('chatInput')[0] |
||||
chatInput.style.width = "50%"; |
||||
} |
||||
doResize() |
||||
window.onresize = doResize |
Loading…
Reference in new issue