diff --git a/herokuapp/app.js b/herokuapp/app.js index 5a395ea..0999904 100644 --- a/herokuapp/app.js +++ b/herokuapp/app.js @@ -64,12 +64,12 @@ console.log(msg); } - res.status(200).send("Server logged message"); + res.status(200).send("Success! Check system logs to see your message."); }); req.on('close', function(err){ console.err(err); - res.status(400).json("Server read stream closed unexpectedly. Check console."); + res.status(400).json("Error! Check system logs to identify the error."); }); }); diff --git a/herokuapp/public/css/style.css b/herokuapp/public/css/style.css index c66e958..6b5c99d 100644 --- a/herokuapp/public/css/style.css +++ b/herokuapp/public/css/style.css @@ -144,14 +144,13 @@ h5 { } .direct { - padding: 16px 40px; color: #21ce99; font-size: 14px; background: transparent; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; - display: inline-block; + display: flex; cursor: pointer; outline: none; text-decoration: none; @@ -161,15 +160,20 @@ h5 { border-radius: 8px; position: relative; margin-top: 20px; + display: table; + height:40px; } -.direct:before { - content: "▶"; - color: #21ce99; - font-size: 36px; - position: absolute; - top: -2px; - left: 0px; +.direct div { + display: table-cell; + text-align: center; + vertical-align: middle; + text-transform: uppercase; +} + +.direct div:nth-child(1) { + font-size:30px; + padding-right:10px; } input { @@ -185,3 +189,54 @@ input { border: 2px solid #333; border-radius: 4px; } + +.notification { + width: 40%; + background: #333; + position: fixed; + top: 20px; + left: 30%; + z-index:4; + right: 0; + padding: 0 20px; + border-left: 5px solid transparent; + + -ms-transform: translate3d(0, -100px, 0); + -o-transform: translate3d(0, -100px, 0); + -moz-transform: translate3d(0, -100px, 0); + -webkit-transform: translate3d(0, -100px, 0); + transform: translate3d(0, -100px, 0); + + transition: -webkit-transform 250ms ease; + transition: -moz-transform 250ms ease; + transition: -ms-transform 250ms ease; + transition: -o-transform 250ms ease; + transition: transform 250ms ease; +} + +.down { + -webkit-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -o-transform: translate3d(0, 0, 0); + -moz-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} + +.info { + border-color: #3498db !important; +} +.error { + border-color:#e74c3c !important; +} + +.notification .wrapper { + width: 100%; + padding:20px 0; + margin: 0 auto; +} +.notification .wrapper .text { + color:#FFF; + font-size:12px; + font-weight:bold; + text-align: center; +} diff --git a/herokuapp/public/js/index.js b/herokuapp/public/js/index.js index 078aabc..d146849 100644 --- a/herokuapp/public/js/index.js +++ b/herokuapp/public/js/index.js @@ -1,11 +1,30 @@ /* global alert, $ */ -(function($){ - $(document).ready(function(){ +(function($) { + + var tid = 0; + var lastType; + + function notify(type, data) { + var $notification = $(".notification"); + $notification.removeClass(lastType || "") + .addClass(lastType = type) + .find(".text") + .text(data); + + $notification.addClass("down"); + + clearTimeout(tid); + setTimeout(function() { + $notification.removeClass("down"); + }, 4000); + } + + $(document).ready(function() { var _submit; - $("#submit").click(function(){ + $("#submit").click(function() { - if(_submit){ + if (_submit) { return; } @@ -15,14 +34,14 @@ var msg = $("#input-msg").val(); $.post("/", { - tag : tag, - msg : msg - }, function(data){ + tag: tag, + msg: msg + }, function(data) { $("#input-tag").val(""); $("#input-msg").val(""); - alert(data); + notify("info", data); }).fail(function(err) { - alert(err.responseText); + notify("error", err.responseText); }).always(function() { _submit = false; }); diff --git a/herokuapp/views/index.html b/herokuapp/views/index.html index 56091ea..bc29241 100644 --- a/herokuapp/views/index.html +++ b/herokuapp/views/index.html @@ -18,6 +18,11 @@