Repository navigation
Expand file tree
/
Copy pathapp.html
More file actions
92 lines (80 loc) · 3.02 KB
/
Copy pathapp.html
File metadata and controls
92 lines (80 loc) · 3.02 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
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
<!DOCTYPE HTML>
<html>
<head>
<title>App page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="WebUI.js"></script>
<script type="text/javascript" src="WebUIStyle.js"></script>
<script type="text/javascript" src="WebUIClock.js"></script>
<style type="text/css">
#appWrapper {
margin: 0 auto;
width: 500px;
height: 100%;
transition: all .3s;
position: relative;
}
#clock {
position: absolute;
top: 0px;
right: 0px;
color: #333;
font-size: 3rem;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
/* Template implementing */
function createTemplateApp() {
var steps = {
process: function() {
this.header();
this.content();
this.footer();
}
};
var In = function(){};
In.prototype = steps;
return new In();
}
function runApp() {
var container = $("#appWrapper");
var params = {container:container};
var initApp = createTemplateApp();
// implement template steps
initApp.header = function()
{
console.log("initApp: header step");
};
initApp.footer = function()
{
console.log("initApp: footer step");
};
initApp.content = function()
{
var _app = new App(params);
container.append(_app.renderApp());
/* Create and implement style changer visitor */
var _setStyle = new WebUIStyle({init:false});
_app.setVisitor(_setStyle, "style");
/* Create and implent timer visitor */
var _clockStyle = new WebUIClock();
_app.setVisitor(_clockStyle, "clock");
_clockStyle.startstoptimer();
_app.addListener("onRemove", function(obj){
console.log("Do something now ... when onRemove", obj);
container.append(_app.renderApp());
_setStyle.changeStyle("#CC0000");
});
}
initApp.process();
}
runApp();
});
</script>
</head>
<body>
<div id="appWrapper"></div>
</body>
</html>