From b099925eb23c16863442e7ba45720c69fcd5f9e0 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Sat, 2 Nov 2013 01:12:11 -0700 Subject: [PATCH] eg/tryhy: add blinking cursor --- eg/tryhy/css/style.css | 16 ++++++++++++++++ eg/tryhy/js/repl.js | 2 ++ 2 files changed, 18 insertions(+) diff --git a/eg/tryhy/css/style.css b/eg/tryhy/css/style.css index 1401b36..fbdc4ff 100644 --- a/eg/tryhy/css/style.css +++ b/eg/tryhy/css/style.css @@ -20,3 +20,19 @@ div.console div.jquery-console-welcome { color:#52666f; font-family:monospace; padding:0.1em; } div.console span.jquery-console-prompt-label { font-weight:bold } + +span.jquery-console-cursor.running { + -webkit-animation-duration: 0.1s; + -webkit-animation-name: blink; + -webkit-animation-iteration-count: infinite; + -webkit-animation-direction: alternate; +} + +@-webkit-keyframes blink { + from { + opacity: 1.0 + } + to { + opacity: 0.5 + } +} \ No newline at end of file diff --git a/eg/tryhy/js/repl.js b/eg/tryhy/js/repl.js index bd82ffd..d2dd5a6 100644 --- a/eg/tryhy/js/repl.js +++ b/eg/tryhy/js/repl.js @@ -7,6 +7,7 @@ $(document).ready(function(){ else return true; }, commandHandle:function(line, report){ + $('.jquery-console-cursor').addClass('running'); $.ajax({ type: 'POST', url: '/eval', @@ -14,6 +15,7 @@ $(document).ready(function(){ contentType: 'application/json', dataType: 'json', success: function(data) { + $('.jquery-console-cursor').removeClass('running'); report([{msg : data.stdout, className:'jquery-console-message-value'}, {msg : data.stderr, className:'jquery-console-message-error'}]); }