Commit f8c832bc authored by Sebastien Robin's avatar Sebastien Robin

live_test: improve syntax of javascript code used for live tests

parent 68e6c832
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</item> </item>
<item> <item>
<key> <string>_EtagSupport__etag</string> </key> <key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts20671633.65</string> </value> <value> <string>ts09819354.83</string> </value>
</item> </item>
<item> <item>
<key> <string>__name__</string> </key> <key> <string>__name__</string> </key>
...@@ -25,21 +25,21 @@ ...@@ -25,21 +25,21 @@
<item> <item>
<key> <string>data</string> </key> <key> <string>data</string> </key>
<value> <string>$(document).ready(function(){\n <value> <string>$(document).ready(function(){\n
var my_url_run_test = $(document)[0].baseURI + \'runLiveTest\'\n var my_url_run_test = $(document)[0].baseURI + \'runLiveTest\';\n
var my_url_read_test = $(document)[0].baseURI + \'readTestOutput\'\n var my_url_read_test = $(document)[0].baseURI + \'readTestOutput\';\n
if (jQuery("*[name=\'field_your_test\']").length==0){\n if (jQuery("*[name=\'field_your_test\']").length===0){\n
// not in proper page no need to continue\n // not in proper page no need to continue\n
return ;\n return ;\n
}\n }\n
\n \n
var test = jQuery("*[name=\'field_your_test\']")[0].defaultValue\n var test = jQuery("*[name=\'field_your_test\']")[0].defaultValue;\n
var run_only = jQuery("*[name=\'field_your_run_only\']")[0].defaultValue\n var run_only = jQuery("*[name=\'field_your_run_only\']")[0].defaultValue;\n
var debug = 0\n var debug = 0;\n
var verbose = 0\n var verbose = 0;\n
if (jQuery("*[name=\'field_your_debug\']")[0].checked == true) {\n if (jQuery("*[name=\'field_your_debug\']")[0].checked === true) {\n
debug = 1;\n debug = 1;\n
}\n }\n
if (jQuery("*[name=\'field_your_verbose\']")[0].checked == true) {\n if (jQuery("*[name=\'field_your_verbose\']")[0].checked === true) {\n
verbose = 1;\n verbose = 1;\n
}\n }\n
jQuery("*[name=\'field_your_text_output\']")[0].defaultValue = "";\n jQuery("*[name=\'field_your_text_output\']")[0].defaultValue = "";\n
...@@ -52,35 +52,35 @@ ...@@ -52,35 +52,35 @@
verbose:verbose,\n verbose:verbose,\n
}, \n }, \n
function(data) {\n function(data) {\n
continue_loop = false\n continue_loop = false;\n
});\n });\n
var last_call = false;\n var last_call = false;\n
var data_size = 0;\n var data_size = 0;\n
var data_textarea = undefined;\n var data_textarea;\n
get_data = function() {\n get_data = function() {\n
return $.get(my_url_read_test,\n return $.get(my_url_read_test,\n
{position : data_size},\n {position : data_size},\n
function(data){\n function(data){\n
if ( data.length != undefined ) {\n if ( data.length !== undefined ) {\n
data_size = data_size + data.length;\n data_size = data_size + data.length;\n
data_textarea = jQuery("*[name=\'field_your_text_output\']")[0];\n data_textarea = jQuery("*[name=\'field_your_text_output\']")[0];\n
data_textarea.defaultValue += data;\n data_textarea.defaultValue += data;\n
data_textarea.scrollTop = data_textarea.scrollHeight;\n data_textarea.scrollTop = data_textarea.scrollHeight;\n
}\n }\n
if (continue_loop == true) {\n if (continue_loop === true) {\n
setTimeout("get_data()",1000);\n setTimeout(get_data,1000);\n
}\n }\n
if (continue_loop == false) {\n if (continue_loop === false) {\n
if (last_call == false) {\n if (last_call === false) {\n
last_call = true;\n last_call = true;\n
setTimeout("get_data()",1000);\n setTimeout(get_data,1000);\n
}\n }\n
}\n }\n
\n \n
});\n });\n
}\n };\n
var x=0;\n var x=0;\n
get_data()\n get_data();\n
\n \n
});</string> </value> });</string> </value>
</item> </item>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>size</string> </key> <key> <string>size</string> </key>
<value> <int>1938</int> </value> <value> <int>1934</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
12 13
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment