<script class="text/javascript" src="http://code.jquery.com/jquery-git.js"> </script>
<script class="text/javascript" src="http://code.jquery.com/jquery-git.js"></script>
<script class="text/javascript" src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<script class="text/javascript" src="https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Archivo+Black' rel='stylesheet' type='text/css'>
<h1>Big Bold and New.</h1>
<div class="stack">
<div class="row"></div>
<div class="row"></div>
</div>•
<div class="spot"><div class="place"></div></div>
<div class="spot"><div class="place"></div></div>
: #D5D3D0;
#D5D3D0;:
body { background-color: ; }
h1 { font-family: "Segoe UI"; color: #302E2F; font-size: 4.6em; font-weight: normal; }
/*PIECES*/
#302E2F; : #00C8FF; : #ED1C24; : #EC008C; : #56A02B;:
.black { color: ; }
.blue { color: ; }
.red { color: ; }
.green { color: ; }
.empty { color: rgba(0,0,0,0); }
beige;:
40px;:
26px;:
3px;:
1px;:
2;: +( + )*
2;: +( + )*
.piece {
display: inline-block;
background-color: ;
border-radius: 2px;
height: ;
width: ;
text-align: center;
text-shadow: 1px 1px #FFFFFF;
padding: ;
cursor: pointer;
border-radius: ;
font-size: 1em;
font-family: 'Archivo Black', 'Arial Black';
margin: ;
user-select: none;
}
.piece:after { position: relative; text-align: center; top: -10px; content: "●"; }
.empty:after { position: relative; text-align: center; top: -10px; content: "_"; }
.empty { text-shadow: 0px 0px rgba(0,0,0,0); }
.piece {
border-top: 2px solid white;
border-left: 2px solid white;
border-right: 2px solid gray;
border-bottom: 2px solid gray;
}
.piece.ui-draggable-dragging { box-shadow: 1px 1px 1px black; transform: scale(1.1) rotateX(-30deg); }
/*PLACES*/
4;: +
.place { display: inline-block; height: ; width: ; }
.high { background-color: orange; }
.high>.piece:not(.ui-draggable-dragging) { border: 2px solid black; }
/*STACK*/
#FFD39B;:
10px; : 2px;:
.row { background: ; margin: ; }
: ;
.stack {
background-color: ;
border-bottom: 2px solid ;
width: *15+(2* );
user-select: none;
}
/*SPOT*/
.spot {
position: relative;
float: left;
/*background-color: @rc;*/
padding: 10px;
border: dashed ;
border-radius: 10px;
}
var o = $('body');
var o = $('body');
var s = $('.stack');
function piece(c,n)
{
return $('<div/>', { class: c + " piece", text: n }).append("<br/>").draggable({
revert: true,
zIndex: 99999, opacity: 0.8
});
}
//////////
function place() { return $('<div />', { class: "place" }); }
function createStack() { for (var i = 0; i < 15; i++) $('.row').append(place()); }
var zp = { top: 0, left: 0 };
function drop(event,ui) {
var p = ui.draggable;
var c = $(this);
if (c.is(':empty')) dropEmpty(c, p);
else dropSwap (c, p);
}
function dropEmpty(c, p) { c.append(p.detach().css(zp)); }
function dropSwap (c, p) {
var pc = p.parent(); var cp = c.children().first();
dropEmpty(pc, cp); dropEmpty(c, p);
}
createStack();
$(".place").droppable({ accept: ".piece", drop: drop, hoverClass: "high" });
//////////
function e() { return piece("empty", ''); }
function g(x) { return piece("green", x); } function d(x) { return piece("black", x); }
function r(x) { return piece("red" , x); } function b(x) { return piece("blue" , x); }
o.append([g(1),r(8),d(7),b(10),r(5),d(12),d(5),g(10),b(5),b(1),b(9),r(4),r(13),b(4),e()]);
//////////
function rnd(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }
function rndPick(xs) { return xs[rnd(0,xs.length-1)]; }
function rndPut(e) { rndPick($('.row>.place:empty')).appendChild(e); }
function rndPutAll(s) { var ps = $(s); for (var i = 0; i < ps.length; i++) rndPut(rndPick($(s))); }
rndPutAll('body>.piece');
//////////
//////////
$('.spot').draggable();
$('.stack').draggable();
$('h1').draggable();