diff --git a/index.html b/index.html index 3468d5b..f733e8b 100644 --- a/index.html +++ b/index.html @@ -36,8 +36,9 @@

The RDFa markup playground.

-RDFa Live Loop lets you play with HTML+RDFa markup and instantly see -the data that your markup produces.

+Live Loop lets you play with +HTML+RDFa markup and instantly +see the data that your markup produces.

<html>
@@ -49,6 +50,8 @@

The RDFa markup playground.
</html>
+ +
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