-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.html
34 lines (33 loc) · 895 Bytes
/
index.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
<html>
<head>
<title>nProxy Demo</title>
</head>
<body>
<h1>nPorxy Demo</h1>
<label for="address" ><input id="address" style="width:200px"></label>
<button onClick="onStart()" style="width:50px;" >Go!</button>
<script>
(function(){
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/,'');
}
})();
function onStart()
{
var input = document.getElementById("address").value.trim();
var addRegExp = /^(?:(https?:)?\/\/)?([^\/]+.*$)/i;
var ret = null;
if(input != '' && (ret = input.match(addRegExp)))
{
ret[1] = (ret[1]?ret[1].replace(':','/'):'http/');
var proxyUrl = '/nproxy/' + ret[1] + ret[2];
window.location = proxyUrl;
}
else
{
alert('address is invalid!');
}
}
</script>
</body>
</html>