diff --git a/examples/basic/user.html b/examples/basic/user.html
index 9ae9b009a..873d517c0 100644
--- a/examples/basic/user.html
+++ b/examples/basic/user.html
@@ -5,7 +5,7 @@
User
-
+
diff --git a/examples/party.html b/examples/party.html
index 56573277b..e466da702 100644
--- a/examples/party.html
+++ b/examples/party.html
@@ -38,10 +38,12 @@
;(() => {
function S(){};
window.S = S;
+ try{localStorage.clear();//sessionStorage.clear();
+ }catch(e){}
S.gun = Gun(location.host? location.origin+'/gun' : 'http://localhost:8765/gun');
//S.gun = Gun('http://localhost:8765/gun');
//S.gun = Gun();
- S.app = S.gun.get('examples/social/1');
+ S.app = S.gun.get('examples/social/2');
S.user = S.gun.user();
S.tell = (what, n) => {
var e = $('#tell').find('p');
@@ -530,7 +532,7 @@
@@ -547,23 +549,33 @@
});
window.user = S.user;
$('#speak').on('submit', (e) => {
- /*var say = normalize($('#speak .draft'));
- console.log(1, say.html());
- return;*/
- var say = $('#speak .draft').text();
+ var say = $('#speak .draft').text(); //.text(); // NO NO NO NO NO
if(!say){ return }
- var ref = S.user.get('who').get('all').set({what: say});
- ref.get('by').put(S.user.get('who'));
- S.user.get('who').get('said').time(ref);
- S.gun.get('@').time(ref);
+ console.log('save!', say);
+ var ref = S.user.get('who').get('all').set({what: say, when: Gun.state()});
+ //ref.get('by').put(S.user.get('who'));
+ //S.user.get('who').get('said').time(ref);
+ S.user.get('who').get('said').set(ref);
+ //S.gun.get('@').time(ref);
$('#speak .draft').text('');
});
- S.gun.get('@').time(async (data, key, time) => {
- var ref = S.gun.get(data), tmp;
- var said = await ref.then();
+ //S.gun.get('@').time(async (data, key, time) => {
+ S.user.get('who').get('said').map().once(async (data, key, time) => {
+ //var ref = S.gun.get(data), tmp;
+ //var said = await ref.then();
+ key = key.replace(/[^A-Za-z]/ig,'');
+ var tmp, said = data, time = said.when;
var $li = $($('#'+key)[0] || $('#draft .model .spoke').clone(true,true).attr('id', key)[(tmp = $.as.sort(time, $('#draft ul').children('li').first()))[0]?'insertBefore':'appendTo'](tmp[0] || '#draft ul'));
- $li.find('.what').text(said.what);
- var by = ref.get('by');
+ tmp = said.what;
+ if(tmp && tmp.ct){
+ tmp = JSON.stringify(tmp);
+ setTimeout(async function(){
+ tmp = await SEA.decrypt(said.what, S.user._.sea);
+ $li.find('.what').text(tmp);
+ }, 750);
+ }
+ $li.find('.what').text(tmp); // NORMALIAZE!!!
+ var by = S.user.get('who');// ref.get('by');
by.get('face').get('small').on(data => {
$li.find('.face').attr('src', data).removeClass('none');
});
@@ -579,7 +591,7 @@
if(face){
$li.find('.face').attr('src', face).removeClass('none');
}
- }, 10);
+ });
$(document).on('click', '#speak .act.face', (eve) => {
});
@@ -587,61 +599,80 @@
-
+
-
+
-
@@ -673,6 +704,7 @@
Hello world!
+
-
+
+
+