forked from n0rad/jstest-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.html
45 lines (40 loc) · 1.11 KB
/
bookmarklet.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
<html>
<head></head>
<body></body>
<script type="text/javascript">
// go to http://jscompress.com/ to compress js
javascript: (function() {
var xmlhttpPost = function(strURL, obj, callback) {
var xmlHttpReq = false;
if (window.XMLHttpRequest) {
xmlHttpReq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttpReq = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlHttpReq.open('POST', strURL, true);
xmlHttpReq.setRequestHeader('Content-Type',
'application/x-www-form-urlencoded');
xmlHttpReq.onreadystatechange = function() {
if (xmlHttpReq.readyState == 4) {
if (callback != undefined) {
callback(xmlHttpReq.responseText);
}
}
}
xmlHttpReq.send(JSON.stringify(obj));
}
var url = prompt('What is the url of JsTest server ?',
'http://localhost:8234');
if (url !== null) {
document.documentElement.innerHTML = 'Waiting for server...';
setInterval(function() {
xmlhttpPost(url + '/runId', null, function(serverRunId) {
if (serverRunId !== '') {
window.location.href = url;
}
});
}, 500);
}
})()
</script>
</html>