targetj 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jshintrc +3 -0
- package/Gruntfile.js +42 -0
- package/package.json +27 -0
- package/src/$Dom.js +358 -0
- package/src/App.js +142 -0
- package/src/Bracket.js +201 -0
- package/src/Browser.js +297 -0
- package/src/Dim.js +19 -0
- package/src/EventListener.js +454 -0
- package/src/LoadingManager.js +348 -0
- package/src/LocationManager.js +156 -0
- package/src/PageManager.js +104 -0
- package/src/SearchUtil.js +179 -0
- package/src/TModel.js +761 -0
- package/src/TModelManager.js +378 -0
- package/src/TUtil.js +202 -0
- package/src/TargetManager.js +228 -0
- package/src/TargetUtil.js +221 -0
- package/src/Viewport.js +184 -0
package/.jshintrc
ADDED
package/Gruntfile.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module.exports = function(grunt) {
|
|
2
|
+
var jsrc = ['src/*.js'];
|
|
3
|
+
|
|
4
|
+
// Project configuration.
|
|
5
|
+
grunt.initConfig({
|
|
6
|
+
|
|
7
|
+
jshint:{
|
|
8
|
+
options: {
|
|
9
|
+
laxbreak: true,
|
|
10
|
+
sub: true,
|
|
11
|
+
expr: true,
|
|
12
|
+
loopfunc: true
|
|
13
|
+
},
|
|
14
|
+
all: jsrc
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
concat: {
|
|
18
|
+
dist: {
|
|
19
|
+
src: jsrc,
|
|
20
|
+
dest: 'build/targetj.js'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
uglify: {
|
|
25
|
+
dist: {
|
|
26
|
+
src: 'build/targetj.js',
|
|
27
|
+
dest: 'build/targetj.<%= new Date().getTime() %>.min.js'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
35
|
+
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
36
|
+
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
37
|
+
// Default task.
|
|
38
|
+
|
|
39
|
+
grunt.registerTask('build', ['jshint','concat']);
|
|
40
|
+
grunt.registerTask('default', ['jshint','concat','uglify']);
|
|
41
|
+
|
|
42
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "targetj",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"targetj"
|
|
6
|
+
],
|
|
7
|
+
"contributors": [
|
|
8
|
+
"ahmad.wasfi"
|
|
9
|
+
],
|
|
10
|
+
"description": "TargetJ is a JavaScript framework designed for creating animated and efficient web user interfaces.",
|
|
11
|
+
"main": "Gruntfile.js",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/livetrails/targetj.io.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/livetrails/targetj.io/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "http://targetj.io",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"grunt": "^1.6.1",
|
|
23
|
+
"grunt-contrib-concat": "^2.1.0",
|
|
24
|
+
"grunt-contrib-jshint": "^3.2.0",
|
|
25
|
+
"grunt-contrib-uglify": "^5.2.2"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/$Dom.js
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
function $Dom(elemSelector) {
|
|
2
|
+
if (typeof elemSelector === 'string') {
|
|
3
|
+
this.selector = elemSelector;
|
|
4
|
+
this.element = $Dom.query(elemSelector);
|
|
5
|
+
} else if (elemSelector) {
|
|
6
|
+
this.element = elemSelector;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
this.childrenCount = 0;
|
|
10
|
+
this.$domParent = undefined;
|
|
11
|
+
this.originalContent = undefined;
|
|
12
|
+
this.textOnly = true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$Dom.prototype.exists = function() {
|
|
16
|
+
if (this.selector) {
|
|
17
|
+
this.element = $Dom.query(this.selector);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return !!this.element;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
$Dom.prototype.create = function(tag) {
|
|
24
|
+
this.element = document.createElement(tag);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
$Dom.prototype.setSelector = function(selector) {
|
|
28
|
+
this.selector = selector;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
$Dom.prototype.setId = function(id) {
|
|
32
|
+
this.attr("id", id[0] === '#' ? id.slice(1) : id);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
$Dom.prototype.focus = function() {
|
|
36
|
+
this.element.focus();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
$Dom.prototype.attr = function(name, value) {
|
|
40
|
+
if (!this.element) return;
|
|
41
|
+
|
|
42
|
+
if (TUtil.isDefined(value)) {
|
|
43
|
+
this.element.setAttribute(name, value);
|
|
44
|
+
} else {
|
|
45
|
+
return this.element.getAttribute(name);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
$Dom.prototype.opacity = function(opacity) {
|
|
50
|
+
if (TUtil.isDefined(opacity)) {
|
|
51
|
+
this.element.style.opacity = opacity;
|
|
52
|
+
} else {
|
|
53
|
+
return this.element.style.opacity;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
$Dom.prototype.width = function(width) {
|
|
58
|
+
if (TUtil.isDefined(width)) {
|
|
59
|
+
this.element.style.width = TUtil.isNumber(width) ? width + 'px' : width;
|
|
60
|
+
} else {
|
|
61
|
+
return this.element.offsetWidth;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
$Dom.prototype.height = function(height) {
|
|
66
|
+
if (TUtil.isDefined(height)) {
|
|
67
|
+
this.element.style.height = TUtil.isNumber(height) ? height + 'px' : height;
|
|
68
|
+
} else {
|
|
69
|
+
return this.element.offsetHeight;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
$Dom.prototype.zIndex = function(zIndex) {
|
|
74
|
+
if (TUtil.isDefined(zIndex)) {
|
|
75
|
+
this.element.style.zIndex = zIndex;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return this.element.style.zIndex;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
$Dom.prototype.css = function(css) {
|
|
82
|
+
if (TUtil.isDefined(css)) {
|
|
83
|
+
this.attr('class', css);
|
|
84
|
+
} else {
|
|
85
|
+
return this.attr('classs');
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
$Dom.prototype.setStyleByMap = function(attrMap) {
|
|
90
|
+
var self = this;
|
|
91
|
+
Object.keys(attrMap).forEach(function(key) {
|
|
92
|
+
var value = attrMap[key];
|
|
93
|
+
switch(key) {
|
|
94
|
+
case 'transform':
|
|
95
|
+
self.transform.apply(self, value);
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'width':
|
|
99
|
+
self.width(value);
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 'height':
|
|
103
|
+
self.height(value);
|
|
104
|
+
break;
|
|
105
|
+
|
|
106
|
+
case 'zIndex':
|
|
107
|
+
self.zIndex(value);
|
|
108
|
+
break;
|
|
109
|
+
|
|
110
|
+
case 'opacity':
|
|
111
|
+
self.opacity(value);
|
|
112
|
+
break;
|
|
113
|
+
|
|
114
|
+
default:
|
|
115
|
+
self.setStyle(key, value);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
$Dom.prototype.setStyle = function(name, value) {
|
|
121
|
+
this.element.style[name] = value;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
$Dom.prototype.getStyle = function(name) {
|
|
125
|
+
return this.element.style[name];
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
$Dom.prototype.getStyleValue = function(name) {
|
|
129
|
+
var styleValue = this.getStyle(name);
|
|
130
|
+
var numericValue = TUtil.isDefined(styleValue) ? styleValue.replace(/[^-\d.]/g, '') : 0;
|
|
131
|
+
return parseFloat(numericValue);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
$Dom.prototype.parent = function() {
|
|
135
|
+
return this.element ? this.element.parentElement : null;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
$Dom.prototype.detach = function() {
|
|
139
|
+
$Dom.detach(this.element);
|
|
140
|
+
if (this.$domParent && this.$domParent.childrenCount > 0) this.$domParent.childrenCount--;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
$Dom.prototype.append$Dom = function($dom) {
|
|
144
|
+
this.element.appendChild($dom.element);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
$Dom.prototype.appendTModel$Dom = function(tmodel) {
|
|
148
|
+
if (this.childrenCount === 0 && this.element.children.length > 1 && tmodel.getDomParent() && tmodel.getDomParent().getHtml()
|
|
149
|
+
&& tmodel.getDomParent().getHtml() === this.originalContent) {
|
|
150
|
+
this.element.innerHTML = "<div>" + this.html() + "</div>";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.element.appendChild(tmodel.$dom.element);
|
|
154
|
+
tmodel.$dom.$domParent = this;
|
|
155
|
+
this.childrenCount++;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
$Dom.prototype.html = function(html) {
|
|
159
|
+
if (TUtil.isDefined(html)) {
|
|
160
|
+
if (this.childrenCount > 0) {
|
|
161
|
+
|
|
162
|
+
var element = document.createElement('div');
|
|
163
|
+
element.innerHTML = html;
|
|
164
|
+
|
|
165
|
+
if (TUtil.isDefined(this.originalContent)) {
|
|
166
|
+
this.element.replaceChild(element, this.element.firstChild);
|
|
167
|
+
} else {
|
|
168
|
+
this.element.insertBefore(element, this.element.firstChild);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
this.originalContent = html;
|
|
172
|
+
this.textOnly = false;
|
|
173
|
+
|
|
174
|
+
} else {
|
|
175
|
+
this.element.innerHTML = html;
|
|
176
|
+
this.originalContent = html;
|
|
177
|
+
this.textOnly = false;
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
return this.originalContent;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
$Dom.prototype.text = function(text) {
|
|
185
|
+
if (TUtil.isDefined(text)) {
|
|
186
|
+
if (this.childrenCount > 0) {
|
|
187
|
+
var element = document.createTextNode(text);
|
|
188
|
+
if (TUtil.isDefined(this.originalContent)) {
|
|
189
|
+
this.element.replaceChild(element, this.element.firstChild);
|
|
190
|
+
} else {
|
|
191
|
+
this.element.insertBefore(element, this.element.firstChild);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.originalContent = text;
|
|
195
|
+
this.textOnly = true;
|
|
196
|
+
|
|
197
|
+
} else {
|
|
198
|
+
this.element.textContent = text;
|
|
199
|
+
this.originalContent = text;
|
|
200
|
+
this.textOnly = true;
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
return this.originalContent;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
$Dom.prototype.outerHTML = function(html) {
|
|
208
|
+
this.element.outerHTML = html;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
$Dom.prototype.innerHTML = function(html) {
|
|
212
|
+
if (TUtil.isDefined(html)) {
|
|
213
|
+
this.element.innerHTML = html;
|
|
214
|
+
} else {
|
|
215
|
+
return this.element.innerHTML;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
$Dom.prototype.addClass = function(className) {
|
|
220
|
+
var oldValue = this.attr('class');
|
|
221
|
+
var newValue = !oldValue ? className : oldValue.indexOf(className) >= 0 ? oldValue : oldValue + ' ' + className;
|
|
222
|
+
|
|
223
|
+
if (newValue !== oldValue) {
|
|
224
|
+
this.attr('class', newValue);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
$Dom.prototype.addEvent = function (type, fn) {
|
|
229
|
+
if (!this.element.addEventListener) {
|
|
230
|
+
this.element.attachEvent("on" + type, fn);
|
|
231
|
+
} else {
|
|
232
|
+
this.element.addEventListener(type, fn, { capture: false, passive: false });
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
$Dom.prototype.detachEvent = function (type, fn) {
|
|
237
|
+
if (this.element.removeEventListener) {
|
|
238
|
+
this.element.removeEventListener(type, fn, false);
|
|
239
|
+
} else if (this.element.detachEvent) {
|
|
240
|
+
this.element.detachEvent("on" + type, fn);
|
|
241
|
+
} else {
|
|
242
|
+
this.element["on" + type] = null;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
$Dom.prototype.transform = function(x, y, rotate, scale) {
|
|
247
|
+
var tranformValue = this.createTrasformValue(x, y, rotate, scale);
|
|
248
|
+
if (tranformValue !== this.element.style[browser.style.transform]) {
|
|
249
|
+
this.element.style[browser.style.transform] = tranformValue;
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
$Dom.prototype.createTrasformValue = function(x, y, rotate, scale) {
|
|
254
|
+
rotate = TUtil.isDefined(rotate) && rotate !== 0 ? 'rotate(' + rotate + 'deg)' : '';
|
|
255
|
+
scale = TUtil.isDefined(scale) && scale !== 1 ? 'scale(' + scale + ')' : '';
|
|
256
|
+
|
|
257
|
+
return 'translate(' + x + 'px,' + y + 'px)' + rotate + scale;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
$Dom.prototype.getContext = function(type, selector) {
|
|
261
|
+
var element = TUtil.isDefined(selector) ? $Dom.query(selector) : this.query('canvas');
|
|
262
|
+
return element ? element.getContext(type) : undefined;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
$Dom.prototype.findFirstByClass = function(className) {
|
|
266
|
+
return $Dom.findFirstByClass(className, this.element);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
$Dom.prototype.findFirstByTag = function(tagName) {
|
|
270
|
+
return $Dom.findFirstByTag(tagName, this.element);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
$Dom.prototype.query = function(selector) {
|
|
274
|
+
return selector[0] === '#' ? $Dom.findById(selector) : selector[0] === '.' ? this.findFirstByClass(selector) : this.findFirstByTag(selector);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
$Dom.query = function(selector) {
|
|
278
|
+
return selector[0] === '#' ? $Dom.findById(selector) : selector[0] === '.' ? $Dom.findFirstByClass(selector) : $Dom.findFirstByTag(selector);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
$Dom.findById = function(id) {
|
|
282
|
+
return document.getElementById(id[0] === '#' ? id.slice(1) : id);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
$Dom.findFirstByClass = function(className, element) {
|
|
286
|
+
var elements = $Dom.findByClass(className, element);
|
|
287
|
+
return elements.length > 0 ? elements[0] : null;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
$Dom.findFirstByTag = function(tagName, element) {
|
|
291
|
+
var elements = $Dom.findByTag(tagName, element);
|
|
292
|
+
return elements.length > 0 ? elements[0] : null;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
$Dom.findByTag = function(tagName, element) {
|
|
296
|
+
element = TUtil.isDefined(element) ? element : document;
|
|
297
|
+
return element.getElementsByTagName(tagName);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
$Dom.findByClass = function(className, element) {
|
|
301
|
+
element = TUtil.isDefined(element) ? element : document;
|
|
302
|
+
return element.getElementsByClassName(className[0] === '.' ? className.slice(1) : className);
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
$Dom.findNearestParentWithId = function(element) {
|
|
306
|
+
while (element) {
|
|
307
|
+
if (typeof element.getAttribute === 'function' && element.getAttribute("id")) {
|
|
308
|
+
return element.getAttribute("id");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
element = element.parentElement;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
$Dom.detach = function(element) {
|
|
316
|
+
var parent = TUtil.isDefined(element) ? element.parentElement : null;
|
|
317
|
+
if (parent) {
|
|
318
|
+
parent.removeChild(element);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
$Dom.ready = function(callback) {
|
|
323
|
+
var $doc = new $Dom(document);
|
|
324
|
+
$doc.addEvent('DOMContentLoaded', callback);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
$Dom.ajax = function(query) {
|
|
328
|
+
var xhr = new XMLHttpRequest();
|
|
329
|
+
|
|
330
|
+
var params = "";
|
|
331
|
+
if (query.data) {
|
|
332
|
+
params = Object.keys(query.data).map(function(key) {
|
|
333
|
+
return key + "=" + encodeURIComponent(query.data[key]);
|
|
334
|
+
}).join('&');
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
xhr.onreadystatechange = function () {
|
|
338
|
+
if (xhr.readyState === 4) {
|
|
339
|
+
if (xhr.status === 200) {
|
|
340
|
+
var response = query.dataType === 'json' ? JSON.parse(this.responseText) : this.responseText;
|
|
341
|
+
query.success(response);
|
|
342
|
+
} else {
|
|
343
|
+
query.error(xhr.status);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
if (query.type === 'POST') {
|
|
349
|
+
xhr.open(query.type, query.url, true);
|
|
350
|
+
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
|
351
|
+
xhr.send(params);
|
|
352
|
+
} else {
|
|
353
|
+
query.url += !params ? "" : query.url > "" && query.url.indexOf("?") >= 0 ? "&" + params : "?" + params;
|
|
354
|
+
xhr.open(query.type, query.url, true);
|
|
355
|
+
xhr.send();
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
package/src/App.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
var tapp;
|
|
2
|
+
|
|
3
|
+
function App(uiFn, rootId) {
|
|
4
|
+
|
|
5
|
+
function my() {}
|
|
6
|
+
|
|
7
|
+
my.throttle = 0;
|
|
8
|
+
my.debugLevel = 0;
|
|
9
|
+
|
|
10
|
+
my.runningFlag = false;
|
|
11
|
+
|
|
12
|
+
my.oids = {};
|
|
13
|
+
|
|
14
|
+
my.rootId = rootId ? rootId || uiFn.rootId : "#tpage";
|
|
15
|
+
|
|
16
|
+
my.init = function(uiFn) {
|
|
17
|
+
browser.setup();
|
|
18
|
+
|
|
19
|
+
my.window = new $Dom(window);
|
|
20
|
+
my.window.addEvent("popstate", function(event) {
|
|
21
|
+
if (event.state) {
|
|
22
|
+
tapp.pagers.openLinkFromHistory(event.state);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
my.uiFn = uiFn;
|
|
27
|
+
this.ui = uiFn();
|
|
28
|
+
this.ui.xVisible = true;
|
|
29
|
+
this.ui.yVisible = true;
|
|
30
|
+
|
|
31
|
+
my.loader = new LoadingManager();
|
|
32
|
+
|
|
33
|
+
my.pagers = new PageManager();
|
|
34
|
+
|
|
35
|
+
my.dim = Dim().measureScreen();
|
|
36
|
+
|
|
37
|
+
my.events = new EventListener();
|
|
38
|
+
|
|
39
|
+
my.locationManager = new LocationManager();
|
|
40
|
+
my.targetManager = new TargetManager();
|
|
41
|
+
my.manager = new TModelManager();
|
|
42
|
+
|
|
43
|
+
window.history.pushState({ link: document.URL }, "", document.URL);
|
|
44
|
+
|
|
45
|
+
return my;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
my.start = function () {
|
|
49
|
+
my.runningFlag = false;
|
|
50
|
+
|
|
51
|
+
if (!$Dom.query(my.rootId)) {
|
|
52
|
+
my.$dom = new $Dom();
|
|
53
|
+
my.$dom.create('div');
|
|
54
|
+
my.$dom.setSelector(my.rootId);
|
|
55
|
+
my.$dom.setId(my.rootId);
|
|
56
|
+
my.$dom.attr("tabindex", "0");
|
|
57
|
+
new $Dom('body').append$Dom(my.$dom);
|
|
58
|
+
} else {
|
|
59
|
+
my.$dom = new $Dom(my.rootId);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
my.events.removeHandlers();
|
|
63
|
+
my.events.clear();
|
|
64
|
+
|
|
65
|
+
my.events.addHandlers();
|
|
66
|
+
my.dim.measureScreen();
|
|
67
|
+
my.resetRuns();
|
|
68
|
+
|
|
69
|
+
my.runningFlag = true;
|
|
70
|
+
|
|
71
|
+
my.$dom.focus();
|
|
72
|
+
|
|
73
|
+
my.manager.scheduleRun(0, "appStart");
|
|
74
|
+
|
|
75
|
+
return my;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
my.stop = function() {
|
|
79
|
+
my.runningFlag = false;
|
|
80
|
+
|
|
81
|
+
my.events.removeHandlers();
|
|
82
|
+
my.events.clear();
|
|
83
|
+
|
|
84
|
+
my.resetRuns();
|
|
85
|
+
|
|
86
|
+
return my;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
my.resetRuns = function() {
|
|
90
|
+
my.manager.nextRuns = [];
|
|
91
|
+
my.manager.runningStep = 0;
|
|
92
|
+
my.manager.runningFlag = false;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
my.reset = function() {
|
|
96
|
+
my.manager.lists.visible.forEach(function(tmodel) { tmodel.domValues = {}; });
|
|
97
|
+
my.manager.lists.visible.length = 0;
|
|
98
|
+
my.manager.lists.invisibleDom.length = 0;
|
|
99
|
+
my.manager.lists.deletedTModel.length = 0;
|
|
100
|
+
my.manager.lists.visibleNoDom.length = 0;
|
|
101
|
+
my.manager.visibleTypeMap = {};
|
|
102
|
+
my.manager.visibleOidMap = {};
|
|
103
|
+
my.locationManager.hasLocationList.length = 0;
|
|
104
|
+
SearchUtil.foundParentWithTarget = {};
|
|
105
|
+
SearchUtil.foundTypeMap = {};
|
|
106
|
+
SearchUtil.foundTargetMap = {};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
my.isRunning = function() {
|
|
110
|
+
return my.runningFlag;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
my.find = function(oid) {
|
|
114
|
+
return SearchUtil.find(oid);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
my.getOid = function(type) {
|
|
118
|
+
if (!TUtil.isDefined(my.oids[type])) {
|
|
119
|
+
my.oids[type] = 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var num = my.oids[type]++;
|
|
123
|
+
return { oid: num > 0 ? type + num : type, num: num };
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
my.brackets = function(oid) {
|
|
127
|
+
return tapp.locationManager.bracketMap[oid] ? tapp.locationManager.bracketMap[oid].list : null;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
tapp = my;
|
|
131
|
+
my.init(uiFn).start();
|
|
132
|
+
|
|
133
|
+
return my;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
$Dom.ready(function() {
|
|
137
|
+
window._ = window._ || SearchUtil.find;
|
|
138
|
+
|
|
139
|
+
if (typeof window.MainT === 'function') {
|
|
140
|
+
App(MainT);
|
|
141
|
+
}
|
|
142
|
+
});
|