-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjavascriptEval.html
More file actions
32 lines (32 loc) · 1.23 KB
/
javascriptEval.html
File metadata and controls
32 lines (32 loc) · 1.23 KB
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
<!DOCTYPE html>
<html>
<body><div id="javascriptEval">
<button onclick="
let r;
try{
r = eval(document.getElementById('javascriptEvalEditor').value);
}catch(e){
r = e;
}
try{
document.getElementById('javascriptEvalInfo').textContent = r;
}catch(ignore){}
">Eval</button>
<button onclick="
let url = window.location.toString().replace(/\?.*/,'') + '?' + encodeURI(document.getElementById('javascriptEvalEditor').value);
window.history.pushState({},'', url);
prompt('copy',url);
">Share</button>
<button onclick="
if(confirm('Press the Eval button and the code will run using javascript eval, without iframes.\nPress the Share button to generate an url with the current input code.\nDo you want more info? Press yes to open GitHub.')) window.open('https://github.com/TrianguloY/githubPages/tree/master/javascriptEval')
">Info</button>
<br/>
<textarea id="javascriptEvalEditor" style="width:100%" rows="5"></textarea>
<br/>
<span>Output: </span><span id="javascriptEvalInfo"></span>
<script>
let editor = document.getElementById('javascriptEvalEditor');
if(location.search != '' && editor.value == '') editor.value = decodeURI(location.search.substring(1))
</script>
</div></body>
</html>