Browse Source

Much nicer HTML design

Marcos Kirsch 9 years ago
parent
commit
eeb7d1dff3
2 changed files with 166 additions and 74 deletions
  1. 134 61
      http/garage_door_opener.css
  2. 32 13
      http/garage_door_opener.html

+ 134 - 61
http/garage_door_opener.css

@@ -1,61 +1,134 @@
-body {
-    text-align: center;
-}
-
-.button {
-    display: inline-block;
-    margin: 10px;
-    -webkit-border-radius: 8px;
-    -moz-border-radius: 8px;
-    border-radius: 8px;
-    -webkit-box-shadow:    0 8px 0 #c5376d, 0 15px 20px rgba(0, 0, 0, .35);
-    -moz-box-shadow: 0 8px 0 #c5376d, 0 15px 20px rgba(0, 0, 0, .35);
-    box-shadow: 0 8px 0 #c5376d, 0 15px 20px rgba(0, 0, 0, .35);
-    -webkit-transition: -webkit-box-shadow .1s ease-in-out;
-    -moz-transition: -moz-box-shadow .1s ease-in-out;
-    -o-transition: -o-box-shadow .1s ease-in-out;
-    transition: box-shadow .1s ease-in-out;
-    font-size: 50px;
-    color: #fff;
-}
-
-.button span {
-    display: inline-block;
-    padding: 20px 30px;
-    background-color: #ec528d;
-    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(hsla(338, 90%, 80%, .8)), to(hsla(338, 90%, 70%, .2)));
-    background-image: -webkit-linear-gradient(hsla(338, 90%, 80%, .8), hsla(338, 90%, 70%, .2));
-    background-image: -moz-linear-gradient(hsla(338, 90%, 80%, .8), hsla(338, 90%, 70%, .2));
-    background-image: -o-linear-gradient(hsla(338, 90%, 80%, .8), hsla(338, 90%, 70%, .2));
-    -webkit-border-radius: 8px;
-    -moz-border-radius: 8px;
-    border-radius: 8px;
-    -webkit-box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15);
-    -moz-box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15);
-    box-shadow: inset 0 -1px 1px rgba(255, 255, 255, .15);
-    font-family: 'Khand', sans-serif;
-    line-height: 1;
-    text-shadow: 0 -1px 1px rgba(175, 49, 95, .7);
-    -webkit-transition: background-color .2s ease-in-out, -webkit-transform .1s ease-in-out;
-    -moz-transition: background-color .2s ease-in-out, -moz-transform .1s ease-in-out;
-    -o-transition: background-color .2s ease-in-out, -o-transform .1s ease-in-out;
-    transition: background-color .2s ease-in-out, transform .1s ease-in-out;
-}
-
-.button:hover span {
-    background-color: #ec6a9c;
-    text-shadow: 0 -1px 1px rgba(175, 49, 95, .9), 0 0 5px rgba(255, 255, 255, .8);
-}
-
-.button:active, .button:focus {
-    -webkit-box-shadow:    0 8px 0 #c5376d, 0 12px 10px rgba(0, 0, 0, .3);
-    -moz-box-shadow: 0 8px 0 #c5376d, 0 12px 10px rgba(0, 0, 0, .3);
-    box-shadow:    0 8px 0 #c5376d, 0 12px 10px rgba(0, 0, 0, .3);
-}
-
-.button:active span {
-    -webkit-transform: translate(0, 4px);
-    -moz-transform: translate(0, 4px);
-    -o-transform: translate(0, 4px);
-    transform: translate(0, 4px);
-}
+html, body {
+	height:100%;
+	margin: 0;
+	overflow: hidden;
+}
+
+body {
+
+	text-align: center;
+	background-color: black;
+	min-height: 100%;
+	color: black;
+}
+
+
+#remote {
+	background-color: #666;
+	width: 90%;
+	border-radius: 30px;
+	margin: 5% 5% 0;
+	height: 90%;
+	padding: 0;
+}
+
+#spacer {
+	clear: both;
+	border-top: 1px solid rgba(0, 0, 0, 0.5);
+	-moz-box-shadow: 1px 1px 1px;
+	box-shadow: 1px 1px 1px;
+	margin-right: 30px;
+	margin-left: 30px;
+}
+
+
+.button {
+	display: inline-block;
+	width: 43%;
+	margin: 20px 0 30px;
+	padding: 40px 0;
+	border-style: none;
+	color: rgba(192, 192, 192, 0.5);
+	text-decoration: none;
+	border-radius: 20px;
+	text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
+	font-size: 130px;
+	font-weight: bold;
+	background-color: #CCC;
+	-moz-box-shadow: 0 10px rgba(0, 0, 0, 0.25);
+	box-shadow: 0 10px rgba(0, 0, 0, 0.25);
+	position: relative;
+}
+
+
+.button-1 {
+	float: left;
+	margin-left: 5%;
+}
+
+.button-2 {
+	float: right;
+	margin-right: 5%;
+}
+
+
+
+.button span {
+
+
+}
+
+
+
+.button:hover span {
+
+
+}
+
+
+.button:active, .button:focus {
+
+
+}
+
+
+
+.button:active span {
+
+
+}
+
+
+#label {
+	font-family: "Lucida Grande", Lucida, Verdana, sans-serif;
+	background-color: rgba(0, 0, 0, 0.1);
+	width: 12px;
+	height: 12px;
+	display: block;
+	margin: 20px auto;
+	-webkit-border-radius: 20px;
+	-moz-border-radius: 20px;
+	border-radius: 20px;
+	text-indent: -99999px;
+	top: 20px;
+	position: relative;
+}
+
+#label.start {
+
+}
+
+#label.initalizing {
+
+}
+
+#label.connection {
+	background-color: orange;
+}
+
+#label.received {
+	background-color: orange;
+}
+
+#label.processing {
+	background-color: orange;
+}
+
+#label.ok {
+	background-color: green;
+}
+
+#label.bad {
+	background-color: red;
+}
+

+ 32 - 13
http/garage_door_opener.html

@@ -23,43 +23,62 @@
       {
          if(xmlHttp.readyState == 0)
          {
-            document.getElementById('label').innerHTML = 'Initalizing...';
+            document.getElementById("label").innerHTML = 'Initalizing...';
+            document.getElementById("label").className = "initalizing";
          }
          else if(xmlHttp.readyState == 1)
          {
-            document.getElementById('label').innerHTML = 'Server connection established.';
+            document.getElementById("label").innerHTML = 'Server connection established.';
+            document.getElementById("label").className = "connection";
          }
          else if(xmlHttp.readyState == 2)
          {
-            document.getElementById('label').innerHTML = 'Request received.';
+            document.getElementById("label").innerHTML = 'Request received.';
+            document.getElementById("label").className = "received";
          }
          else if(xmlHttp.readyState == 3)
          {
-            document.getElementById('label').innerHTML = 'Processing request.';
+            document.getElementById("label").innerHTML = 'Processing request.';
+            document.getElementById("label").className = "processing";
          }
          else if(xmlHttp.readyState == 4)
          {
             if(xmlHttp.status == 200)
             {
-               document.getElementById('label').innerHTML = xmlHttp.responseText;
+               document.getElementById("label").innerHTML = xmlHttp.responseText;
+               document.getElementById("label").className = "ok";
+               sleep(300);
+               document.getElementById("label").className = "start";
             }
             else if(xmlHttp.status == 400)
             {
-               document.getElementById('label').innerHTML = 'Bad request.';
+               document.getElementById("label").innerHTML = 'Bad request.';
+               document.getElementById("label").className = "bad";
+            }
+         }
+      }
+      function sleep(milliseconds){
+         var start = new Date().getTime();
+         for (var i = 0; i < 1e7; i++)
+         {
+            if ((new Date().getTime() - start) > milliseconds)
+            {
+               break;
             }
          }
       }
    </script>
    <body bgcolor="#777777">
-      <link href='http://fonts.googleapis.com/css?family=Khand:700' rel='stylesheet' type='text/css'>
-      <a href="#" onclick="pushTheButton(1); " class="button"">
-          <span>Door 1</span>
+   <div id="remote">
+      <div id="label" class="start"></div>
+      <a href="#" onclick="pushTheButton(1);" class="button button-1">
+          <span>I</span>
       </a>
-      <a href="#" onclick="pushTheButton(2); " class="button"">
-          <span>Door 2</span>
+      <a href="#" onclick="pushTheButton(2); " class="button button-2">
+          <span>II</span>
       </a>
-      <div id="label">Text goes here</div>
+      <div id="spacer"></div>
+   </div>
    </body>
 </html>
 
-