login css, talk details

This commit is contained in:
Galen Wolfe-Pauly 2015-05-17 13:27:59 -07:00
parent d06a6aacb0
commit 9c31e52b64
7 changed files with 156 additions and 52 deletions

View File

@ -274,12 +274,11 @@
}) })
} }
if(window.ship) ship.innerText = urb.ship
urb.foreign = /^\/~\/am/.test(window.location.pathname) urb.foreign = /^\/~\/am/.test(window.location.pathname)
urb.submit = function(){ urb.submit = function(){
req( req(
"/~/auth.json?PUT", "/~/auth.json?PUT",
{ship: ship.innerText, code: pass.value}, {ship:ship.innerText.toLowerCase(), code:pass.value},
function(){ function(){
if(urb.foreign) document.location = if(urb.foreign) document.location =
document.location.hash.match(/#[^?]+/)[0].slice(1) + document.location.hash.match(/#[^?]+/)[0].slice(1) +
@ -298,17 +297,47 @@
++ xml ++ xml
|% |%
++ login-page ++ login-page
%+ titl 'Log in' %+ titl 'Log in :urbit'
;= ;p: Please log in. ;= ;h1: Please log in
;p.mono: ~;{span#ship(contenteditable "")} ;p.ship
;input#pass(onchange "urb.submit()"); ;div.sig: ~
;span#ship(contenteditable "");
==
;input#pass(type "password");
;script:'''
$(function() {
$ship = $('#ship')
$pass = $('#pass')
$ship.on('keydown', function(e) {
if(e.keyCode === 13 || e.keyCode === 9) {
$pass.show()
$pass.focus()
e.preventDefault()
}
})
$ship.on('focus', function(e) {
$pass.hide()
})
$pass.on('keydown', function(e) {
if(e.keyCode === 13) {
urb.submit()
}
})
if(window.ship) {
$ship.text(urb.ship)
$pass.focus()
} else {
$pass.hide()
}
})
'''
;pre:code#err; ;pre:code#err;
;script@"/~/at/~/auth.js"; ;script@"/~/at/~/auth.js";
== ==
:: ::
++ logout-page ++ logout-page
%+ titl 'Log out' %+ titl 'Log out'
;= ;p: Goodbye ~;{span#ship}. ;= ;h1: Goodbye ~;{span#ship}.
;button#act(onclick "urb.away()"): Log out ;button#act(onclick "urb.away()"): Log out
;pre:code#err; ;pre:code#err;
;script@"/~/at/~/auth.js"; ;script@"/~/at/~/auth.js";
@ -331,7 +360,9 @@
|= [a=cord b=marl] |= [a=cord b=marl]
;html ;html
;head ;head
;meta(charset "utf-8");
;title:"{(trip a)}" ;title:"{(trip a)}"
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js");
;link(rel "stylesheet", href "/home/lib/base.css"); ;link(rel "stylesheet", href "/home/lib/base.css");
== ==
;body:div#c:"*{b}" ;body:div#c:"*{b}"

View File

@ -104,23 +104,29 @@ code,
} }
#c { #c {
width: 24rem; width: 32rem;
margin-left: -16rem;
position: absolute; position: absolute;
left: 50%; left: 50%;
margin-left: -12rem; }
h1 {
font-size: 1.6rem;
font-weight: 500;
}
h1:after {
content: "\2014";
margin-left: 1rem;
} }
#c pre { #c pre {
font-size: .6rem; font-size: .6rem;
} margin-top: 2rem;
#c.err {
width: 32rem;
margin-left: -16rem;
} }
#pass { #pass {
width: 24rem; width: 32rem;
} }
button { button {
@ -131,17 +137,32 @@ button {
font-weight: 500; font-weight: 500;
} }
#ship, .sig {
input { font-weight: 400;
font-family: "scp"; font-size: 2rem;
display: inline; display: inline;
border: none; vertical-align: middle;
background-color: #f5f5f5;
padding: .3rem;
outline: none;
} }
#ship:focus, #ship {
input:focus { font-family: 'bau';
background-color: #eee; font-weight: 400;
font-size: 1.2rem;
text-transform: uppercase;
letter-spacing: .1rem;
display: inline-block;
min-width: 1rem;
}
input {
font-family: 'scp';
display: inline;
}
#ship,
input {
border: none;
padding: .3rem;
outline: none;
border-bottom: 3px solid #555;
} }

View File

@ -317,16 +317,22 @@ body {
background-color: transparent; background-color: transparent;
border: none; border: none;
font-size: 0.8rem; font-size: 0.8rem;
line-height: 2rem; line-height: 1.2rem;
letter-spacing: 0.05rem;
margin-top: 0.6rem; margin-top: 0.6rem;
font-weight: 300; font-weight: 300;
text-align: left; text-align: left;
outline: none; outline: none;
cursor: pointer; cursor: pointer;
text-transform: uppercase;
border-bottom: 2px solid transparent;
}
.sour-ctrl input:focus {
border-bottom: 2px solid #fff;
} }
.sour-ctrl input::-webkit-input-placeholder { .sour-ctrl input::-webkit-input-placeholder {
font-weight: 500; font-weight: 400;
font-size: 1.6rem; font-size: 1.2rem;
margin-left: 0.6rem; margin-left: 0.6rem;
color: #fff; color: #fff;
} }
@ -509,12 +515,9 @@ a {
min-height: 1.6rem; min-height: 1.6rem;
min-width: 1.3rem; min-width: 1.3rem;
outline: none; outline: none;
background-color: #eee;
padding: 0.3rem 0.1rem; padding: 0.3rem 0.1rem;
margin-top: -0.3rem; margin-top: -0.3rem;
} border-bottom: 3px solid #555;
#writing:focus {
background-color: #fff;
} }
.writing { .writing {
padding-top: 0.3rem; padding-top: 0.3rem;
@ -540,15 +543,17 @@ a {
} }
#audi { #audi {
display: inline-block; display: inline-block;
background-color: #eee;
margin-right: -0.2rem; margin-right: -0.2rem;
margin-bottom: 0.3rem;
outline: none; outline: none;
overflow: hidden; overflow: hidden;
max-width: 9rem; max-width: 9rem;
min-width: 1rem;
padding: 0.3rem 0.1rem 0.1rem 0; padding: 0.3rem 0.1rem 0.1rem 0;
border-bottom: 2px solid #555;
} }
.valid-false { .valid-false {
color: #ff2f2f; color: #ff2f2f !important;
} }
#scrolling { #scrolling {
display: none; display: none;

View File

@ -258,16 +258,22 @@ body
background-color transparent background-color transparent
border none border none
font-size .8rem font-size .8rem
line-height 2rem line-height 1.2rem
letter-spacing .05rem
margin-top .6rem margin-top .6rem
font-weight 300 font-weight 300
text-align left text-align left
outline none outline none
cursor pointer cursor pointer
text-transform uppercase
border-bottom 2px solid transparent
.sour-ctrl input:focus
border-bottom 2px solid #fff
.sour-ctrl input::-webkit-input-placeholder .sour-ctrl input::-webkit-input-placeholder
font-weight 500 font-weight 400
font-size 1.6rem font-size 1.2rem
margin-left .6rem margin-left .6rem
color white color white
@ -463,13 +469,9 @@ a
min-height 1.6rem min-height 1.6rem
min-width 1.3rem min-width 1.3rem
outline none outline none
background-color #eee
padding .3rem .1rem padding .3rem .1rem
margin-top -.3rem margin-top -.3rem
border-bottom 3px solid #555
#writing:focus
background-color #fff
.writing .writing
padding-top .3rem padding-top .3rem
@ -495,15 +497,17 @@ a
#audi #audi
display inline-block display inline-block
background-color #eee
margin-right -.2rem margin-right -.2rem
margin-bottom .3rem
outline none outline none
overflow hidden overflow hidden
max-width 9rem max-width 9rem
min-width 1rem
padding .3rem .1rem .1rem 0 padding .3rem .1rem .1rem 0
border-bottom 2px solid #555
.valid-false .valid-false
color #ff2f2f color #ff2f2f !important
// //
// scrolling // scrolling

View File

@ -44,15 +44,30 @@ module.exports = recl
return return
$("#station-container").toggleClass 'open' $("#station-container").toggleClass 'open'
validateSource: (s) ->
if @state.configs[@state.station].sources.indexOf(s) isnt -1
return false
if s.length < 5
return false
if s[0] isnt "~"
return false
if s.indexOf("/") is -1
return false
return true
_keyUp: (e) -> _keyUp: (e) ->
$('.sour-ctrl .join').removeClass 'valid-false'
if e.keyCode is 13 if e.keyCode is 13
v = @$input.val() v = @$input.val().toLowerCase()
if @state.configs[@state.station].sources.indexOf(v) is -1 if v[0] isnt "~" then v = "~#{v}"
if @validateSource v
_sources = _.clone @state.configs[@state.station].sources _sources = _.clone @state.configs[@state.station].sources
_sources.push v _sources.push v
StationActions.setSources @state.station,_sources StationActions.setSources @state.station,_sources
@$input.val('') @$input.val('')
@$input.blur() @$input.blur()
else
$('.sour-ctrl .join').addClass 'valid-false'
_remove: (e) -> _remove: (e) ->
e.stopPropagation() e.stopPropagation()

View File

@ -125,8 +125,10 @@ module.exports = recl
_validateAudi: -> _validateAudi: ->
v = $('#audi').text() v = $('#audi').text()
v = v.trim() v = v.trim()
if v.length is 0 if v.length is 0
return true return true
if v.length < 5 # zod/a is shortest
return false
v = v.split " " v = v.split " "
for a in v for a in v
a = a.trim() a = a.trim()
@ -138,10 +140,10 @@ module.exports = recl
StationActions.setValidAudience valid StationActions.setValidAudience valid
if valid is true if valid is true
v = $('#audi').text() v = $('#audi').text()
if v.length is 0 then v = window.util.mainStationPath window.urb.user
v = v.split " " v = v.split " "
for k,_v of v for k,_v of v
if _v[0] isnt "~" then v[k] = "~#{_v}" if _v[0] isnt "~" then v[k] = "~#{_v}"
v = window.util.expandAudi v
StationActions.setAudience v StationActions.setAudience v
v v
else else

View File

@ -522,16 +522,37 @@ module.exports = recl({
} }
return $("#station-container").toggleClass('open'); return $("#station-container").toggleClass('open');
}, },
validateSource: function(s) {
if (this.state.configs[this.state.station].sources.indexOf(s) !== -1) {
return false;
}
if (s.length < 5) {
return false;
}
if (s[0] !== "~") {
return false;
}
if (s.indexOf("/") === -1) {
return false;
}
return true;
},
_keyUp: function(e) { _keyUp: function(e) {
var _sources, v; var _sources, v;
$('.sour-ctrl .join').removeClass('valid-false');
if (e.keyCode === 13) { if (e.keyCode === 13) {
v = this.$input.val(); v = this.$input.val().toLowerCase();
if (this.state.configs[this.state.station].sources.indexOf(v) === -1) { if (v[0] !== "~") {
v = "~" + v;
}
if (this.validateSource(v)) {
_sources = _.clone(this.state.configs[this.state.station].sources); _sources = _.clone(this.state.configs[this.state.station].sources);
_sources.push(v); _sources.push(v);
StationActions.setSources(this.state.station, _sources); StationActions.setSources(this.state.station, _sources);
this.$input.val(''); this.$input.val('');
return this.$input.blur(); return this.$input.blur();
} else {
return $('.sour-ctrl .join').addClass('valid-false');
} }
} }
}, },
@ -793,6 +814,9 @@ module.exports = recl({
if (v.length === 0) { if (v.length === 0) {
return true; return true;
} }
if (v.length < 5) {
return false;
}
v = v.split(" "); v = v.split(" ");
for (i = 0, len = v.length; i < len; i++) { for (i = 0, len = v.length; i < len; i++) {
a = v[i]; a = v[i];
@ -807,6 +831,9 @@ module.exports = recl({
StationActions.setValidAudience(valid); StationActions.setValidAudience(valid);
if (valid === true) { if (valid === true) {
v = $('#audi').text(); v = $('#audi').text();
if (v.length === 0) {
v = window.util.mainStationPath(window.urb.user);
}
v = v.split(" "); v = v.split(" ");
for (k in v) { for (k in v) {
_v = v[k]; _v = v[k];
@ -814,7 +841,6 @@ module.exports = recl({
v[k] = "~" + _v; v[k] = "~" + _v;
} }
} }
v = window.util.expandAudi(v);
StationActions.setAudience(v); StationActions.setAudience(v);
return v; return v;
} else { } else {