Merge branch 'test' of https://github.com/urbit/urbit into test

This commit is contained in:
Anton Dyudin 2015-05-28 16:34:40 -07:00
commit 11b024858f
6 changed files with 133 additions and 49 deletions

View File

@ -177,6 +177,7 @@
abet:(~(diff-octo-update ce ost.hid src.hid) way mex) ::
++ peer-octo :: urbit peer
|= path ::
~& [%peer path]
abet:(~(peer-octo ce ost.hid src.hid) +<) ::
++ peer-sole :: console subscribe
|= path ::

View File

@ -7,26 +7,25 @@
;head
;meta(charset "utf-8");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
;script(type "text/javascript", src "/~/at/base/lib/urb.js");
;script(type "text/javascript", src "/~~/~/at/base/lib/urb.js");
;link(type "text/css", rel "stylesheet", href "/home/lib/base.css");
;link(type "text/css", rel "stylesheet", href "/home/pub/octo/src/main.css");
;title: :octo
==
;body
;div#what
;div#ship
;div.sig: ~
;div#x
;div.ship;
;div.as;
;div.as: ✕
==
;div#vs: vs
;div#user
;div.sig: ~
;div#o
;div.ship;
;div.as;
;div.as: ◯
==
==
;div#bord;
;div#audi;
;script(type "text/javascript", src "/home/pub/octo/src/main.js");
==
==

View File

@ -1,5 +1,6 @@
#what,
#bord {
#bord,
#audi {
width: 600px;
text-align: center;
position: absolute;
@ -16,13 +17,31 @@
height: 600px;
position: absolute;
top: 111px;
opacity: .6;
opacity: .3;
}
#audi {
top: 760px;
}
.turn #bord {
opacity: 1;
}
#message {
position:absolute;
left: 0; top: 0;
width: 100%; height: 90px;
line-height: 90px;
background-color: #000;
color: #fff;
text-align: center;
}
#message .ship {
display: inline;
}
#what {
font-family: "bau";
}
@ -31,19 +50,32 @@
display: inline-block;
}
#what .ship {
.ship {
padding: .3rem;
font-weight: 400;
letter-spacing: 1px;
text-transform: uppercase;
line-height:2rem;
}
.turn #what #ship,
#what #user {
.ship:before {
content: "~";
font-weight: 500;
font-size: 1rem;
}
.waiting.ship:before {
content: "Waiting";
color: #ccc;
}
#what #x,
#what #o {
border: 2px solid #fff;
}
#what #ship,
.turn #what #user {
.x #what #x,
.o #what #o {
border: 2px solid red;
}
@ -56,6 +88,7 @@
width: 1.6rem;
}
#audi h1,
#vs {
margin: 0 1rem;
padding: .3rem;
@ -63,6 +96,22 @@
background-color: #000;
}
#audi h1 {
font-size: .9rem;
text-transform: uppercase;
display: inline-block;
background-color: #ccc;
}
#audi h1:after {
content: "";
margin: 0;
}
#audi .ship {
color: #ccc;
}
.spac {
font-size: 100px;
line-height: 200px;

View File

@ -1,10 +1,11 @@
$(function() {
$bord = $('#bord')
$audi = $('#audi')
$whom = $('#whom')
lett = ["x","o"]
symb = [" ","✕","◯"]
draw = function(state) {
drab = function(state) {
space = function(_state,y,x) {
return "<div class='spac' data-index='"+y+"-"+x+
"'>"+symb[_state]+"</div>"
@ -22,32 +23,58 @@ $(function() {
}
}
$bord.html(s)
turn(state.who)
}
which = null
turn = function(who) {
$('body').toggleClass('turn',(who == which))
audi = function(state) {
a = "<h1>audience</h1>"
for(i=0;i<state.aud.length;i++) {
a += "<div class='ship'>"+state.aud[i].slice(1)+"</div>"
}
$audi.html(a)
}
assign = function(who) {
which = who
turn(who)
$('#ship .as').text(symb[Number(!lett.indexOf(who))+1])
$('#user .as').text(symb[lett.indexOf(who)+1])
who = null
turn = function(state) {
if(state.plx.slice(1) == window.urb.user)
who = "x"
if(state.plo.slice(1) == window.urb.user)
who = "o"
if(who == null && (state.plx == "" || state.plo == ""))
wurn = true
else
wurn = (state.who == who)
$('body').toggleClass('turn',wurn)
$('body').toggleClass('x',(state.who == 'x'))
$('body').toggleClass('o',(state.who == 'o'))
}
assign = function(state) {
if(!state.plo)
state.plo = ""
if(!state.plx)
state.plx = ""
$('#o .ship').toggleClass('waiting', (state.plo=="")).text(state.plo.slice(1))
$('#x .ship').toggleClass('waiting', (state.plx=="")).text(state.plx.slice(1))
}
message = function(mess) {
mess = mess.split('"')[1]
mess = mess.split("=")
mess = "<div class='ship'>"+mess[0].slice(1)+"</div> ["+symb[lett.indexOf(mess[1].toLowerCase())+1]+"] WINS"
$('body').append('<div id="message">'+mess+'</div>')
setTimeout(function() { $('#message').fadeOut().remove(); }, 2000)
}
urb.appl = 'octo'
urb.bind('/octo/web', function(err,res) {
if(which == null) { assign(res.data.who) }
draw(res.data)
urb.bind('/octo', function(err,res) {
if(typeof(res.data) == 'string')
return message(res.data)
assign(res.data)
drab(res.data)
audi(res.data)
turn(res.data)
})
// draw({
// box:[false,false,false,false,false,false,false,false,false],
// boo:[false,false,false,false,false,false,false,false,false]
// })
$bord.on('click', function(e) {
if(!$('body').hasClass('turn')) { return false }
$t = $(e.target).closest('.spac')
@ -56,7 +83,4 @@ $(function() {
function(i) { return Number(i); })
urb.send({mark:'octo-move',data:data})
})
$('#ship .ship').text(window.urb.ship)
$('#user .ship').text(window.urb.user)
})

View File

@ -120,7 +120,6 @@ input {
display: inline;
}
.ship {
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05rem;
}
@ -148,8 +147,8 @@ body {
position: fixed;
width: 58rem;
max-height: 4rem;
background-color: #ccc;
color: #fff;
background-color: rgba(255,255,255,0.95);
color: #555;
overflow: hidden;
z-index: 10;
border-bottom: 1px solid #ddd;
@ -166,7 +165,7 @@ body {
}
#messages-container {
vertical-align: top;
margin-top: 4rem;
margin-top: 5rem;
}
.caret,
.circle {
@ -204,13 +203,12 @@ body {
#head {
width: 100%;
height: 4rem;
background-color: #fff;
color: #333;
border-bottom: 1px solid #ddd;
}
#station-container h1 {
display: none;
color: #fff;
color: #555;
font-weight: 400;
font-size: 1rem;
letter-spacing: 0.06rem;
@ -285,6 +283,12 @@ body {
}
#members > div {
display: block;
max-width: 24rem;
overflow: hidden;
white-space: nowrap;
}
#members > div:hover {
white-space: normal;
}
#members > div div {
display: inline-block;
@ -431,11 +435,12 @@ a {
.type.private:before {
content: "•";
font-size: 1rem;
line-height: 0.7rem;
line-height: 1.1rem;
}
.type.public:before {
content: "▒";
line-height: 1.1rem;
font-size: 0.8rem;
line-height: 0.8rem;
}
.mess,
.iden,
@ -449,6 +454,7 @@ a {
vertical-align: top;
}
.attr > div {
line-height: 1.4rem;
max-width: 16rem;
}
.attr {

View File

@ -48,7 +48,6 @@ input
// font-size .7rem
.ship
font-weight 500
text-transform uppercase
letter-spacing .05rem
@ -80,8 +79,8 @@ body
position fixed
width 58rem
max-height 4rem
background-color #ccc
color white
background-color rgba(255,255,255,.95)
color #555
overflow hidden
z-index 10
border-bottom 1px solid #ddd
@ -144,13 +143,12 @@ body
#head
width 100%
height 4rem
background-color white
color #333
border-bottom 1px solid #ddd
#station-container h1
display none
color white
color #555
font-weight 400
font-size 1rem
letter-spacing .06rem
@ -225,6 +223,12 @@ body
#members > div
display block
max-width 24rem
overflow hidden
white-space nowrap
#members > div:hover
white-space normal
#members > div div
display inline-block
@ -385,7 +389,8 @@ a
.type.public:before
content ""
line-height 1.1rem
font-size .8rem
line-height .8rem
.mess
.iden