Backbone message storage and views
Adds Backbone-based Whisper.Messages model/collection with local storage extension. Saves sent and received messages in Whisper.Messages instead of message map. This will assign a unique id to the message and save it to localStorage. Adds Backbone-based view to popup.html Automatically updates itself when new messages are saved to Whisper.Messages db from the background page. Added some shiny new styles, and started splitting up css into multiple files for sanity's sake.
This commit is contained in:
parent
170257dafb
commit
b852e68290
14 changed files with 3832 additions and 323 deletions
26
css/buttons.css
Normal file
26
css/buttons.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
.btn span {
|
||||
display: inline-block;
|
||||
padding: 0.5em;
|
||||
border: 2px solid #7fd0ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.btn {
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
padding: 2px;
|
||||
border: none;
|
||||
}
|
||||
.btn:hover, .btn:focus {
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
background-color: #f1fafd;
|
||||
}
|
||||
.btn:active {
|
||||
outline: 2px dashed #acdbf5;
|
||||
}
|
||||
.btn.selected span,
|
||||
.btn:active span {
|
||||
background-color: #7fd0ed;
|
||||
border: 2px solid #acdbf5;
|
||||
color: #fff;
|
||||
}
|
176
css/conversation.css
Normal file
176
css/conversation.css
Normal file
|
@ -0,0 +1,176 @@
|
|||
.conversation {
|
||||
position: relative;
|
||||
max-width: 400px;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #acdbf5;
|
||||
background-color: #7fd0ed;
|
||||
color: #fff;
|
||||
margin-bottom: 0.5em;
|
||||
-webkit-animation-duration: 1s;
|
||||
-webkit-animation-name: convoopen;
|
||||
}
|
||||
|
||||
.conversation.closed {
|
||||
background-color: #fff;
|
||||
color: #7fd0ed;
|
||||
-webkit-animation-duration: 1s;
|
||||
-webkit-animation-name: convoclose;
|
||||
}
|
||||
@-webkit-keyframes convoclose {
|
||||
from { background-color: #7fd0ed; }
|
||||
to { background-color: #fff; }
|
||||
}
|
||||
@-webkit-keyframes convoopen {
|
||||
from { background-color: #fff; }
|
||||
to { background-color: #7fd0ed; }
|
||||
}
|
||||
|
||||
.conversation.closed:hover {
|
||||
background-color: #f1fafd;
|
||||
cursor: pointer;
|
||||
-webkit-animation-duration: 1s;
|
||||
-webkit-animation-name: hovercolorfadein;
|
||||
}
|
||||
.conversation.closed:not(hover) {
|
||||
-webkit-animation-duration: 1s;
|
||||
-webkit-animation-name: hovercolorfadeout;
|
||||
}
|
||||
@-webkit-keyframes hovercolorfadein {
|
||||
from { background-color: #fff; }
|
||||
to { background-color: #f1fafd; }
|
||||
}
|
||||
@-webkit-keyframes hovercolorfadeout {
|
||||
from { background-color: #f1fafd; }
|
||||
to { background-color: #fff; }
|
||||
}
|
||||
|
||||
.conversation .header {
|
||||
padding: 0.3em 0.6em 0.3em 46px;
|
||||
}
|
||||
.avatar {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 10px;
|
||||
display: inline-block;
|
||||
background-color: #fff;
|
||||
border: 2px solid #acdbf5;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 40px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.conversation .header span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.collapsable {
|
||||
background-color: #fff;
|
||||
border: 2px solid #acdbf5;
|
||||
padding: 1em 0em;
|
||||
line-height: 1.2em;
|
||||
font-family: sans-serif;
|
||||
border-radius: 30px;
|
||||
}
|
||||
|
||||
.messages + form {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.conversation form {
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
.message-text {
|
||||
display: block;
|
||||
padding: 0.5em 0.6em 0em;
|
||||
}
|
||||
|
||||
.metadata {
|
||||
display: block;
|
||||
color: #cccccc;
|
||||
font-size: 0.70em;
|
||||
padding: 0.2em 0.6em;
|
||||
visibility: hidden;
|
||||
}
|
||||
.bubble:hover .metadata {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.bubble {
|
||||
display: inline-block;
|
||||
background-color: #fafafa;
|
||||
color: #333333;
|
||||
border: 2px solid #7fd0ed;
|
||||
position: relative;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.sending .bubble {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.incoming .bubble {
|
||||
background-color: #ffffff;
|
||||
float: left;
|
||||
}
|
||||
.incoming .bubble:after, .incoming .bubble:before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
top: 11px;
|
||||
left: -0.8em;
|
||||
border-right: solid 0.5em #ffffff;
|
||||
border-top: solid 7px transparent;
|
||||
border-left: solid 0.4em transparent;
|
||||
border-bottom: solid 7px transparent;
|
||||
}
|
||||
|
||||
.outgoing .bubble {
|
||||
float: right;
|
||||
background-color: #f5feff;
|
||||
}
|
||||
.outgoing .bubble:after, .outgoing .bubble:before {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
top: 11px;
|
||||
right: -0.8em;
|
||||
border-top: solid 7px transparent;
|
||||
border-right: solid 0.4em transparent;
|
||||
border-bottom: solid 7px transparent;
|
||||
}
|
||||
|
||||
.outgoing .bubble:after {
|
||||
border-left: solid 0.5em #f5feff;
|
||||
}
|
||||
.outgoing .bubble:before {
|
||||
border-left: solid 0.5em #7fd0ed;
|
||||
right: -0.9em;
|
||||
}
|
||||
|
||||
.incoming .bubble:before {
|
||||
border-right: solid 0.5em #7fd0ed;
|
||||
left: -0.9em;
|
||||
}
|
||||
|
||||
.outgoing .bubble, .outgoing .metadata {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.message {
|
||||
padding: 0.3em 11.63636px;
|
||||
}
|
||||
|
||||
.message:after {
|
||||
content: '';
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
25
css/forms.css
Normal file
25
css/forms.css
Normal file
|
@ -0,0 +1,25 @@
|
|||
input[type=text], textarea {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding: 7px;
|
||||
border: 2px solid #7fd0ed;
|
||||
border-radius: 4px;
|
||||
background-color: #fafafa;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
|
||||
input[type=text]:focus {
|
||||
outline: 2px dashed #acdbf5;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
width: 100%;
|
||||
min-height: 100px;
|
||||
box-sizing: border-box;
|
||||
font-family: Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
}
|
99
css/popup.css
Normal file
99
css/popup.css
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
|
||||
.clearfix:after { clear: both; }
|
||||
.clearfix { zoom: 1; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-width: 400px;
|
||||
min-height: 500px;
|
||||
font-family: sans-serif;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: auto;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
form.compose {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
label {
|
||||
float: left;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
form.compose input[type=text], form.compose textarea {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
#send input[type=submit] {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#popup_send_numbers {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#popup_send_numbers:focus + .contacts,
|
||||
.contacts:hover {
|
||||
display: block;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.contacts {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
.contact {
|
||||
border: solid 1px #ccc;
|
||||
background: #fff;
|
||||
font-size: 88%;
|
||||
padding-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.contact .pic {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.contact .name, .contact .number {
|
||||
line-height: 30px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* Formatting */
|
Loading…
Add table
Add a link
Reference in a new issue