From af82e52d3d28be0ce428abdc620b1f481c2d70c2 Mon Sep 17 00:00:00 2001 From: Manu Sporny Date: Wed, 15 Dec 2010 03:40:40 -0500 Subject: [PATCH] Added a delay before requesting that the document is parsed for triples. --- index.html | 7 +++++-- live-loop.js | 35 +++++++++++++++++++++++++++++++++-- loading.gif | Bin 0 -> 1456 bytes 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 loading.gif 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 0000000000000000000000000000000000000000..d693e5a211db9eb668a570fea003fb7df1ed8041 GIT binary patch literal 1456 zcmb`GYfw~W9EX1aE50oXi|(=qNLW0FSU`4N5LZBu+afAAS20ASO%O=aa;&IkEZ=j^ zUe3B)1`tuXdSQSZEg5Fa21Q9p%?TWJx~Stc)ih1hG)*;qsm`Gw z{{IDqHtQ-!2tx2P@XJZa=f{5dwnNy0ue)&NAZEPi+NnI3DslNun4?jWf-jGte;1mo z@$GROup=TAXZE4D0UbN=T{nK{!-?IP5|NVtbs(x%<9;(9cVO%_#6=(_26@YH+l}!9 zNQ=dK3o_zhOTrB&CMmY0;p~2V(TUw_F}N4+zJk$4RA!(e9o1Q&<@lrpub1Jc0d&_R zEEw^Tu&;!_ABvK3jYler%~miW_~s}+me5&)&sy=Q9hpX)dI3wr5VaUXFJez23QVvV zP?v{WF1+^!SUnm`u_hj6sUY(ZsKUrgc+iHz<@mk_=U&E+Y}DrBZWE5xL8FF2t2Ft4 zkKuQ9asDQIZgy$DCCTjng#2~GZ{fN7Y90G)YocFm*k2#*c;3;td#|G=sbSB~y)gV5 zK<3MDB`W`+Tp|MN-vZ^MV`4ep19fOP41~lh#Re_^3z2-17{-%|Bq-htr(< z&h){#;JXxfV9JV>yhlnV#I!1HHM5FOFolPieAbY3l5XY`$pTAKXsXKKBP;l2#^oxH zHX}2`!Y7%}OXjR->B?1b>?CD5dTk0fZcoqf`pLU8{k})fXrxCUUZ;;Ixtn*U=H$=H z%No4f1Ajua;6md)8XDl!t;r^_`MieF&pKH%eKz-iXGuF zE!qualf~(S7zS$Ce^2CYV zd_ws%b=~QW`SwKI-(5Be`Cu+ zQV&&@K>mZELF2Hbc$^dxiZ_m7UUp=OHPo#%2As)j{*J#KuESN41M`~hdi Bjw=8F literal 0 HcmV?d00001