fix photo messages outbox things
This commit is contained in:
parent
7ec5f54422
commit
801b87590b
@ -48,7 +48,6 @@
|
|||||||
<br>
|
<br>
|
||||||
<button id="submit-photo" class="photo-buttons">Send</button>
|
<button id="submit-photo" class="photo-buttons">Send</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="overview-page">
|
<div id="overview-page">
|
||||||
@ -67,3 +66,4 @@
|
|||||||
<script src="/web/main.js"></script>
|
<script src="/web/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
79
web/main.js
79
web/main.js
@ -75,9 +75,9 @@ function onSubmitMessage(){
|
|||||||
var msg = document.getElementById('message').value.replace(/\r?\n/g, "<br />");
|
var msg = document.getElementById('message').value.replace(/\r?\n/g, "<br />");
|
||||||
var namm = document.getElementById('name').value || "anonymous";
|
var namm = document.getElementById('name').value || "anonymous";
|
||||||
addOutboxItem( namm, msg );
|
addOutboxItem( namm, msg );
|
||||||
};
|
}
|
||||||
|
|
||||||
function addOutboxItem( name, message ){
|
function addOutboxItem( namm, message ){
|
||||||
var outStr = localStorage.getItem( 'outbox' ) || '';
|
var outStr = localStorage.getItem( 'outbox' ) || '';
|
||||||
var newMsgs = {};
|
var newMsgs = {};
|
||||||
var ddata = new Date().getTime();
|
var ddata = new Date().getTime();
|
||||||
@ -87,7 +87,7 @@ function addOutboxItem( name, message ){
|
|||||||
}
|
}
|
||||||
var contento = {
|
var contento = {
|
||||||
"time" : ddata,
|
"time" : ddata,
|
||||||
"message" : mess,
|
"message" : message,
|
||||||
"name" : namm,
|
"name" : namm,
|
||||||
"node" : alias,
|
"node" : alias,
|
||||||
"hops" : "0"
|
"hops" : "0"
|
||||||
@ -158,7 +158,7 @@ function removeOutboxItem( timestamp ) {
|
|||||||
|
|
||||||
|
|
||||||
function updateInboxView() {
|
function updateInboxView() {
|
||||||
var localStorageArray = new Array();
|
var localStorageArray = [];
|
||||||
var contentString = '';
|
var contentString = '';
|
||||||
|
|
||||||
if (localStorage.length>0) {
|
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) {
|
for(var i in orderStorage) {
|
||||||
if ( i.length === 0 || i === 'outbox' ) {
|
if ( i.length === 0 || i === 'outbox' ) {
|
||||||
@ -247,21 +247,21 @@ function onMessageDownload( msg, filename ) {
|
|||||||
updateInboxView();
|
updateInboxView();
|
||||||
}
|
}
|
||||||
function onIndex( index ) {
|
function onIndex( index ) {
|
||||||
var lines = index.split( /\n/ );
|
var lines = index.split( /\n/ );
|
||||||
|
var k,i,l,f;
|
||||||
for(var k in localStorage){
|
for( k in localStorage){
|
||||||
var l = 1;
|
l = 1;
|
||||||
for ( var i in lines ) {
|
for ( i in lines ) {
|
||||||
var f = lines[i];
|
f = lines[i];
|
||||||
if (f == k){ l = 0; }
|
if (f == k){ l = 0; }
|
||||||
}
|
}
|
||||||
if (l == 1){
|
if (l == 1){
|
||||||
localStorage.removeItem(k);
|
localStorage.removeItem(k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
updateInboxView();
|
||||||
updateInboxView();
|
|
||||||
|
|
||||||
for ( var i in lines ) {
|
for ( i in lines ) {
|
||||||
var fname = lines[i];
|
var fname = lines[i];
|
||||||
if ( localStorage.getItem( fname ) === null ) {
|
if ( localStorage.getItem( fname ) === null ) {
|
||||||
//localStorage.setItem( ts, lines[i].substr(lines[i].indexOf(' ')) );
|
//localStorage.setItem( ts, lines[i].substr(lines[i].indexOf(' ')) );
|
||||||
@ -305,14 +305,14 @@ function getOwnId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getOwnAlias() {
|
function getOwnAlias() {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.onreadystatechange = function(){
|
xhr.onreadystatechange = function(){
|
||||||
if (xhr.readyState == 4 && xhr.status == 200){
|
if (xhr.readyState == 4 && xhr.status == 200){
|
||||||
ownAlias = xhr.responseText;
|
ownAlias = xhr.responseText;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
xhr.open( "GET", 'alias', true);
|
xhr.open( "GET", 'alias', true);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -526,24 +526,23 @@ function monochrome(imageData, threshold, type){
|
|||||||
// Set g and b pixels equal to r
|
// Set g and b pixels equal to r
|
||||||
imageData.data[currentPixel + 1] = imageData.data[currentPixel + 2] = imageData.data[currentPixel];
|
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};
|
||||||
|
|
||||||
// Alpha: make white pixels transparent!
|
for ( i = 0, n = imageData.data.length; i <n; i += 4) {
|
||||||
var newColor = {r:0,g:0,b:0, a:0};
|
var r = imageData.data[i],
|
||||||
|
g = imageData.data[i+1],
|
||||||
|
b = imageData.data[i+2];
|
||||||
|
|
||||||
for (var i = 0, n = imageData.data.length; i <n; i += 4) {
|
// If its white, or close to white then change it
|
||||||
var r = imageData.data[i],
|
if(r >=200 && g >= 200 && b >= 200){
|
||||||
g = imageData.data[i+1],
|
// Change the white to whatever.
|
||||||
b = imageData.data[i+2];
|
imageData.data[i] = newColor.r;
|
||||||
|
imageData.data[i+1] = newColor.g;
|
||||||
// If its white, or close to white then change it
|
imageData.data[i+2] = newColor.b;
|
||||||
if(r >=200 && g >= 200 && b >= 200){
|
imageData.data[i+3] = newColor.a;
|
||||||
// Change the white to whatever.
|
}
|
||||||
imageData.data[i] = newColor.r;
|
}
|
||||||
imageData.data[i+1] = newColor.g;
|
|
||||||
imageData.data[i+2] = newColor.b;
|
|
||||||
imageData.data[i+3] = newColor.a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return imageData;
|
return imageData;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ body{
|
|||||||
}
|
}
|
||||||
|
|
||||||
img{
|
img{
|
||||||
width:50%;
|
|
||||||
/* disable anti aliasing */
|
/* disable anti aliasing */
|
||||||
image-rendering: optimizeSpeed;
|
image-rendering: optimizeSpeed;
|
||||||
image-rendering: -moz-crisp-edges;
|
image-rendering: -moz-crisp-edges;
|
||||||
|
Loading…
Reference in New Issue
Block a user