├── .gitignore ├── README.md ├── css ├── _utils.scss ├── styles.scss └── styles.css ├── index.html └── js └── App.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .sass-cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BytesJack — An HTML Blackjack game 2 | ================================== 3 | BytesJack is an HTML / JS powered Blackjack game initially developped for the [10k Apart contest](http://10k.aneventapart.com/). 4 | 5 | 6 | Features 7 | -------- 8 | - HMTL / CSS only deck of cards. No image whatsoever. 9 | - Client side scripting only. 10 | - Under 10k (zipped). 11 | - Okay, we do have one tiny Data-URI...sorry :( 12 | 13 | TODO (Future releases...maybe) 14 | ------------------------------ 15 | - Split. 16 | - Surrender. -------------------------------------------------------------------------------- /css/_utils.scss: -------------------------------------------------------------------------------- 1 | // Scss Utils 2 | // @author EtienneLem 3 | 4 | // CSS3 misc 5 | @mixin rounded ( $radius, $prefix:'' ) { 6 | @include prefixes(border-radius, $radius, $prefix); 7 | } 8 | 9 | @mixin box-shadow ( $value ) { 10 | @include prefixes(box-shadow, $value); 11 | } 12 | 13 | @mixin gradient-top-bottom ( $top, $bottom ) { 14 | background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, $bottom), color-stop(1, $top)); 15 | background-image: -moz-linear-gradient( center bottom, $bottom 0%, $top 100%); 16 | 17 | } 18 | 19 | @mixin gradient-radial ( $center, $edge, $size:farthest-corner ) { 20 | background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 560, from($center), to($edge)); 21 | background-image: -webkit-radial-gradient(center center, ellipse $size, $center, $edge ); 22 | background-image: -moz-radial-gradient(center center, ellipse $size, $center, $edge ); 23 | background-image: -ms-radial-gradient(center center, ellipse $size, $center, $edge ); 24 | background-image: -o-radial-gradient(center center, ellipse $size, $center, $edge ); 25 | background-image: -khtml-radial-gradient(center center, ellipse $size, $center, $edge ); 26 | } 27 | 28 | // Animation 29 | @mixin transition ( $value ) { 30 | @include prefixes(transition, $value); 31 | } 32 | 33 | @mixin translate3d ( $value ) { 34 | $action: translate3d($value); 35 | @include transform($action); 36 | } 37 | 38 | // Transforms 39 | @mixin skew ( $deg ) { 40 | $action: skew($value); 41 | @include transform($action); 42 | } 43 | 44 | @mixin scale ( $value ) { 45 | $action: scale($value); 46 | @include transform($action); 47 | } 48 | 49 | @mixin rotate ( $deg ) { 50 | $action: rotate($deg); 51 | @include transform($action); 52 | } 53 | 54 | @mixin rotateY ( $deg ) { 55 | $action: rotateY($deg); 56 | @include transform($action); 57 | } 58 | 59 | @mixin transform ( $value ) { 60 | @include prefixes(transform, $value); 61 | } 62 | 63 | // Utils 64 | @mixin prefixes ( $key, $value, $prefix:'' ) 65 | { 66 | $prefixes: -webkit, -khtml, -moz, -ms, -o; 67 | @if $prefix != '' { $prefixes: $prefix } 68 | @each $prefix in $prefixes { 69 | #{$prefix}-#{$key} : $value; 70 | } 71 | @if $prefix == '' { #{$key} : $value; } 72 | } 73 | 74 | @mixin noselect() { 75 | @include prefixes(user-select, none); 76 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BytesJack ♠ An HTML Blackjack game 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Fork me on GitHub 17 | 18 |
19 |

BytesJack

20 |
21 |
22 | 23 |
24 | 25 |
Dealer
26 | 27 |
28 | Your Bytes 29 | Your Bet 30 |
10k
31 |
Dealspacebar
32 | 37 |
38 |
100b
39 |
500b
40 |
1k
41 |
42 |
43 | 44 |
Player
45 | 46 |
47 | 48 |
49 |
50 | 51 | 52 | 53 | 62 | 63 | -------------------------------------------------------------------------------- /css/styles.scss: -------------------------------------------------------------------------------- 1 | @import "utils"; 2 | 3 | // Utils ---------------------------------------------- 4 | * { margin: 0; padding: 0; } 5 | body, html { width: 100%; height: 100%; 6 | -webkit-font-smoothing: antialiased; 7 | } 8 | .desactivate { opacity: 0.2; } 9 | 10 | // Game ----------------------------------------------- 11 | #game { 12 | background-color: #466d19; 13 | @include gradient-radial(#65981e, #184d08); 14 | overflow: hidden; 15 | position: relative; 16 | width: 100%; height: 100%; 17 | min-height: 480px; 18 | font: 400 16px/1.4 'futura-pt', Helvetica, Arial, sans-serif; 19 | 20 | h1 { 21 | font: 5em/1.5 'bello-pro','Cooper STD', Georgia, serif; 22 | margin: 5% auto; 23 | text-align: center; 24 | color: #2b5204; 25 | text-shadow: 0 -1px 3px rgba(0,0,0,0.2), 0 -1px 0px rgba(0,0,0,0.3), 0 1px 0 rgba(152,184,42,0.15), 0 1px 4px rgba(152,184,42,0.2); 26 | text-align: center; 27 | -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.4)), to(rgba(255,255,255, 1))); 28 | -webkit-background-clip: text; 29 | } 30 | .shortcut { 31 | display: block; 32 | padding: 1em 0; 33 | color: #77a421; 34 | font-size: 0.65em; 35 | letter-spacing: 0.1em; 36 | text-transform: uppercase; 37 | } 38 | 39 | // UI ------------------------------------------------- 40 | #ui { 41 | position: absolute; 42 | top: 40%; left: 50%; 43 | width: 75%; max-width: 1280px; 44 | height: 30%; max-height: 300px; 45 | margin: -6.5% 0 0 0; 46 | clear: both; 47 | color: #dce4c9; 48 | 49 | .zone { 50 | position: relative; 51 | width: auto; 52 | left: -50%; 53 | height: 45%; max-height: 110px; min-height: 90px; 54 | border: 9px solid #809d29; 55 | border-color: rgba(208,209,78,0.3); 56 | padding: 2%; 57 | @include rounded(30px); 58 | 59 | div, ul { 60 | width: 20%; 61 | } 62 | 63 | .label { 64 | position: absolute; 65 | top: -37px; left: 5%; 66 | font-size: 0.9em; 67 | text-transform: uppercase; 68 | letter-spacing: 0.15em; 69 | color: rgba(208,209,78,0.3); 70 | 71 | &.right { left: auto; right: 5%; } 72 | } 73 | 74 | #bankroll { 75 | position: absolute; 76 | top: 50%; left: 0; 77 | font-size: 4.5em; 78 | margin: -50px 5% 0 0; 79 | text-align: center; 80 | } 81 | 82 | #deal, #actions { 83 | width: 50%; 84 | height: 100%; 85 | margin: auto; 86 | text-align: center; 87 | list-style: none; 88 | 89 | a, li a { 90 | background-color: #ffe000; 91 | position: relative; 92 | @include gradient-top-bottom(#ffec01,#ffc900); 93 | display: block; 94 | padding: 5% 5% 3.875% 5%; 95 | color: #724a0e; 96 | font: 2.5em/1 'bello-pro','Cooper STD', Georgia, serif; 97 | text-decoration: none; 98 | text-shadow: 0 1px 0px rgba(255,255,255,0.3), 0px -1px 0px rgba(0,0,0,0.2); 99 | @include box-shadow(#{ 100 | inset 0px 2px 0 rgba(255,255,255,0.3), 101 | inset 0px -2px 0 rgba(255,255,255,0.1), 102 | 0px 5px 0px 0px #daa206, 103 | 0px 5px 0px 2px rgba(0,0,0,0.2)}); 104 | @include rounded(12px); 105 | @include transition(#{box-shadow 150ms ease-out}); 106 | 107 | &:hover, &:focus { @include box-shadow(#{inset 0px 2px 0 rgba(255,255,255,0.3), inset 0px -2px 0 rgba(255,255,255,0.1), 0px 5px 0px 0px #daa206, 0px 5px 0px 2px rgba(0,0,0,0.2), 0 0 30px rgba(255,246,0,0.8)}); }; 108 | &:active, &.active { 109 | top: 2px; 110 | @include box-shadow(#{ 111 | inset 0px 2px 0 rgba(255,255,255,0.3), 112 | inset 0px -2px 0 rgba(255,255,255,0.1), 113 | 0px 3px 0px 0px #daa206, 114 | 0px 3px 0px 2px rgba(0,0,0,0.2)}); 115 | } 116 | } 117 | a.desactivate, a.desactivate:hover { 118 | opacity: 1; 119 | cursor: default; 120 | background-color: #cac6be; 121 | @include gradient-top-bottom(#dad7d2,#9c9486); 122 | @include transition(none); 123 | color: #aaa395; 124 | text-shadow: 0 1px 0px rgba(255,255,255,0.2), 0px -1px 0px rgba(0,0,0,0.1); 125 | @include box-shadow(#{ 126 | inset 0px 2px 0 rgba(255,255,255,0.4), 127 | inset 0px -2px 0 rgba(255,255,255,0.1), 128 | 0px 5px 0px 0px #898367, 129 | 0px 5px 0px 2px rgba(0,0,0,0.2)}); 130 | } 131 | 132 | li { 133 | display: block; 134 | width: 29.4%; 135 | margin: 0 1%; 136 | float: left; 137 | a { 138 | padding: 22% 5% 20% 5%; 139 | font-size: 1.5em; 140 | } 141 | } 142 | } 143 | } // #zone 144 | 145 | .total { 146 | position: relative; 147 | left: -12.5%; 148 | background-color: #809d29; 149 | background-color: rgba(208,209,78,0.3); 150 | width: 25%; 151 | padding: 0.75em 0 0.5em 0; 152 | color: #437714; 153 | font-size: 1em; 154 | letter-spacing: 0.15em; 155 | text-align: center; 156 | text-transform: uppercase; 157 | text-shadow: 0 1px 0 rgba(255,255,255,0.1); 158 | @include rounded(9px 9px 0px 0px); 159 | } 160 | .total.bot { 161 | @include rounded( 0 0 9px 9px); 162 | padding: 0.5em 0 0.75em 0; 163 | } 164 | 165 | #chips { 166 | position: absolute; 167 | width: 0; 168 | top: 0; 169 | right: 0; 170 | 171 | .chip { position: absolute; top: 0; left: 0; @include transition(all 250ms ease-out); } 172 | .chip:nth-child(1) { left: auto; right: 10px; &::before{ display: none; } } 173 | .chip:nth-child(2) { left: 10px; top: -70px; &::before{ top: -25%; } } 174 | .chip:nth-child(3) { left: 10px; top: 70px; &::before{ top: 115%; } } 175 | } 176 | 177 | #chips.disabled { .chip:nth-child(2), .chip:nth-child(3) { opacity: 0; } } 178 | #actions { display: none; } 179 | } 180 | #player-cards, #dealer-cards { 181 | position: absolute; 182 | left: 50%; 183 | width: 100%; height: 460px; 184 | -webkit-transform: translate3d(0,0,0); 185 | @include transition(all 200ms ease-out); 186 | 187 | .card { 188 | -webkit-backface-visibility: hidden; 189 | background-color: #f9f9f9; 190 | position: absolute; 191 | top: 0; left: 0; 192 | @include transition(all 250ms ease-in-out); 193 | @include box-shadow(#{inset 0 0 1px #fff, inset 0 0 60px rgba(139,118,109,0.1), 0 1px 3px rgba(0,0,15,0.3), 0 0 5px rgba(0,0,15,0.1)}); 194 | @include gradient-top-bottom(#f5f5f5, #edeae6); 195 | &.back { 196 | background-color: #fd4000; 197 | @include box-shadow(#{inset 0 0 50px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,15,0.3), 0 0 5px rgba(0,0,15,0.1)}); 198 | background: #fd4000 url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAKCAYAAACJxx+AAAAATElEQVQYGWP4/9XN+P///wy4MEQClyKgOEInuiIoH6EAZA1MEYwGiqEqQFYEdRcTAwFAUAGqFTC7YTSKG5AEwWEC5UNMQJeEOhDkKwDfGrdliFgHkAAAAABJRU5ErkJggg=='); 199 | } 200 | } 201 | } 202 | #dealer-cards .card > .icons { 203 | @include rotate(180deg); 204 | } 205 | 206 | #dealer-cards { top: -200px; 207 | .card { 208 | @include gradient-top-bottom(#edeae6, #f9f9f9); 209 | } 210 | } 211 | #player-cards { bottom: -120px; } 212 | #player-total, #dealer-total { font-size: 1em; color: #fff; } 213 | } 214 | 215 | #message { 216 | z-index: 999; 217 | position: absolute; 218 | bottom: 8%; left: 0; 219 | width: 100%; 220 | opacity: 1; 221 | color: #ffd801; 222 | font-size: 5em; 223 | font-weight: bold; 224 | font-family: 'bello-pro'; 225 | font-size: 5em; 226 | line-height: 1; 227 | text-align: center; 228 | text-shadow: 229 | 0px 2px 0px #daa206, 230 | 0px 1px 6px rgba(0,0,0,0.1); 231 | 232 | span { 233 | display: block; 234 | clear: both; 235 | color: #3c2f29; 236 | font-family: 'futura-pt', Helvetica, Arial, sans-serif; 237 | font-size: 0.5em; 238 | font-weight: bold; 239 | text-transform: uppercase; 240 | text-shadow: none; 241 | text-shadow: 0 1px 4px rgba(0,0,0,0.1); 242 | } 243 | -webkit-animation: fadeIn3d 1000ms ease-in-out; 244 | 245 | &.game-over { 246 | bottom: 45%; 247 | -webkit-animation: fadeIn3d 1000ms ease-in-out; 248 | } 249 | } 250 | #message.lose, #message.lose-busted, #message.lose-blackjack, #message.game-over { 251 | color: #f14700; 252 | text-shadow: 253 | 0 -1px 0px #f36c30, 254 | 0px 2px 0px #cf3600, 255 | 0px 4px 21px rgba(60,47,41,0.17); 256 | span { 257 | color: #3c2f29; 258 | } 259 | } 260 | #overlay { 261 | position: absolute; 262 | z-index: 998; 263 | top: 0; left: 0; 264 | width: 100%; height: 100%; 265 | min-height: 420px; 266 | background-color: rgba(0,0,0,0.6); 267 | } 268 | @-webkit-keyframes fadeIn3d { 269 | 0% { opacity: 0; @include translate3d(#{0,0,0}); } 270 | 75% { opacity: 1; } 271 | 100% { @include translate3d(#{0,-75px,0}); } 272 | } 273 | @-webkit-keyframes messageFade { 274 | 0% { opacity: 0; /*letter-spacing: 0em;*/ } 275 | 10% { opacity: 1; } 276 | 70% { opacity: 1; } 277 | 100% { opacity: 0; /*letter-spacing: 0.6em;*/ } 278 | } 279 | @-webkit-keyframes dealPulse { 280 | 0% { -webkit-box-shadow: inset 0px 2px 0 rgba(255,255,255,0.3), inset 0px -2px 0 rgba(255,255,255,0.1), 0px 5px 0px 0px #daa206, 0px 5px 0px 2px rgba(0,0,0,0.2), 0 0 6px rgba(255,246,0,0.8); } 281 | 100% { -webkit-box-shadow: inset 0px 2px 0 rgba(255,255,255,0.3), inset 0px -2px 0 rgba(255,255,255,0.1), 0px 5px 0px 0px #daa206, 0px 5px 0px 2px rgba(0,0,0,0.2), 0 0 40px rgba(255,246,0,0.8); } 282 | } 283 | 284 | // Chips ---------------------------------------------- 285 | 286 | #chips:hover .chip { opacity: 0.8; } 287 | #chips:hover .chip:hover { opacity: 1; } 288 | .chip { 289 | cursor: pointer; 290 | float: left; 291 | margin: 0 10px 0 0; 292 | padding: 4px; 293 | background-color: #007cff; 294 | position: relative; 295 | width: 100px !important; 296 | height: 100px; 297 | border: 10px dashed #fff; 298 | @include box-shadow(#{0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0,0,0,0.2)}); 299 | @include noselect(); 300 | @include rounded(100px); 301 | @include transition(all 100ms ease-out); 302 | 303 | &:hover{ 304 | @include rotate(5deg); 305 | } 306 | span { 307 | display: block; 308 | width: 100%; 309 | height: 100%; 310 | color: #fff; 311 | font-size: 2em; 312 | line-height: 102px; 313 | text-align: center; 314 | text-shadow: 0 -1px 0px rgba(0,0,0,0.3); 315 | background-color: #0261f1; 316 | @include rounded(100px); 317 | @include gradient-top-bottom(#037ff4, #0274f3); 318 | @include box-shadow(#{0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1}); 319 | } 320 | 321 | &::before { 322 | position: absolute; 323 | color: #77a421; 324 | font-size: 0.65em; 325 | letter-spacing: 0.1em; 326 | text-transform: uppercase; 327 | left: 49%; 328 | } 329 | 330 | } 331 | 332 | .chip.blue { 333 | background-color: #007cff; 334 | @include box-shadow(#{0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0,0,0,0.2)}); 335 | 336 | span { 337 | background-color: #0261f1; 338 | @include gradient-top-bottom(#037ff4, #0274f3); 339 | @include box-shadow(#{0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1}); 340 | } 341 | 342 | &::before { content: '2'; } 343 | } 344 | 345 | .chip.red { 346 | background-color: #f54800; 347 | @include box-shadow(#{0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0,0,0,0.2)}); 348 | 349 | span { 350 | background-color: #eb4603; 351 | @include gradient-top-bottom(#ef4d00, #ed4300); 352 | @include box-shadow(#{0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400}); 353 | } 354 | 355 | &::before { content: '1'; } 356 | } 357 | 358 | .chip.yellow { 359 | background-color: #f3cf00; 360 | @include box-shadow(#{0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0,0,0,0.2)}); 361 | 362 | span { 363 | background-color: #ebc700; 364 | @include gradient-top-bottom(#ecc300, #ebcd00); 365 | @include box-shadow(#{0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00}); 366 | } 367 | 368 | &::before { content: '3'; } 369 | } 370 | 371 | 372 | 373 | // Cards ---------------------------------------------- 374 | .card { 375 | font-size: 1.5em; 376 | z-index: 1; 377 | position: relative; 378 | width: 300px; height: 460px; 379 | border-radius: 20px; 380 | @include noselect(); 381 | 382 | 383 | div { 384 | position: absolute; 385 | &:first-child { top: 2%; left: 5%; } 386 | &:last-child { bottom: 2%; right: 5%; @include rotate(180deg); } 387 | 388 | span { 389 | text-align: center; 390 | display: block; 391 | } 392 | 393 | .icons { 394 | position: absolute; 395 | top: 0; left: 0; 396 | width: 1px; height: 1px; 397 | 398 | & > div { position: relative; } 399 | } 400 | } 401 | 402 | .icons { 403 | position: absolute; 404 | top: 50%; left: 50%; 405 | 406 | span { position: absolute; font-size: 4em; left: -26px; } 407 | } 408 | } 409 | 410 | .card.hearts, .card.diamonds { color: #f14000; } 411 | .card.spades, .card.clubs { color: #3c2f29; } 412 | .card.valueA > .icons span { top: -70px; } 413 | .card.value2 > .icons, 414 | .card.value3 > .icons { 415 | span:nth-child(1) { top: -170px; } 416 | span:nth-child(2) { bottom: -170px; } 417 | span:nth-child(3) { top: -65px; } 418 | } 419 | .card.value4 > .icons, 420 | .card.value5 > .icons { 421 | span:nth-child(1) { top: -170px; left: -90px; } 422 | span:nth-child(2) { top: -170px; right: -90px; left: auto; } 423 | span:nth-child(3) { bottom: -170px; left: -90px; } 424 | span:nth-child(4) { bottom: -170px; right: -90px; left: auto; } 425 | span:nth-child(5) { top: -65px; } 426 | } 427 | .card.value6 > .icons, 428 | .card.value7 > .icons, 429 | .card.value8 > .icons { 430 | span:nth-child(1) { top: -170px; left: -90px; } 431 | span:nth-child(2) { top: -170px; right: -90px; left: auto; } 432 | span:nth-child(3) { bottom: -170px; left: -90px; } 433 | span:nth-child(4) { bottom: -170px; right: -90px; left: auto; } 434 | span:nth-child(5) { top: -65px; left: -90px; } 435 | span:nth-child(6) { top: -65px; right: -90px; left: auto; } 436 | span:nth-child(7) { top: -120px; } 437 | span:nth-child(8) { bottom: -120px; } 438 | } 439 | .card.value9 > .icons { 440 | span:nth-child(1) { top: -190px; left: -90px; } 441 | span:nth-child(2) { top: -110px; left: -90px; } 442 | span:nth-child(3) { bottom: -110px; left: -90px; } 443 | span:nth-child(4) { bottom: -190px; left: -90px; } 444 | span:nth-child(5) { top: -190px; right: -90px; left: auto; } 445 | span:nth-child(6) { top: -110px; right: -90px; left: auto; } 446 | span:nth-child(7) { bottom: -110px; right: -90px; left: auto; } 447 | span:nth-child(8) { bottom: -190px; right: -90px; left: auto; } 448 | span:nth-child(9) { top: -65px; } 449 | } 450 | .card.value10 > .icons { 451 | span:nth-child(1) { top: -190px; left: -90px; } 452 | span:nth-child(2) { top: -110px; left: -90px; } 453 | span:nth-child(3) { bottom: -110px; left: -90px; } 454 | span:nth-child(4) { bottom: -190px; left: -90px; } 455 | span:nth-child(5) { top: -190px; right: -90px; left: auto; } 456 | span:nth-child(6) { top: -110px; right: -90px; left: auto; } 457 | span:nth-child(7) { bottom: -110px; right: -90px; left: auto; } 458 | span:nth-child(8) { bottom: -190px; right: -90px; left: auto; } 459 | span:nth-child(9) { top: -155px; } 460 | span:nth-child(10) { bottom: -155px; } 461 | } 462 | .card.valueJ > .icons > span, 463 | .card.valueQ > .icons > span, 464 | .card.valueK > .icons > span { 465 | font-size: 6em; 466 | top: -100px; left: -70px; 467 | } 468 | 469 | // Browser hacks 470 | html[browser="Firefox"] { 471 | .chip { 472 | border-color: rgba(255,255,255,0.1); 473 | } 474 | } 475 | 476 | html[browser="Safari"] { 477 | #game #ui .zone #deal li, #game #ui .zone #actions li { 478 | margin: 0 2%; 479 | } 480 | 481 | #message { bottom: 0; @include translate3d(#{0,-75px,0}); } 482 | } 483 | 484 | html[os="iPhone/iPod"] { 485 | #game #player-cards .card, #game #dealer-cards .card { 486 | @include transition(none); 487 | } 488 | } 489 | 490 | // Media Queries 491 | @media screen and (max-height: 1024px) { 492 | #game { 493 | #dealer-cards { top: -260px; } 494 | #player-cards { bottom: -240px; } 495 | } 496 | } 497 | @media screen and (max-height: 910px) { 498 | #game { 499 | #player-cards { bottom: -300px; } 500 | } 501 | } 502 | @media screen and (max-height: 768px) { 503 | #game { 504 | #dealer-cards { top: -270px; } 505 | } 506 | } 507 | @media screen and (max-height: 660px) { 508 | #game { 509 | #dealer-cards { top: -350px; } 510 | } 511 | } 512 | @media screen and (max-height: 550px) and (max-width: 768px) { 513 | #game { 514 | #dealer-cards { top: -350px; } 515 | #player-cards { bottom: -350px; } 516 | } 517 | } 518 | @media screen and (max-height: 620px) and (max-width: 480px) { 519 | #game { 520 | #dealer-cards { top: -200px; } 521 | } 522 | } 523 | @media screen and (max-height: 550px) and (max-width: 320px) { 524 | #game { 525 | #dealer-cards { top: -150px; } 526 | } 527 | } 528 | @media screen and (max-height: 320px) and (max-width: 480px) { 529 | #game { 530 | #dealer-cards { top: -250px; } 531 | } 532 | } 533 | 534 | 535 | @media screen and (max-width: 1024px) { 536 | #game { 537 | .chip { 538 | padding: 4px; 539 | width: 80px !important; 540 | height: 80px; 541 | 542 | span { 543 | font-size: 1.5em; 544 | line-height: 82px; 545 | } 546 | } 547 | } 548 | } 549 | 550 | @media screen and (max-width: 768px) { // New #zone layout 551 | #game { 552 | 553 | h1 { 554 | margin: 10% auto 0 auto; 555 | } 556 | 557 | #ui { 558 | width: 95%; 559 | height: 40%; max-height: 500px; 560 | 561 | top: 35%; 562 | 563 | .zone { 564 | height: 66%; max-height: 300px; 565 | @include rounded(21px); 566 | 567 | .label { top: -30px; } 568 | 569 | #deal, #actions { 570 | position: absolute; 571 | top: auto; 572 | bottom: 10%; 573 | width: 96%; 574 | height: auto; 575 | 576 | } 577 | .shortcut { 578 | display: none; 579 | } 580 | #bankroll { 581 | top: 0; 582 | margin: 4%; 583 | } 584 | } //.zone 585 | 586 | #chips { 587 | width: auto; 588 | top: 10px; right: 2px; 589 | 590 | .chip { 591 | float: none; 592 | opacity: 0.35; 593 | top: 0 !important; left: auto !important; 594 | 595 | &::before { display: none; } 596 | &.bet { opacity: 1; } 597 | &.red { right: 236px; } 598 | &.blue { right: 118px; } 599 | &.yellow { right: 0px; } 600 | } 601 | } // #chips 602 | } // #ui 603 | } // #gane 604 | } 605 | 606 | @media screen and (max-width: 768px) and (max-height: 825px) { 607 | #game { 608 | font-size: 12px; 609 | 610 | #ui .zone #chips .chip { 611 | padding: 4px; 612 | width: 50px !important; 613 | height: 50px; 614 | margin: 3px; 615 | border: 4px dashed #fff; 616 | 617 | span { 618 | font-size: 1.4em; 619 | line-height: 52px; 620 | } 621 | 622 | &.red { right: 145px; } 623 | &.blue { right: 72px; } 624 | &.yellow { right: 0px; } 625 | } 626 | } 627 | } 628 | 629 | @media screen and (max-width: 575px) { 630 | #game { 631 | font-size: 12px; 632 | 633 | #ui { 634 | .zone { 635 | #bankroll { 636 | font-size: 4em; 637 | } 638 | } 639 | } 640 | 641 | #ui .zone #chips .chip { 642 | padding: 4px; 643 | width: 30px !important; 644 | height: 30px; 645 | border: 3px dashed #fff; 646 | 647 | span { 648 | font-size: 1em; 649 | line-height: 32px; 650 | } 651 | 652 | &.red { right: 98px; } 653 | &.blue { right: 49px; } 654 | &.yellow { right: 0px; } 655 | } 656 | 657 | .card { 658 | font-size: 1.5em; 659 | position: relative; 660 | width: 220px; height: 337.333333px; 661 | 662 | .icons { 663 | display: none; 664 | } 665 | } 666 | } 667 | } 668 | @media screen and (max-width: 450px) { 669 | #github-ribbon { display: none; } 670 | } 671 | @media screen and (max-width: 480px) and (max-height: 320px){ 672 | #game { 673 | h1 { 674 | margin: 2% auto 0 auto; 675 | } 676 | 677 | #ui{ 678 | margin: -15% 0 0 0; 679 | .zone { 680 | height: 70% 681 | } 682 | } 683 | } 684 | } 685 | 686 | @media screen and (max-width: 320px) { 687 | #game { 688 | min-height: 420px; 689 | background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 260, from(#65981e), to(#184d08)); 690 | 691 | h1 { 692 | font-size: 4em; 693 | margin: 2%; 694 | color: #2b4f05; 695 | } 696 | 697 | #ui { 698 | margin: -15% 0 0 0; 699 | 700 | .zone { 701 | padding: 1% 2%; 702 | height: 75%; 703 | max-height: 160px; 704 | 705 | #bankroll { 706 | top: -3px; 707 | font-size: 4em; 708 | } 709 | } 710 | 711 | #chips .chip { 712 | padding: 4px; 713 | width: 30px !important; 714 | height: 30px; 715 | margin: 3px; 716 | border: 3px dashed #fff; 717 | 718 | span { 719 | font-size: 1em; 720 | line-height: 30px; 721 | } 722 | 723 | &.red { right: 98px; } 724 | &.blue { right: 49px; } 725 | &.yellow { right: 0px; } 726 | } 727 | } 728 | 729 | .card { 730 | font-size: 1.5em; 731 | position: relative; 732 | width: 150px; height: 230px; 733 | 734 | 735 | .icons { 736 | display: none; 737 | } 738 | } 739 | } 740 | } -------------------------------------------------------------------------------- /js/App.js: -------------------------------------------------------------------------------- 1 | /* 2 | * BytesJack 3 | * 4 | * Dev Etienne Lemay 5 | * Design Tristan L'abbé 6 | * 7 | * Special thanks to rafBM for some JS tricks! 8 | */ 9 | 10 | // Static class hack (auto init) 11 | $(document).ready(function(){ window.App = new App() }); 12 | 13 | // Class 14 | var App = function() { this.initialize.apply(this, arguments) }; 15 | App.prototype = (function() { var pro = {}; 16 | 17 | // Contants 18 | var ANIM_DELAY = 300, 19 | KEY_SPACE = 32, 20 | KEY_S = 83, 21 | KEY_D = 68, 22 | KEY_1 = 49, 23 | KEY_2 = 50, 24 | KEY_3 = 51, 25 | PATTERNS = [ 26 | [{deg: 0, top: 0}], 27 | [{deg: 5, top: 0}, {deg: -5, top: 0}], 28 | [{deg: 5, top: 15}, {deg: -1, top: 0}, {deg: -5, top: 15}], 29 | [{deg: 9, top: 20}, {deg: 4, top: 0}, {deg: -4, top: 0}, {deg: -9, top: 15}], 30 | [{deg: 12, top: 50}, {deg: 8, top: 10}, {deg: -4, top: 0}, {deg: -12, top: 15}, {deg: -16, top: 40}], 31 | [{deg: 14, top: 40}, {deg: 8, top: 10}, {deg: -2, top: 5}, {deg: -5, top: 15}, {deg: -8, top: 40}, {deg: -14, top: 70}], 32 | [{deg: 14, top: 70}, {deg: 8, top: 30}, {deg: 4, top: 10}, {deg: 0, top: 5}, {deg: -4, top: 20}, {deg: -8, top: 40}, {deg: -16, top: 70}] 33 | ]; 34 | 35 | // Variables 36 | var types = ['clubs', 'diamonds', 'hearts', 'spades'], 37 | cards = [], 38 | cardsIndex = 0, 39 | isPlaying = false, 40 | gameDealed = false, 41 | dealNav = $('#deal'), 42 | actionsNav = $('#actions'), 43 | doubleBtn = $('#double'), 44 | pCardsContainer = $('#player-cards'), 45 | dCardsContainer = $('#dealer-cards'), 46 | playerTotal = $('#player-total'), 47 | playerCards = [], 48 | playerAces = 0, 49 | dealerTotal = $('#dealer-total'), 50 | dealerCards = [], 51 | dealerAces = 0, 52 | chips = $('#chips'), 53 | allChips = $('.chip'), 54 | bank = 100, 55 | bankroll = $('#bankroll'), 56 | doubled = false, 57 | currentBet = allChips.first().data('value'), 58 | resizeTimer = null, 59 | canDoAction = true, 60 | isStanding = false, 61 | gameEnded = false, 62 | html = $('html'); 63 | 64 | // public 65 | pro.initialize = function(opts) { initialize() }; 66 | pro.deal = function() { deal() }; 67 | pro.hit = function() { hit() }; 68 | pro.stand = function() { stand() }; 69 | pro.doubledown = function() { doubledown() }; 70 | 71 | // private 72 | var initialize = function() 73 | { 74 | $('a[href="#"]').bind('click', function(e){ e.preventDefault(); }); 75 | initBet(); 76 | initResize(); 77 | initKeyboardKeys(); 78 | 79 | setTimeout(function(){ 80 | window.scrollTo(0, 1) 81 | }, 500); 82 | } 83 | 84 | // Resize management 85 | var initResize = function() 86 | { 87 | $(window).bind('resize', onWindowResize); 88 | onWindowResize(null); 89 | }; 90 | 91 | var onWindowResize = function ( e ) 92 | { 93 | clearTimeout(resizeTimer); 94 | resizeTimer = setTimeout(function(){ 95 | centerContainers(); 96 | }, 100); 97 | }; 98 | 99 | // Keyboard managment 100 | var initKeyboardKeys = function() { 101 | $(document).bind('keydown', onKeyDown); 102 | $(document).bind('keyup', onKeyUp); 103 | }; 104 | 105 | var onKeyDown = function ( e ) 106 | { 107 | switch ( e.keyCode ) { 108 | case KEY_SPACE : 109 | ( isPlaying ) 110 | ? actionsNav.children('li:first-child').children('a').addClass('active') 111 | : dealNav.children('a').addClass('active'); 112 | break; 113 | case KEY_S : actionsNav.children('li:nth-child(2)').children('a').addClass('active'); break; 114 | case KEY_D : actionsNav.children('li:nth-child(3)').children('a').addClass('active'); break; 115 | case KEY_1 : selectChip(0); break; 116 | case KEY_2 : selectChip(1); break; 117 | case KEY_3 : selectChip(2); break; 118 | } 119 | }; 120 | 121 | var onKeyUp = function ( e ) 122 | { 123 | e.preventDefault(); 124 | 125 | switch ( e.keyCode ) { 126 | case KEY_SPACE : 127 | if ( isPlaying ) { 128 | hit(); 129 | actionsNav.children('li:first-child').children('a').removeClass('active') 130 | } else { 131 | deal(); 132 | dealNav.children('a').removeClass('active'); 133 | } 134 | case KEY_S : 135 | stand(); 136 | actionsNav.children('li:nth-child(2)').children('a').removeClass('active'); 137 | break; 138 | case KEY_D : 139 | doubledown(); 140 | actionsNav.children('li:nth-child(3)').children('a').removeClass('active'); 141 | break; 142 | case KEY_1 : selectChip(0); break; 143 | case KEY_2 : selectChip(1); break; 144 | case KEY_3 : selectChip(2); break; 145 | } 146 | }; 147 | 148 | var selectChip = function ( index ) 149 | { 150 | if ( isPlaying || gameEnded ) return; 151 | allChips.eq(index).trigger('click'); 152 | }; 153 | 154 | // Cards management 155 | var initDeck = function() 156 | { 157 | for ( var i = 0; i < types.length; i++ ) { 158 | for ( var j = 1; j <= 13; j++ ) { 159 | var value = ( j > 10 ) ? 10 : j; 160 | cards.push({ card:j, value: value, type: types[i] }); 161 | }; 162 | } 163 | 164 | cards.shuffle(); 165 | }; 166 | 167 | var addCard = function ( side, player, callback ) 168 | { 169 | var cardData = cards[cardsIndex], 170 | container = ( player == 'player' ) ? pCardsContainer : dCardsContainer, 171 | card = buildCard(cardsIndex, cardData.type, cardData.card, side), 172 | zIndex = 0; 173 | 174 | cardsIndex++; 175 | canDoAction = false; 176 | 177 | card.css({ 178 | 'top' : '-150%', 179 | 'left' : '100%' 180 | }); 181 | 182 | container.append(card); 183 | zIndex = ( player == 'player' ) ? card.index() : 50-card.index(); 184 | card.css('z-index', zIndex); 185 | 186 | setTimeout(function(){ 187 | card.css({ 188 | 'top' : '0%', 189 | 'left' : 10 * card.index() + '%' 190 | }); 191 | rotateCards(container, (player == 'player')); 192 | 193 | 194 | setTimeout(function(){ 195 | centerContainer(container); 196 | if ( player == 'player' ) addToPlayerTotal(cardData.value); 197 | else addToDealerTotal(cardData.value); 198 | 199 | canDoAction = true; 200 | if ( callback != undefined ) callback.call(); 201 | }, ANIM_DELAY + 100); 202 | }, 10); 203 | }; 204 | 205 | var rotateCards = function ( container, isPlayer ) 206 | { 207 | var cards = container.children('.card'), 208 | numCards = cards.size() - 1, 209 | increment = ( isPlayer ) ? -1 : 1, 210 | pattern = ( PATTERNS[numCards] ) ? PATTERNS[numCards] : PATTERNS[PATTERNS.length-1]; 211 | 212 | cards.each(function(i){ 213 | var deg = ( i < pattern.length ) ? pattern[i].deg : pattern[pattern.length-1].deg, 214 | offset = ( i < pattern.length ) ? pattern[i].top : pattern[pattern.length-1].top + (20 * (i - pattern.length + 1)); 215 | 216 | $(this).css({ 217 | '-webkit-transform' : 'rotate('+ deg * increment +'deg)', 218 | '-khtml-transform' : 'rotate('+ deg * increment +'deg)', 219 | '-moz-transform' : 'rotate('+ deg * increment +'deg)', 220 | '-ms-transform' : 'rotate('+ deg * increment +'deg)', 221 | 'transform' : 'rotate('+ deg * increment +'deg)', 222 | 'top' : offset * -increment + 'px' 223 | }); 224 | }); 225 | }; 226 | 227 | var centerContainers = function() 228 | { 229 | centerContainer(pCardsContainer); 230 | centerContainer(dCardsContainer); 231 | }; 232 | 233 | var centerContainer = function ( container ) 234 | { 235 | var lastCard = container.children('.card:last-child'), 236 | totalWidth = 0; 237 | 238 | if ( lastCard.size() == 0 ) return; 239 | 240 | totalWidth = lastCard.position().left + lastCard.width(); 241 | if ( html.attr('browser') == 'Safari' ) 242 | container.css('-webkit-transform', 'translate3d('+ -totalWidth / 2 +'px,0,0)'); 243 | else 244 | container.css('margin-left', -totalWidth / 2 + 'px'); 245 | }; 246 | 247 | var buildCard = function (id, type, value, side) 248 | { 249 | var card; 250 | if ( side == 'back' ) card = $('
'); 251 | else { 252 | var cardValue = ( value == 1 ) ? 'A' : ( value == 11 ) ? 'J' : ( value == 12 ) ? 'Q' : ( value == 13 ) ? 'K' : value, 253 | cardIcon = ( type == 'hearts' ) ? '♥' : ( type == 'diamonds' ) ? '♦' : ( type == 'spades' ) ? '♠' : '♣', 254 | corner = '
'+cardValue+''+cardIcon+'
', 255 | icons = ''; 256 | 257 | if ( value <= 10 ) { 258 | for ( var i=1, l=value; i <= l; i++ ) { 259 | icons += ''+cardIcon+''; 260 | } 261 | } else icons = ( value == 11 ) ? '' : ( value == 12 ) ? '' : ( value == 13 ) ? '' : ''; 262 | 263 | card = $('
'+corner+'
'+icons+'
'+corner+'
'); 264 | } 265 | 266 | return card; 267 | }; 268 | 269 | // Game management 270 | var deal = function() 271 | { 272 | if ( isPlaying || !canDoAction || gameEnded ) return; 273 | 274 | isPlaying = true; 275 | 276 | if ( gameDealed ) { 277 | doubleBtn.removeClass('desactivate'); 278 | playerTotal.html(''); 279 | dealerTotal.html(''); 280 | playerAces = 0; 281 | dealerAces = 0; 282 | playerCards = []; 283 | dealerCards = []; 284 | cards = []; 285 | cardsIndex = 0; 286 | doubled = false; 287 | canDoAction = true; 288 | isStanding = false; 289 | $('#message').remove(); 290 | } 291 | 292 | pCardsContainer.html(''); 293 | dCardsContainer.html(''); 294 | initDeck(); 295 | 296 | changeBankroll(-1); 297 | ditributeCards(); 298 | gameDealed = true; 299 | }; 300 | 301 | var hit = function() 302 | { 303 | if ( !isPlaying || !canDoAction || isStanding || gameEnded ) return; 304 | 305 | doubleBtn.addClass('desactivate'); 306 | addCard('front', 'player', function(){ 307 | if ( playerCards.sum() > 21 ) lose('lose-busted'); 308 | }); 309 | }; 310 | 311 | var stand = function() 312 | { 313 | if ( !isPlaying || !canDoAction || isStanding || gameEnded ) return; 314 | 315 | isStanding = true; 316 | revealDealerCard(); 317 | 318 | setTimeout(function(){ 319 | if ( dealerCards.sum() < 17 ) dealerTurn(); 320 | else end(); 321 | }, ANIM_DELAY); 322 | }; 323 | 324 | var dealerTurn = function() 325 | { 326 | addCard('front', 'dealer', function(){ 327 | dealerTotal.html(calculateDealerScore()); 328 | 329 | if ( dealerCards.sum() < 17 ) dealerTurn(); 330 | else end(); 331 | }); 332 | }; 333 | 334 | var doubledown = function() 335 | { 336 | if ( !isPlaying || !canDoAction || isStanding || doubleBtn.hasClass('desactivate') || gameEnded ) return; 337 | 338 | changeBankroll(-1); 339 | doubled = true; 340 | addCard('front', 'player', function(){ 341 | if ( playerCards.sum() > 21 ) lose('lose-busted'); 342 | else stand(); 343 | }); 344 | }; 345 | 346 | var push = function ( msg ) 347 | { 348 | showMessage(msg); 349 | var increment = ( doubled ) ? 2 : 1; 350 | changeBankroll(increment); 351 | stopGame(); 352 | }; 353 | 354 | var win = function ( msg ) 355 | { 356 | showMessage(msg); 357 | var increment = ( doubled ) ? 4 : 2; 358 | changeBankroll(increment); 359 | stopGame(); 360 | }; 361 | 362 | var lose = function ( msg ) 363 | { 364 | showMessage(msg); 365 | changeBankroll(0); 366 | stopGame(); 367 | }; 368 | 369 | var showMessage = function ( status ) 370 | { 371 | var msg = document.createElement('div'), 372 | content = '', 373 | message = $('#message'); 374 | 375 | if ( message.size() > 0 ) message.remove(); 376 | 377 | msg.className = status; 378 | msg.id = 'message'; 379 | 380 | switch ( status ) { 381 | case 'win': content = 'You win'; break; 382 | case 'win-blackjack': content = 'You winBlackjack'; break; 383 | case 'win-dealer-busted': content = 'You winDealer busted'; break; 384 | case 'lose': content = 'You lose'; break; 385 | case 'lose-blackjack': content = 'You loseBlackjack'; break; 386 | case 'lose-busted': content = 'You loseBusted'; break; 387 | case 'push': content = 'PushNo winner'; break; 388 | case 'game-over': content = 'Game over'; break; 389 | default: content = 'Something broke, don’t know what happened...'; break; 390 | } 391 | 392 | msg.innerHTML = content; 393 | pCardsContainer.after(msg); 394 | }; 395 | 396 | var end = function() 397 | { 398 | var pScore = playerCards.sum(), 399 | dScore = dealerCards.sum(); 400 | 401 | if ( dScore > 21 ) win('win-dealer-busted'); 402 | else if ( dScore > pScore ) lose('lose'); 403 | else if ( pScore > dScore ) win('win'); 404 | else if ( pScore == dScore ) push('push'); 405 | }; 406 | 407 | var endGame = function() 408 | { 409 | showMessage('game-over'); 410 | gameEnded = true; 411 | 412 | var overlay = document.createElement('div'); 413 | overlay.id = 'overlay'; 414 | 415 | $('body').append(overlay); 416 | }; 417 | 418 | var stopGame = function() 419 | { 420 | isPlaying = false; 421 | dealNav.show(); 422 | actionsNav.hide(); 423 | chips.removeClass('disabled'); 424 | 425 | allChips.each(function(i){ 426 | var chip = $(this); 427 | if ( chip.data('value') > bank ) { 428 | chip.addClass('desactivate'); 429 | 430 | var chipsAvailable = allChips.removeClass('bet').not('.desactivate'); 431 | if ( chipsAvailable.size() == 0 ) endGame(); 432 | else { 433 | var newChip = chipsAvailable.last(); 434 | newChip.addClass('bet'); 435 | changeBet(newChip.data('value')); 436 | chips.prepend(newChip); 437 | } 438 | 439 | } else if ( chip.hasClass('desactivate') ) chip.removeClass('desactivate'); 440 | }); 441 | }; 442 | 443 | var ditributeCards = function() 444 | { 445 | canDoAction = false; 446 | 447 | addCard('front', 'player', function(){ 448 | addCard('front', 'dealer', function(){ 449 | addCard('front', 'player', function(){ 450 | addCard('back', 'dealer', function(){ 451 | checkBlackjack(); 452 | }); 453 | }); 454 | }); 455 | }); 456 | 457 | dealNav.hide(); 458 | actionsNav.show(); 459 | chips.addClass('disabled'); 460 | }; 461 | 462 | var checkBlackjack = function() 463 | { 464 | var pScore = playerCards.sum(), 465 | dScore = dealerCards.sum(); 466 | 467 | if ( pScore == 21 && dScore == 21 ) push('Push - No winner'); 468 | else if ( pScore == 21 ) win('win-blackjack'); 469 | else if ( dScore == 21 ) { 470 | lose('lose-blackjack'); 471 | revealDealerCard(); 472 | } 473 | }; 474 | 475 | // Player management 476 | var addToPlayerTotal = function ( value ) 477 | { 478 | if ( value == 1 ) { 479 | value = 11; 480 | playerAces++; 481 | } 482 | 483 | playerCards.push(value); 484 | playerTotal.html(calculatePlayerScore()); 485 | }; 486 | 487 | var calculatePlayerScore = function() 488 | { 489 | var score = playerCards.sum(); 490 | 491 | if ( score > 21 && playerAces > 0 ) { 492 | playerCards.splice(playerCards.indexOf(11), 1, 1); 493 | playerAces--; 494 | score = calculatePlayerScore(); 495 | } 496 | 497 | return score; 498 | }; 499 | 500 | // Dealer management 501 | var revealDealerCard = function() 502 | { 503 | var card = $('.back'), 504 | id = card.data('id'), 505 | data = cards[id], 506 | newCard = buildCard(id, data.type, data.value, 'front'); 507 | 508 | newCard.css({ 509 | 'left' : 10 * card.index() + '%', 510 | 'z-index' : 50-card.index() 511 | }); 512 | 513 | card.after(newCard).remove(); 514 | dealerTotal.html(calculateDealerScore()); 515 | }; 516 | 517 | var addToDealerTotal = function ( value ) 518 | { 519 | if ( value == 1 ) { 520 | value = 11; 521 | dealerAces++; 522 | } 523 | 524 | dealerCards.push(value); 525 | }; 526 | 527 | var calculateDealerScore = function() 528 | { 529 | var score = dealerCards.sum(); 530 | 531 | if ( score > 21 && dealerAces > 0 ) { 532 | dealerCards.splice(dealerCards.indexOf(11), 1, 1); 533 | dealerAces--; 534 | score = calculateDealerScore(); 535 | } 536 | 537 | return score; 538 | }; 539 | 540 | // Bet management 541 | var initBet = function() 542 | { 543 | allChips.bind('click', function(e){ 544 | var chip = $(this); 545 | if ( isPlaying || chip.hasClass('desactivate') ) return; 546 | 547 | allChips.removeClass('bet'); 548 | chip.addClass('bet'); 549 | changeBet(chip.data('value')); 550 | 551 | chips.prepend(chip); 552 | }); 553 | }; 554 | 555 | var changeBet = function ( newValue ) { 556 | if ( isPlaying ) return; 557 | currentBet = newValue; 558 | }; 559 | 560 | var changeBankroll = function ( increment ) { 561 | bank += increment * currentBet; 562 | bankroll.html((bank / 10) + 'k'); 563 | }; 564 | 565 | return pro })(); 566 | 567 | /* 568 | * Array shuffle 569 | * Array sum 570 | */ 571 | Array.prototype.shuffle = function() { for(var j, x, i = this.length; i; j = Math.floor(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x); } 572 | Array.prototype.sum = function() { for(var s = 0, i = this.length; i; s += this[--i]); return s; }; 573 | 574 | /* 575 | * Browser Detect 576 | */ 577 | var BrowserDetect = { 578 | init: function () { 579 | this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; 580 | this.version = this.searchVersion(navigator.userAgent) 581 | || this.searchVersion(navigator.appVersion) 582 | || "an unknown version"; 583 | this.OS = this.searchString(this.dataOS) || "an unknown OS"; 584 | 585 | var b = document.documentElement; 586 | b.setAttribute('browser', this.browser); 587 | b.setAttribute('version', this.version ); 588 | b.setAttribute('os', this.OS); 589 | }, 590 | searchString: function (data) { 591 | for (var i=0;i .icons { 271 | -webkit-transform: rotate(180deg); 272 | -khtml-transform: rotate(180deg); 273 | -moz-transform: rotate(180deg); 274 | -ms-transform: rotate(180deg); 275 | -o-transform: rotate(180deg); 276 | transform: rotate(180deg); } 277 | #game #dealer-cards { 278 | top: -200px; } 279 | #game #dealer-cards .card { 280 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #f9f9f9), color-stop(1, #edeae6)); 281 | background-image: -moz-linear-gradient(center bottom, #f9f9f9 0%, #edeae6 100%); } 282 | #game #player-cards { 283 | bottom: -120px; } 284 | #game #player-total, #game #dealer-total { 285 | font-size: 1em; 286 | color: #fff; } 287 | 288 | #message { 289 | z-index: 999; 290 | position: absolute; 291 | bottom: 8%; 292 | left: 0; 293 | width: 100%; 294 | opacity: 1; 295 | color: #ffd801; 296 | font-size: 5em; 297 | font-weight: bold; 298 | font-family: 'bello-pro'; 299 | font-size: 5em; 300 | line-height: 1; 301 | text-align: center; 302 | text-shadow: 0px 2px 0px #daa206, 0px 1px 6px rgba(0, 0, 0, 0.1); 303 | -webkit-animation: fadeIn3d 1000ms ease-in-out; } 304 | #message span { 305 | display: block; 306 | clear: both; 307 | color: #3c2f29; 308 | font-family: 'futura-pt', Helvetica, Arial, sans-serif; 309 | font-size: 0.5em; 310 | font-weight: bold; 311 | text-transform: uppercase; 312 | text-shadow: none; 313 | text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); } 314 | #message.game-over { 315 | bottom: 45%; 316 | -webkit-animation: fadeIn3d 1000ms ease-in-out; } 317 | 318 | #message.lose, #message.lose-busted, #message.lose-blackjack, #message.game-over { 319 | color: #f14700; 320 | text-shadow: 0 -1px 0px #f36c30, 0px 2px 0px #cf3600, 0px 4px 21px rgba(60, 47, 41, 0.17); } 321 | #message.lose span, #message.lose-busted span, #message.lose-blackjack span, #message.game-over span { 322 | color: #3c2f29; } 323 | 324 | #overlay { 325 | position: absolute; 326 | z-index: 998; 327 | top: 0; 328 | left: 0; 329 | width: 100%; 330 | height: 100%; 331 | min-height: 420px; 332 | background-color: rgba(0, 0, 0, 0.6); } 333 | 334 | @-webkit-keyframes fadeIn3d { 335 | 0% { 336 | opacity: 0; 337 | -webkit-transform: translate3d(0, 0, 0); 338 | -khtml-transform: translate3d(0, 0, 0); 339 | -moz-transform: translate3d(0, 0, 0); 340 | -ms-transform: translate3d(0, 0, 0); 341 | -o-transform: translate3d(0, 0, 0); 342 | transform: translate3d(0, 0, 0); } 343 | 344 | 75% { 345 | opacity: 1; } 346 | 347 | 100% { 348 | -webkit-transform: translate3d(0, -75px, 0); 349 | -khtml-transform: translate3d(0, -75px, 0); 350 | -moz-transform: translate3d(0, -75px, 0); 351 | -ms-transform: translate3d(0, -75px, 0); 352 | -o-transform: translate3d(0, -75px, 0); 353 | transform: translate3d(0, -75px, 0); } } 354 | 355 | @-webkit-keyframes messageFade { 356 | 0% { 357 | opacity: 0; 358 | /*letter-spacing: 0em;*/ } 359 | 360 | 10% { 361 | opacity: 1; } 362 | 363 | 70% { 364 | opacity: 1; } 365 | 366 | 100% { 367 | opacity: 0; 368 | /*letter-spacing: 0.6em;*/ } } 369 | 370 | @-webkit-keyframes dealPulse { 371 | 0% { 372 | -webkit-box-shadow: inset 0px 2px 0 rgba(255, 255, 255, 0.3), inset 0px -2px 0 rgba(255, 255, 255, 0.1), 0px 5px 0px 0px #daa206, 0px 5px 0px 2px rgba(0, 0, 0, 0.2), 0 0 6px rgba(255, 246, 0, 0.8); } 373 | 374 | 100% { 375 | -webkit-box-shadow: inset 0px 2px 0 rgba(255, 255, 255, 0.3), inset 0px -2px 0 rgba(255, 255, 255, 0.1), 0px 5px 0px 0px #daa206, 0px 5px 0px 2px rgba(0, 0, 0, 0.2), 0 0 40px rgba(255, 246, 0, 0.8); } } 376 | 377 | #chips:hover .chip { 378 | opacity: 0.8; } 379 | 380 | #chips:hover .chip:hover { 381 | opacity: 1; } 382 | 383 | .chip { 384 | cursor: pointer; 385 | float: left; 386 | margin: 0 10px 0 0; 387 | padding: 4px; 388 | background-color: #007cff; 389 | position: relative; 390 | width: 100px !important; 391 | height: 100px; 392 | border: 10px dashed #fff; 393 | -webkit-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 394 | -khtml-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 395 | -moz-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 396 | -ms-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 397 | -o-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 398 | box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 4px 9px rgba(0, 0, 0, 0.2); 399 | -webkit-user-select: none; 400 | -khtml-user-select: none; 401 | -moz-user-select: none; 402 | -ms-user-select: none; 403 | -o-user-select: none; 404 | user-select: none; 405 | -webkit-border-radius: 100px; 406 | -khtml-border-radius: 100px; 407 | -moz-border-radius: 100px; 408 | -ms-border-radius: 100px; 409 | -o-border-radius: 100px; 410 | border-radius: 100px; 411 | -webkit-transition: all 100ms ease-out; 412 | -khtml-transition: all 100ms ease-out; 413 | -moz-transition: all 100ms ease-out; 414 | -ms-transition: all 100ms ease-out; 415 | -o-transition: all 100ms ease-out; 416 | transition: all 100ms ease-out; } 417 | .chip:hover { 418 | -webkit-transform: rotate(5deg); 419 | -khtml-transform: rotate(5deg); 420 | -moz-transform: rotate(5deg); 421 | -ms-transform: rotate(5deg); 422 | -o-transform: rotate(5deg); 423 | transform: rotate(5deg); } 424 | .chip span { 425 | display: block; 426 | width: 100%; 427 | height: 100%; 428 | color: #fff; 429 | font-size: 2em; 430 | line-height: 102px; 431 | text-align: center; 432 | text-shadow: 0 -1px 0px rgba(0, 0, 0, 0.3); 433 | background-color: #0261f1; 434 | -webkit-border-radius: 100px; 435 | -khtml-border-radius: 100px; 436 | -moz-border-radius: 100px; 437 | -ms-border-radius: 100px; 438 | -o-border-radius: 100px; 439 | border-radius: 100px; 440 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0274f3), color-stop(1, #037ff4)); 441 | background-image: -moz-linear-gradient(center bottom, #0274f3 0%, #037ff4 100%); 442 | -webkit-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 443 | -khtml-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 444 | -moz-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 445 | -ms-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 446 | -o-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 447 | box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; } 448 | .chip::before { 449 | position: absolute; 450 | color: #77a421; 451 | font-size: 0.65em; 452 | letter-spacing: 0.1em; 453 | text-transform: uppercase; 454 | left: 49%; } 455 | 456 | .chip.blue { 457 | background-color: #007cff; 458 | -webkit-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); 459 | -khtml-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); 460 | -moz-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); 461 | -ms-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); 462 | -o-box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); 463 | box-shadow: 0 0 0px #0263e6, 0 1px 0px #0263e6, 0 2px 0px #0263e6, 0 3px 0px #0263e6, 0 4px 0px #0263e6, 0 -1px 0px #01afff, 0 3px 9px rgba(0, 0, 0, 0.2); } 464 | .chip.blue span { 465 | background-color: #0261f1; 466 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0274f3), color-stop(1, #037ff4)); 467 | background-image: -moz-linear-gradient(center bottom, #0274f3 0%, #037ff4 100%); 468 | -webkit-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 469 | -khtml-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 470 | -moz-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 471 | -ms-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 472 | -o-box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; 473 | box-shadow: 0 0 0 3px #0277f4, 0 -1px 0 3px #0265f1, 0 1px 0 3px #008dff, inset 0 1px 1px #0784ff, inset 0 -1px 0px #0261f1; } 474 | .chip.blue::before { 475 | content: '2'; } 476 | 477 | .chip.red { 478 | background-color: #f54800; 479 | -webkit-box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); 480 | -khtml-box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); 481 | -moz-box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); 482 | -ms-box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); 483 | -o-box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); 484 | box-shadow: 0 0 0px #de2e04, 0 1px 0px #de2e04, 0 2px 0px #de2e04, 0 3px 0px #de2e04, 0 4px 0px #de2e04, 0 -1px 0px #ff6d02, 0 3px 9px rgba(0, 0, 0, 0.2); } 485 | .chip.red span { 486 | background-color: #eb4603; 487 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ed4300), color-stop(1, #ef4d00)); 488 | background-image: -moz-linear-gradient(center bottom, #ed4300 0%, #ef4d00 100%); 489 | -webkit-box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; 490 | -khtml-box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; 491 | -moz-box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; 492 | -ms-box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; 493 | -o-box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; 494 | box-shadow: 0 0 0 3px #eb4503, 0 -1px 0 3px #de3400, 0 1px 0 3px #ff5100, inset 0 1px 1px #fd5410, inset 0 -1px 0px #de3400; } 495 | .chip.red::before { 496 | content: '1'; } 497 | 498 | .chip.yellow { 499 | background-color: #f3cf00; 500 | -webkit-box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); 501 | -khtml-box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); 502 | -moz-box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); 503 | -ms-box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); 504 | -o-box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); 505 | box-shadow: 0 0 0px #cdaf00, 0 1px 0px #cdaf00, 0 2px 0px #cdaf00, 0 3px 0px #cdaf00, 0 4px 0px #cdaf00, 0 -1px 0px #fddc00, 0 3px 9px rgba(0, 0, 0, 0.2); } 506 | .chip.yellow span { 507 | background-color: #ebc700; 508 | background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ebcd00), color-stop(1, #ecc300)); 509 | background-image: -moz-linear-gradient(center bottom, #ebcd00 0%, #ecc300 100%); 510 | -webkit-box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; 511 | -khtml-box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; 512 | -moz-box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; 513 | -ms-box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; 514 | -o-box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; 515 | box-shadow: 0 0 0 3px #eec900, 0 -1px 0 3px #ceaf00, 0 1px 0 3px #e9dc00, inset 0 1px 1px #e9dc00, inset 0 -1px 0px #ceaf00; } 516 | .chip.yellow::before { 517 | content: '3'; } 518 | 519 | .card { 520 | font-size: 1.5em; 521 | z-index: 1; 522 | position: relative; 523 | width: 300px; 524 | height: 460px; 525 | border-radius: 20px; 526 | -webkit-user-select: none; 527 | -khtml-user-select: none; 528 | -moz-user-select: none; 529 | -ms-user-select: none; 530 | -o-user-select: none; 531 | user-select: none; } 532 | .card div { 533 | position: absolute; } 534 | .card div:first-child { 535 | top: 2%; 536 | left: 5%; } 537 | .card div:last-child { 538 | bottom: 2%; 539 | right: 5%; 540 | -webkit-transform: rotate(180deg); 541 | -khtml-transform: rotate(180deg); 542 | -moz-transform: rotate(180deg); 543 | -ms-transform: rotate(180deg); 544 | -o-transform: rotate(180deg); 545 | transform: rotate(180deg); } 546 | .card div span { 547 | text-align: center; 548 | display: block; } 549 | .card div .icons { 550 | position: absolute; 551 | top: 0; 552 | left: 0; 553 | width: 1px; 554 | height: 1px; } 555 | .card div .icons > div { 556 | position: relative; } 557 | .card .icons { 558 | position: absolute; 559 | top: 50%; 560 | left: 50%; } 561 | .card .icons span { 562 | position: absolute; 563 | font-size: 4em; 564 | left: -26px; } 565 | 566 | .card.hearts, .card.diamonds { 567 | color: #f14000; } 568 | 569 | .card.spades, .card.clubs { 570 | color: #3c2f29; } 571 | 572 | .card.valueA > .icons span { 573 | top: -70px; } 574 | 575 | .card.value2 > .icons span:nth-child(1), 576 | .card.value3 > .icons span:nth-child(1) { 577 | top: -170px; } 578 | .card.value2 > .icons span:nth-child(2), 579 | .card.value3 > .icons span:nth-child(2) { 580 | bottom: -170px; } 581 | .card.value2 > .icons span:nth-child(3), 582 | .card.value3 > .icons span:nth-child(3) { 583 | top: -65px; } 584 | 585 | .card.value4 > .icons span:nth-child(1), 586 | .card.value5 > .icons span:nth-child(1) { 587 | top: -170px; 588 | left: -90px; } 589 | .card.value4 > .icons span:nth-child(2), 590 | .card.value5 > .icons span:nth-child(2) { 591 | top: -170px; 592 | right: -90px; 593 | left: auto; } 594 | .card.value4 > .icons span:nth-child(3), 595 | .card.value5 > .icons span:nth-child(3) { 596 | bottom: -170px; 597 | left: -90px; } 598 | .card.value4 > .icons span:nth-child(4), 599 | .card.value5 > .icons span:nth-child(4) { 600 | bottom: -170px; 601 | right: -90px; 602 | left: auto; } 603 | .card.value4 > .icons span:nth-child(5), 604 | .card.value5 > .icons span:nth-child(5) { 605 | top: -65px; } 606 | 607 | .card.value6 > .icons span:nth-child(1), 608 | .card.value7 > .icons span:nth-child(1), 609 | .card.value8 > .icons span:nth-child(1) { 610 | top: -170px; 611 | left: -90px; } 612 | .card.value6 > .icons span:nth-child(2), 613 | .card.value7 > .icons span:nth-child(2), 614 | .card.value8 > .icons span:nth-child(2) { 615 | top: -170px; 616 | right: -90px; 617 | left: auto; } 618 | .card.value6 > .icons span:nth-child(3), 619 | .card.value7 > .icons span:nth-child(3), 620 | .card.value8 > .icons span:nth-child(3) { 621 | bottom: -170px; 622 | left: -90px; } 623 | .card.value6 > .icons span:nth-child(4), 624 | .card.value7 > .icons span:nth-child(4), 625 | .card.value8 > .icons span:nth-child(4) { 626 | bottom: -170px; 627 | right: -90px; 628 | left: auto; } 629 | .card.value6 > .icons span:nth-child(5), 630 | .card.value7 > .icons span:nth-child(5), 631 | .card.value8 > .icons span:nth-child(5) { 632 | top: -65px; 633 | left: -90px; } 634 | .card.value6 > .icons span:nth-child(6), 635 | .card.value7 > .icons span:nth-child(6), 636 | .card.value8 > .icons span:nth-child(6) { 637 | top: -65px; 638 | right: -90px; 639 | left: auto; } 640 | .card.value6 > .icons span:nth-child(7), 641 | .card.value7 > .icons span:nth-child(7), 642 | .card.value8 > .icons span:nth-child(7) { 643 | top: -120px; } 644 | .card.value6 > .icons span:nth-child(8), 645 | .card.value7 > .icons span:nth-child(8), 646 | .card.value8 > .icons span:nth-child(8) { 647 | bottom: -120px; } 648 | 649 | .card.value9 > .icons span:nth-child(1) { 650 | top: -190px; 651 | left: -90px; } 652 | .card.value9 > .icons span:nth-child(2) { 653 | top: -110px; 654 | left: -90px; } 655 | .card.value9 > .icons span:nth-child(3) { 656 | bottom: -110px; 657 | left: -90px; } 658 | .card.value9 > .icons span:nth-child(4) { 659 | bottom: -190px; 660 | left: -90px; } 661 | .card.value9 > .icons span:nth-child(5) { 662 | top: -190px; 663 | right: -90px; 664 | left: auto; } 665 | .card.value9 > .icons span:nth-child(6) { 666 | top: -110px; 667 | right: -90px; 668 | left: auto; } 669 | .card.value9 > .icons span:nth-child(7) { 670 | bottom: -110px; 671 | right: -90px; 672 | left: auto; } 673 | .card.value9 > .icons span:nth-child(8) { 674 | bottom: -190px; 675 | right: -90px; 676 | left: auto; } 677 | .card.value9 > .icons span:nth-child(9) { 678 | top: -65px; } 679 | 680 | .card.value10 > .icons span:nth-child(1) { 681 | top: -190px; 682 | left: -90px; } 683 | .card.value10 > .icons span:nth-child(2) { 684 | top: -110px; 685 | left: -90px; } 686 | .card.value10 > .icons span:nth-child(3) { 687 | bottom: -110px; 688 | left: -90px; } 689 | .card.value10 > .icons span:nth-child(4) { 690 | bottom: -190px; 691 | left: -90px; } 692 | .card.value10 > .icons span:nth-child(5) { 693 | top: -190px; 694 | right: -90px; 695 | left: auto; } 696 | .card.value10 > .icons span:nth-child(6) { 697 | top: -110px; 698 | right: -90px; 699 | left: auto; } 700 | .card.value10 > .icons span:nth-child(7) { 701 | bottom: -110px; 702 | right: -90px; 703 | left: auto; } 704 | .card.value10 > .icons span:nth-child(8) { 705 | bottom: -190px; 706 | right: -90px; 707 | left: auto; } 708 | .card.value10 > .icons span:nth-child(9) { 709 | top: -155px; } 710 | .card.value10 > .icons span:nth-child(10) { 711 | bottom: -155px; } 712 | 713 | .card.valueJ > .icons > span, 714 | .card.valueQ > .icons > span, 715 | .card.valueK > .icons > span { 716 | font-size: 6em; 717 | top: -100px; 718 | left: -70px; } 719 | 720 | html[browser="Firefox"] .chip { 721 | border-color: rgba(255, 255, 255, 0.1); } 722 | 723 | html[browser="Safari"] #game #ui .zone #deal li, html[browser="Safari"] #game #ui .zone #actions li { 724 | margin: 0 2%; } 725 | html[browser="Safari"] #message { 726 | bottom: 0; 727 | -webkit-transform: translate3d(0, -75px, 0); 728 | -khtml-transform: translate3d(0, -75px, 0); 729 | -moz-transform: translate3d(0, -75px, 0); 730 | -ms-transform: translate3d(0, -75px, 0); 731 | -o-transform: translate3d(0, -75px, 0); 732 | transform: translate3d(0, -75px, 0); } 733 | 734 | html[os="iPhone/iPod"] #game #player-cards .card, html[os="iPhone/iPod"] #game #dealer-cards .card { 735 | -webkit-transition: none; 736 | -khtml-transition: none; 737 | -moz-transition: none; 738 | -ms-transition: none; 739 | -o-transition: none; 740 | transition: none; } 741 | 742 | @media screen and (max-height: 1024px) { 743 | #game #dealer-cards { 744 | top: -260px; } 745 | #game #player-cards { 746 | bottom: -240px; } } 747 | @media screen and (max-height: 910px) { 748 | #game #player-cards { 749 | bottom: -300px; } } 750 | @media screen and (max-height: 768px) { 751 | #game #dealer-cards { 752 | top: -270px; } } 753 | @media screen and (max-height: 660px) { 754 | #game #dealer-cards { 755 | top: -350px; } } 756 | @media screen and (max-height: 550px) and (max-width: 768px) { 757 | #game #dealer-cards { 758 | top: -350px; } 759 | #game #player-cards { 760 | bottom: -350px; } } 761 | @media screen and (max-height: 620px) and (max-width: 480px) { 762 | #game #dealer-cards { 763 | top: -200px; } } 764 | @media screen and (max-height: 550px) and (max-width: 320px) { 765 | #game #dealer-cards { 766 | top: -150px; } } 767 | @media screen and (max-height: 320px) and (max-width: 480px) { 768 | #game #dealer-cards { 769 | top: -250px; } } 770 | @media screen and (max-width: 1024px) { 771 | #game .chip { 772 | padding: 4px; 773 | width: 80px !important; 774 | height: 80px; } 775 | #game .chip span { 776 | font-size: 1.5em; 777 | line-height: 82px; } } 778 | @media screen and (max-width: 768px) { 779 | #game h1 { 780 | margin: 10% auto 0 auto; } 781 | #game #ui { 782 | width: 95%; 783 | height: 40%; 784 | max-height: 500px; 785 | top: 35%; } 786 | #game #ui .zone { 787 | height: 66%; 788 | max-height: 300px; 789 | -webkit-border-radius: 21px; 790 | -khtml-border-radius: 21px; 791 | -moz-border-radius: 21px; 792 | -ms-border-radius: 21px; 793 | -o-border-radius: 21px; 794 | border-radius: 21px; } 795 | #game #ui .zone .label { 796 | top: -30px; } 797 | #game #ui .zone #deal, #game #ui .zone #actions { 798 | position: absolute; 799 | top: auto; 800 | bottom: 10%; 801 | width: 96%; 802 | height: auto; } 803 | #game #ui .zone .shortcut { 804 | display: none; } 805 | #game #ui .zone #bankroll { 806 | top: 0; 807 | margin: 4%; } 808 | #game #ui #chips { 809 | width: auto; 810 | top: 10px; 811 | right: 2px; } 812 | #game #ui #chips .chip { 813 | float: none; 814 | opacity: 0.35; 815 | top: 0 !important; 816 | left: auto !important; } 817 | #game #ui #chips .chip::before { 818 | display: none; } 819 | #game #ui #chips .chip.bet { 820 | opacity: 1; } 821 | #game #ui #chips .chip.red { 822 | right: 236px; } 823 | #game #ui #chips .chip.blue { 824 | right: 118px; } 825 | #game #ui #chips .chip.yellow { 826 | right: 0px; } } 827 | @media screen and (max-width: 768px) and (max-height: 825px) { 828 | #game { 829 | font-size: 12px; } 830 | #game #ui .zone #chips .chip { 831 | padding: 4px; 832 | width: 50px !important; 833 | height: 50px; 834 | margin: 3px; 835 | border: 4px dashed #fff; } 836 | #game #ui .zone #chips .chip span { 837 | font-size: 1.4em; 838 | line-height: 52px; } 839 | #game #ui .zone #chips .chip.red { 840 | right: 145px; } 841 | #game #ui .zone #chips .chip.blue { 842 | right: 72px; } 843 | #game #ui .zone #chips .chip.yellow { 844 | right: 0px; } } 845 | @media screen and (max-width: 575px) { 846 | #game { 847 | font-size: 12px; } 848 | #game #ui .zone #bankroll { 849 | font-size: 4em; } 850 | #game #ui .zone #chips .chip { 851 | padding: 4px; 852 | width: 30px !important; 853 | height: 30px; 854 | border: 3px dashed #fff; } 855 | #game #ui .zone #chips .chip span { 856 | font-size: 1em; 857 | line-height: 32px; } 858 | #game #ui .zone #chips .chip.red { 859 | right: 98px; } 860 | #game #ui .zone #chips .chip.blue { 861 | right: 49px; } 862 | #game #ui .zone #chips .chip.yellow { 863 | right: 0px; } 864 | #game .card { 865 | font-size: 1.5em; 866 | position: relative; 867 | width: 220px; 868 | height: 337.333333px; } 869 | #game .card .icons { 870 | display: none; } } 871 | @media screen and (max-width: 450px) { 872 | #github-ribbon { 873 | display: none; } } 874 | @media screen and (max-width: 480px) and (max-height: 320px) { 875 | #game h1 { 876 | margin: 2% auto 0 auto; } 877 | #game #ui { 878 | margin: -15% 0 0 0; } 879 | #game #ui .zone { 880 | height: 70%; } } 881 | @media screen and (max-width: 320px) { 882 | #game { 883 | min-height: 420px; 884 | background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 260, from(#65981e), to(#184d08)); } 885 | #game h1 { 886 | font-size: 4em; 887 | margin: 2%; 888 | color: #2b4f05; } 889 | #game #ui { 890 | margin: -15% 0 0 0; } 891 | #game #ui .zone { 892 | padding: 1% 2%; 893 | height: 75%; 894 | max-height: 160px; } 895 | #game #ui .zone #bankroll { 896 | top: -3px; 897 | font-size: 4em; } 898 | #game #ui #chips .chip { 899 | padding: 4px; 900 | width: 30px !important; 901 | height: 30px; 902 | margin: 3px; 903 | border: 3px dashed #fff; } 904 | #game #ui #chips .chip span { 905 | font-size: 1em; 906 | line-height: 30px; } 907 | #game #ui #chips .chip.red { 908 | right: 98px; } 909 | #game #ui #chips .chip.blue { 910 | right: 49px; } 911 | #game #ui #chips .chip.yellow { 912 | right: 0px; } 913 | #game .card { 914 | font-size: 1.5em; 915 | position: relative; 916 | width: 150px; 917 | height: 230px; } 918 | #game .card .icons { 919 | display: none; } } 920 | --------------------------------------------------------------------------------