fix photo messages outbox things

This commit is contained in:
jngrt 2015-05-19 23:41:50 +02:00
parent 7ec5f54422
commit 801b87590b
3 changed files with 50 additions and 52 deletions

View File

@ -48,7 +48,6 @@
<br>
<button id="submit-photo" class="photo-buttons">Send</button>
</div>
<div id="overview-page">
@ -67,3 +66,4 @@
<script src="/web/main.js"></script>
</body>
</html>

View File

@ -75,9 +75,9 @@ function onSubmitMessage(){
var msg = document.getElementById('message').value.replace(/\r?\n/g, "<br />");
var namm = document.getElementById('name').value || "anonymous";
addOutboxItem( namm, msg );
};
}
function addOutboxItem( name, message ){
function addOutboxItem( namm, message ){
var outStr = localStorage.getItem( 'outbox' ) || '';
var newMsgs = {};
var ddata = new Date().getTime();
@ -87,7 +87,7 @@ function addOutboxItem( name, message ){
}
var contento = {
"time" : ddata,
"message" : mess,
"message" : message,
"name" : namm,
"node" : alias,
"hops" : "0"
@ -158,7 +158,7 @@ function removeOutboxItem( timestamp ) {
function updateInboxView() {
var localStorageArray = new Array();
var localStorageArray = [];
var contentString = '';
if (localStorage.length>0) {
@ -184,7 +184,7 @@ var localStorageArray = new Array();
};
}
}
orderStorage = localStorageArray.sort(function(a,b) { return b.time - a.time } );
orderStorage = localStorageArray.sort(function(a,b) { return b.time - a.time; } );
for(var i in orderStorage) {
if ( i.length === 0 || i === 'outbox' ) {
@ -248,11 +248,11 @@ function onMessageDownload( msg, filename ) {
}
function onIndex( index ) {
var lines = index.split( /\n/ );
for(var k in localStorage){
var l = 1;
for ( var i in lines ) {
var f = lines[i];
var k,i,l,f;
for( k in localStorage){
l = 1;
for ( i in lines ) {
f = lines[i];
if (f == k){ l = 0; }
}
if (l == 1){
@ -261,7 +261,7 @@ function onIndex( index ) {
}
updateInboxView();
for ( var i in lines ) {
for ( i in lines ) {
var fname = lines[i];
if ( localStorage.getItem( fname ) === null ) {
//localStorage.setItem( ts, lines[i].substr(lines[i].indexOf(' ')) );
@ -310,7 +310,7 @@ function getOwnAlias() {
if (xhr.readyState == 4 && xhr.status == 200){
ownAlias = xhr.responseText;
}
}
};
xhr.open( "GET", 'alias', true);
xhr.send();
}
@ -526,11 +526,10 @@ function monochrome(imageData, threshold, type){
// Set g and b pixels equal to r
imageData.data[currentPixel + 1] = imageData.data[currentPixel + 2] = imageData.data[currentPixel];
}
// Alpha: make white pixels transparent!
var newColor = {r:0,g:0,b:0, a:0};
for (var i = 0, n = imageData.data.length; i <n; i += 4) {
for ( i = 0, n = imageData.data.length; i <n; i += 4) {
var r = imageData.data[i],
g = imageData.data[i+1],
b = imageData.data[i+2];

View File

@ -14,7 +14,6 @@ body{
}
img{
width:50%;
/* disable anti aliasing */
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;