-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
149 lines (111 loc) · 3.53 KB
/
example.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="//www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Example</title>
<script type="text/javascript" src="AjaxServerResponseHander.min.js"></script>
<script type="text/javascript" src="example_jsLibrary.js"></script>
<link rel="stylesheet" href="example.css" type="text/css"/>
<script>
AjaxServerResponseHander.setDebugger(function(data){
console.log(data);
});
AjaxServerResponseHander.addServerFailHandler('statusCode:500', function(){
alert('Please try again latter.');
});
AjaxServerResponseHander.addServerFailHandler('statusCode:404', function(){
alert('Page not found.');
});
</script>
</head>
<body id="body">
<!-- ############################################################# -->
<!-- simple PopUp -->
<div id="dim"></div>
<div id="pop_wrapper">
<div id="pop_up">
<div id="pop_up_header">
<span id="popup_title"></span>
<span id="closePopUp">×</span>
<div style="clear:both;"></div>
</div>
<div id="popup_content">
</div>
</div>
</div>
<!-- ############################################################# -->
<div style="display: table;border:1px solid;min-width:400px;">
<div id='login_block'>
<form action="" method="POST" name="login" id="loginForm">
<input type="hidden" name="target" value="authentication"/>
<table>
<tr><th>Username</th><td><input type="text" class="login_input" placeholder="whatever" name="user_name"></td></tr>
<tr><th>Password</th><td><input type="password" class="login_input" placeholder="whatever" name="pswd"/></td></tr>
<tr><td colspan="2" class="row_button"><input type="submit" class="buttonform" value="Submit" onclick="submitForm('login');"/></td></tr>
</table>
</form>
</div>
<p id="authentication_fail" style="color:red; display:none;"></p>
<p id="authentication_response" style="display:none;"></p>
</div>
<br/>
<br/>
<button id="settings">
Settings
</button>
<br/>
<br/>
<button id="error">
Error 404
</button>
<script>
document.getElementById('loginForm').addEventListener("click", function(event){
event.preventDefault();
});
</script>
<script>
var popUpAPI={};
window.addEventListener("DOMContentLoaded", function(){
(function(){
var dim=document.getElementById('dim');
var popUp=document.getElementById('pop_wrapper');
var body=document.getElementById('pop_up');
var container=document.getElementById('popup_content');
popUp.style.top=0.1*window.innerHeight+'px';
body.style.maxHeight=0.8*window.innerHeight+'px';
popUpAPI.display=function(){
dim.style.display='block';
popUp.style.visibility='visible';
};
popUpAPI.closing=function(e){
if(typeof e!=='undefined'){
e.stopPropagation();
return;
}
popUp.style.visibility='hidden';
dim.style.display='none';
container.innerHTML='';
};
document.getElementById('closePopUp').addEventListener('click', function(){
popUpAPI.closing();
});
dim.addEventListener('click', function(){
popUpAPI.closing();
});
popUp.addEventListener('click', function(){
popUpAPI.closing();
});
container.addEventListener('click', function(event){
popUpAPI.closing(event);
});
document.getElementById('settings').addEventListener('click', function () {
sendPostData('target=popUp');
});
document.getElementById('error').addEventListener('click', function () {
sendPostData('target=popUp', 'router.php');
});
})();
})
</script>
</body>
</html>