From 6d44f8299754378fca1f0e2107ccccd8d0ada74f Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Sun, 1 Aug 2021 10:21:03 -0700 Subject: [PATCH] reverse user random side, add err, update styles, + more --- examples/basic/poll.html | 148 +++++++++++++++++++++++++++++++++++++++ examples/style.css | 32 ++++++--- gun.js | 5 +- sea.js | 13 +++- 4 files changed, 184 insertions(+), 14 deletions(-) create mode 100644 examples/basic/poll.html diff --git a/examples/basic/poll.html b/examples/basic/poll.html new file mode 100644 index 00000000..03d4decc --- /dev/null +++ b/examples/basic/poll.html @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ +
+ + +
+
+ +
+
+
+ +
+ + + add new title, text, question... + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/examples/style.css b/examples/style.css index a4b4c4f7..4de8090e 100644 --- a/examples/style.css +++ b/examples/style.css @@ -4,6 +4,7 @@ html, body { position: relative; line-height: 1.5; font-size: 18pt; + f-ont-size: max(18pt, 2?vw); } div, ul, ol, li, p, span, form, button, input, textarea, img { @@ -14,6 +15,7 @@ div, ul, ol, li, p, span, form, button, input, textarea, img { -webkit-transition: all 0.3s; transition: all 0.3s; box-sizing: border-box; + font: inherit; } a, button, input, textarea { @@ -21,11 +23,19 @@ a, button, input, textarea { border: inherit; color: inherit; text-decoration: inherit; + outline: none; +} +a:focus, button:focus, input[type=button]:focus, input[type=submit]:focus { + animation: pulse 2s infinite; } -input, textarea { +input:not([type=button]):not([type=submit]), textarea { width: 100%; } +::placeholder, .hint { + color: inherit; + opacity: 0.3; +} ul, li { list-style: none; @@ -92,8 +102,11 @@ p + p { vertical-align: bottom; } -.rim { margin: 2%; } -.gap { padding: 3%; } +.rim { margin: 1%; } +.gap { + padding: 3%; + padding: clamp(0.5em, 3%, 1.5em); +} .stack { line-height: 0; } .crack { margin-bottom: 1%; } .sit { margin-bottom: 0; } @@ -110,16 +123,12 @@ p + p { float: none; clear: both; } -.unit, .symbol { - display: inline-block; - vertical-align: inherit; -} .leak { overflow: visible; } .hold { overflow: hidden; } .act { - display: block; + /*display: block;*/ font-weight: normal; text-decoration: none; -webkit-transition: all 0.3s; @@ -127,6 +136,10 @@ p + p { cursor: pointer; } +.unit, .symbol { + display: inline-block; + vertical-align: inherit; +} .sap { border-radius: 0.1em; } .jot { border-bottom: 1px dashed #95B2CA; } @@ -138,7 +151,6 @@ p + p { font-size: 6.5vmax; } - .red { background: #ea3224; } .green { background: #33cc33; } .blue { background: #4D79D8; } @@ -331,4 +343,4 @@ p + p { padding: 0; position: absolute; width: 1px; -} +} \ No newline at end of file diff --git a/gun.js b/gun.js index 6c918e58..ea8757ee 100644 --- a/gun.js +++ b/gun.js @@ -570,6 +570,7 @@ var put, get, at = this.as, back = at.back, root = at.root, tmp; if(!msg.$){ msg.$ = at.$ } this.to.next(msg); + if(at.err){ at.on('in', {put: at.put = u, $: at.$}); return } if(get = msg.get){ /*if(u !== at.put){ at.on('in', at); @@ -808,9 +809,9 @@ var back = this, cat = back._; var next = cat.next || empty; if(!(gun = next[key])){ - gun = cache(key, back); + gun = key && cache(key, back); } - gun = gun.$; + gun = gun && gun.$; } else if('function' == typeof key){ if(true === cb){ return soul(this, key, cb, as), this } diff --git a/sea.js b/sea.js index 54675b2a..d3b0e7b5 100644 --- a/sea.js +++ b/sea.js @@ -828,7 +828,7 @@ at.opt.uuid = function(cb){ var id = uuid(), pub = root.user; if(!pub || !(pub = pub.is) || !(pub = pub.pub)){ return id } - id = id + '~' + pub + '/'; // TODO: What's the best perf we can get on which side? + id = '~' + pub + '/' + id; if(cb && cb.call){ cb(null, id) } return id; } @@ -858,12 +858,21 @@ User.prototype.create = function(alias, pass, cb, opt){ var gun = this, cat = (gun._), root = gun.back(-1); cb = cb || noop; + opt = opt || {}; + if(false !== opt.check){ + var err; + if(!alias){ err = "No user." } + if((pass||'').length < 8){ err = "Password too short!" } + if(err){ + cb({err: Gun.log(err)}); + return gun; + } + } if(cat.ing){ cb({err: Gun.log("User is already being created or authenticated!"), wait: true}); return gun; } cat.ing = true; - opt = opt || {}; var act = {}, u; act.a = function(pubs){ act.pubs = pubs;