-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs-tool.html
66 lines (60 loc) · 1.72 KB
/
js-tool.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html><html><head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-38277515-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<meta charset="utf-8" />
<title>Javascript Online Realtime Evaluator</title>
<script src="jquery-ui-1.9.2.custom/js/jquery-1.8.3.min.js"></script>
<script>
var result = "";
var lines = new Array();
function splitXmlIntoLines(){
lines = $("#lines").val().split("\n");
}
function evalJsTextArea(){
eval($("#js").val());
$("#result").val(result);
}
$(document).ready(function() {
splitXmlIntoLines();
evalJsTextArea();
$("#lines").keyup(function(){
splitXmlIntoLines();
evalJsTextArea();
});
$("#js").keyup(function(){
evalJsTextArea();
});
});
</script>
<style>
textarea{height:400px;width:30%;}
</style>
</head>
<body>
<textarea id="lines">
This is your input
data, it gets populated into
the "lines" variable (as a String Array).
</textarea>
<textarea id="js">
// Here you can write any javascript.
// (Set the "result" variable to populate the output textarea)
// Populate the result
result = "";
$.each(lines, function(i, line){
result += i + 1 + "> " + line + "?\n";
});
// Modify this window
$("#result").css("border","3px solid red");
</textarea>
<textarea id="result"></textarea>
<body>
</html>