Source

The Maggot / src / templates / corpus.tmpl

Diff from to

src/templates/corpus.tmpl

     <h3>round $corpus.current_round_index</h3>
     <h3>antecedent chunk:</h3>
     <p style="font-style:italic;">$lastchunk</p>
+    <div id="hideMsg"><span>600</span> seconds remaining</div>
     <h3>write:</h3>
-    <form action="addchunk" method="POST">
-        <textarea name="text" style="width:100%">
+    <form id="chunkform" action="addchunk" method="POST">
+        <textarea name="text" style="width:100%">$text
         </textarea>
         <input type="hidden" name="cid" value="$corpus.id" />
         <input type="hidden" name="chunkid" value="$chunkid" />
     <h3>decendent chunk:</h3>
     <p style="font-style:italic;">$nextchunk</p>
     #end if
+    <script type="text/javascript">
+	var sec = 600;
+	var timer = setInterval(function() {
+	   jQuery('#hideMsg span').text(sec--);
+	   if (sec == -1) {
+	      jQuery('#hideMsg').fadeOut('fast');
+	      clearInterval(timer);
+              jQuery('#chunkform').submit();
+	   }
+	}, 1000);
+    </script>
 #include "templates/footer.tmpl"