diff --git a/live-loop.js b/live-loop.js
index e91a90e..562e0fc 100644
--- a/live-loop.js
+++ b/live-loop.js
@@ -7,6 +7,9 @@
window.liveloop = window.liveloop || {};
var liveloop = window.liveloop;
+ liveloop.counter = 1;
+ liveloop.counterTimeout = null;
+
liveloop.generateCodePrologue = function()
{
return "\n\n\n \n
Test Snippet\n
\n \n";
@@ -35,10 +38,38 @@
{
liveloop.setupCodePrologue();
liveloop.setupCodeEpilogue();
- $("#code-body").keyup(liveloop.updateTriples);
+ $("#code-body").keyup(liveloop.checkCounter);
};
+
+ liveloop.checkCounter = function(event)
+ {
+ if(event)
+ {
+ liveloop.counter = 1;
+ }
+ else
+ {
+ liveloop.counter--;
+ }
+
+ if(liveloop.counter <= 0)
+ {
+ $("#loading").hide();
+ liveloop.updateTriples();
+ }
+ else
+ {
+ $("#loading").show();
+ if(liveloop.counterTimeout)
+ {
+ clearTimeout(liveloop.counterTimeout);
+ }
+ liveloop.counterTimeout = setTimeout(liveloop.checkCounter, 1000);
+ }
+ };
+
- liveloop.updateTriples = function(event)
+ liveloop.updateTriples = function()
{
var rdfaDocument = liveloop.generateCodePrologue() +
$("#code-body").val() + liveloop.generateCodeEpilogue();
diff --git a/loading.gif b/loading.gif
new file mode 100644
index 0000000..d693e5a
Binary files /dev/null and b/loading.gif differ