forked from pmnazari/Interviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStackView.js
executable file
·133 lines (114 loc) · 3.16 KB
/
StackView.js
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
/**
* Represents a view in a StackApplication.
* @class
* @param {Object.<string, *>} options - An object of keyed options for initializing the view.
*/
var StackView = function(options)
{
this.options = {};
for (let key in options)
{
this.options[key] = options[key];
}
for (let key in this.options)
{
if (this.options[key] === undefined)
{
console.log("Missing required parameter: " + key);
}
}
}
/**
* @property {Object.<string, *>} options - An object of keyed options for the view. This property should be overridden by subclasses to specify options. Options with a default value of undefined are required.
*/
StackView.prototype.options = {};
/**
* @property {string} HTMLSource - The HTML source for this view.
* @abstract
*/
StackView.prototype.HTMLSource = "OVERRIDE THIS";
/**
* @property {string} styles - A CSS string containing styles for this view.
*/
StackView.prototype.styles = "";
<?php
function FileContents($filename)
{
$contents = file_get_contents($filename, true);
$contents = str_replace(array("\r", "\n"), " ", $contents);
$contents = addslashes($contents);
$contents = str_replace('$LIBDIR', $_SERVER["LIBDIR"], $contents);
echo $contents;
}
function StackViewSource()
{
$bt = debug_backtrace();
$filename = $bt[0]["file"];
$filename = preg_replace("/\..*/", ".html", $filename);
FileContents($filename);
}
?>
/**
* @property {StackApplication} application - The StackApplication this view is in, or false if the view is not currently in an application.
*/
StackView.prototype.application = false;
/**
* @property {(boolean|DOMObject)} DOMObject - The DOM Object of the view, or false if the view is not currently in the document.
*/
StackView.prototype.DOMObject = false;
/**
* Add the view to a StackApplication.
* @param {StackApplication} application - The application this view is added to.
* @param {DOMObject} DOMObject - The DOM Object in which the view resides.
*/
StackView.prototype.addToApplication = function(application, DOMObject)
{
this.application = application;
this.DOMObject = DOMObject;
this.DOMObject.append("<style>" + this.styles + "</style>");
this.onAddToApplication();
}
/**
* Remove the view from a StackApplication.
*/
StackView.prototype.removeFromApplication = function()
{
this.application = false;
this.DOMObject = false;
}
/**
* This function is called when the view is first shown.
* @abstract
*/
StackView.prototype.onAddToApplication = function()
{
}
/**
* This function is called whenever the view was previously not shown, but now is shown.
* @abstract
*/
StackView.prototype.onShow = function()
{
}
/**
* This function is called (before onShow) when this view is popped back to.
* @param {*} returnValue - A value of any type that was passed to the pop function of the StackApplication.
* @abstract
*/
StackView.prototype.onPopTo = function()
{
}
/**
* This function is called whenever the view was previously shown, but now is not anymore.
* @abstract
*/
StackView.prototype.onHide = function()
{
}
/**
* This function is called when the view is removed from the application.
* @abstract
*/
StackView.prototype.onRemoveFromApplication = function()
{
}