From 61267efeb7df6f77adec75120e8cbc8de8c8fec7 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Wed, 6 Aug 2014 15:47:20 +0200 Subject: [PATCH] Rework dialog open/close. --- main.css | 40 ++++++++++++++++++++++------------------ mlpccg.html | 22 +++------------------- mlpccg.js | 17 +++++------------ single.html | 22 ++++++++-------------- 4 files changed, 38 insertions(+), 63 deletions(-) diff --git a/main.css b/main.css index 0ef3b19..74250b8 100644 --- a/main.css +++ b/main.css @@ -81,40 +81,45 @@ body { } #overlay { - position: absolute; - left: -50%; - right: -50%; - top: -50%; - bottom: -50%; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; background-color: black; opacity: 0; - -webkit-animation: fadein 0.5s forwards; - animation: fadein 0.5s forwards; + transition: opacity 0.5s; + -webkit-transition: opacity 0.5s; + z-index: 3; + pointer-events: none; } -@keyframes fadein { to { opacity: 0.5; } } -@-webkit-keyframes fadein { to { opacity: 0.5; } } - .dialog { font-size: 8vmin; position: absolute; bottom: 10%; - width: 66.6667%; - margin-left: -6px; + left: 16.6667%; + right: 16.6667%; border-style: solid; border-width: 3px; border-radius: 9px; background-color: inherit; padding-bottom: 3vh; - transform: translateX(160%); - -webkit-transform: translateX(160%); + transform: translateX(150%); + -webkit-transform: translateX(150%); transition: transform 0.5s; -webkit-transition: -webkit-transform 0.5s; + z-index: 4; +} + +.dialog.open { + transform: translateX(0); + -webkit-transform: translateX(0); } -#overlay + .dialog { - transform: translateX(25%); - -webkit-transform: translateX(25%); +.dialog.open ~ #overlay { + opacity: 0.5; + pointer-events: auto; } .dialog p { @@ -257,7 +262,6 @@ body { a { display: inline-block; - min-width: 1em; line-height: 1em; border-radius: 0.5em; } diff --git a/mlpccg.html b/mlpccg.html index 5433a88..55a56fb 100644 --- a/mlpccg.html +++ b/mlpccg.html @@ -180,25 +180,7 @@ The CCG is designed and developed by EnterPLAY. - - The Fira Sans - font, copyright 2014 the - Mozilla Foundation - with Reserved Font Name Fira Sans, is licensed under the - SIL OFL. - - The Android Emoji font, copyright 2013 - the Android Open Source - Project, is licensed under - the - Apache License, Version 2.0; you may not use this work - except in compliance with the License. + href="http://www.enter-play.com/products/mlpccg.html">EnterPLAY. This tool is not affiliated with or authorized by any of the above parties. @@ -206,5 +188,7 @@ Bo-ring. + +
diff --git a/mlpccg.js b/mlpccg.js index 0e8643e..1681afe 100644 --- a/mlpccg.js +++ b/mlpccg.js @@ -236,21 +236,14 @@ if (applicationCache && applicationCache.status) { } function dismiss () { - var overlay = document.getElementById("overlay"); - if (overlay) - overlay.parentNode.removeChild(overlay); - broadcast({ type: "dismiss" }); + var open = document.querySelectorAll(".dialog.open"); + for (var i = 0; i < open.length; ++i) + open[i].className = "dialog"; } function show (id) { - var overlay = document.getElementById("overlay"); - if (!overlay) { - overlay = document.createElement('div'); - overlay.id = 'overlay'; - } else { - overlay.parentNode.removeChild(overlay); - } + dismiss(); var target = document.getElementById(id); - target.parentNode.insertBefore(overlay, target); + target.className += " open"; } diff --git a/single.html b/single.html index 2852ad5..625a576 100644 --- a/single.html +++ b/single.html @@ -63,7 +63,7 @@ .bits { top: 70vh; left: 0; - bottom: 15vh; + bottom: 10vh; right: 50vw; line-height: 15vh; } @@ -84,19 +84,18 @@ .adj { display: block; - padding: 0; - max-width: 0.6em; - min-width: 0.6em; line-height: 0.6em; width: 0.6em; height: 0.6em; - max-height: 0.6em; - max-height: 0.6em; font-size: 20vmin; font-family: 'Sans', sans-serif; border-style: solid; border-width: 1px; border-radius: 0.3em; + position: absolute; + margin-top: -2.25em; + margin-left: 1.6667em; + overflow: hidden; } /* Height 0.6 with line-height 0.6 should be centering the text, @@ -114,7 +113,7 @@ .score { top: 0vh; left: 0; - bottom: 70vh; + bottom: 30vh; right: 50vw; line-height: 70vh; } @@ -170,16 +169,10 @@ #current-score, #current-actions { line-height: 1.3333em; } } - #current-score + .adj, #current-actions + .adj { - position: absolute; - margin-top: -2.25em; - margin-left: 1.6667em; - } - .turn { left: 45vw; top: 70vh; - bottom: 15vh; + bottom: 10vh; right: 0; line-height: 15vh; } @@ -393,5 +386,6 @@
You Win! +
-- 2.30.2