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/src/Bracket.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
function Bracket(parent) {
|
|
2
|
+
|
|
3
|
+
var tm = new TModel("BI");
|
|
4
|
+
tm.parent = parent;
|
|
5
|
+
tm.newFlag = true;
|
|
6
|
+
|
|
7
|
+
tm.targets = {
|
|
8
|
+
canHaveDom: false,
|
|
9
|
+
innerXEast: {
|
|
10
|
+
loop: true,
|
|
11
|
+
value: function() {
|
|
12
|
+
return TUtil.isDefined(tm.getRealParent().getValue('innerXEast')) ? tm.getRealParent().getValue('innerXEast') : tm.getRealParent().absX + tm.getRealParent().getWidth();
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
xOverflow: {
|
|
16
|
+
loop: true,
|
|
17
|
+
value: function() {
|
|
18
|
+
return this.getRealParent().getX();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
outerXEast: 0
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
tm.getTargetWidth = function() {
|
|
25
|
+
return this.getContentWidth();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
tm.getTargetHeight = function() {
|
|
29
|
+
return this.getContentHeight();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
tm.getWidth = function() {
|
|
33
|
+
return this.getContentWidth() || 1;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
tm.getHeight = function() {
|
|
37
|
+
return this.getContentHeight() || 1;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
tm.getInnerWidth = function() {
|
|
41
|
+
return this.innerContentWidth;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
tm.getInnerContentHeight = function() {
|
|
45
|
+
return this.innerContentHeight;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
tm.getScrollTop = function() {
|
|
49
|
+
this.initParents();
|
|
50
|
+
return this.getRealParent().getScrollTop();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
tm.getScrollLeft = function() {
|
|
54
|
+
this.initParents();
|
|
55
|
+
return this.getRealParent().getScrollLeft();
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
tm.addUpdatingChild = function(child) {
|
|
59
|
+
this.getRealParent().addUpdatingChild(child);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
tm.createViewport = function() {
|
|
63
|
+
return this.getRealParent().createViewport.call(this);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
tm.getRealParent = function() {
|
|
67
|
+
this.initParents();
|
|
68
|
+
return this.realParent;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
tm.shouldCalculateChildrenLocations = function() {
|
|
72
|
+
var result = this.isVisible() || this.newFlag;
|
|
73
|
+
this.newFlag = false;
|
|
74
|
+
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
tm.getChildren = function() {
|
|
79
|
+
return this.actualValues.tchildren;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
tm.addToParentVisibleList = function() {};
|
|
83
|
+
|
|
84
|
+
tm.initParents = function() {
|
|
85
|
+
if (this.realParent || this.topBracket) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var topBracket = this;
|
|
90
|
+
var parent = this.bracketParent;
|
|
91
|
+
|
|
92
|
+
while (parent) {
|
|
93
|
+
|
|
94
|
+
if (parent.type !== 'BI') {
|
|
95
|
+
break;
|
|
96
|
+
} else {
|
|
97
|
+
topBracket = parent;
|
|
98
|
+
parent = parent.bracketParent;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.realParent = parent;
|
|
103
|
+
this.topBracket = topBracket;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
tm.getChildrenOids = function() {
|
|
107
|
+
|
|
108
|
+
var oids = [], list = this.getChildren();
|
|
109
|
+
|
|
110
|
+
for (var i = 0; i < list.length; i++) {
|
|
111
|
+
var item = list[i];
|
|
112
|
+
if (item.type === 'BI') {
|
|
113
|
+
var goids = item.getChildrenOids();
|
|
114
|
+
|
|
115
|
+
oids = [].concat(oids, [item.oid], goids);
|
|
116
|
+
} else {
|
|
117
|
+
oids.push(item.oid + ":" + (item.location ? item.y + "px" : "0px"));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return oids;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return tm;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
Bracket.bracketMap = {};
|
|
129
|
+
Bracket.bracketAllMap = {};
|
|
130
|
+
|
|
131
|
+
Bracket.generate = function(page, listOfTModel) {
|
|
132
|
+
var i;
|
|
133
|
+
var brackets = Bracket.bracketMap[page.oid];
|
|
134
|
+
|
|
135
|
+
var maxLastUpdate = Math.max(page.getActualValueLastUpdate('allChildren'), page.getActualValueLastUpdate('width'), page.getActualValueLastUpdate('height'));
|
|
136
|
+
|
|
137
|
+
if (brackets && brackets.lastUpdate >= maxLastUpdate) {
|
|
138
|
+
brackets = Bracket.bracketMap[page.oid];
|
|
139
|
+
} else {
|
|
140
|
+
brackets = {
|
|
141
|
+
lastUpdate: maxLastUpdate,
|
|
142
|
+
list: []
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
listOfTModel = page.type !== 'BI' && !listOfTModel ? page.getChildren() : listOfTModel;
|
|
146
|
+
|
|
147
|
+
var length = listOfTModel.length;
|
|
148
|
+
var cannotBeBracketedIndex = 0;
|
|
149
|
+
|
|
150
|
+
for (i = 0; i < length; i++) {
|
|
151
|
+
if (!listOfTModel[i].canBeBracketed()) {
|
|
152
|
+
cannotBeBracketedIndex++;
|
|
153
|
+
brackets.list.push(listOfTModel[i]);
|
|
154
|
+
} else {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var bracketSize = Math.max(2, tapp.locationManager.bracketThreshold - 1);
|
|
160
|
+
var bracketCount = Math.ceil((length - cannotBeBracketedIndex) / bracketSize);
|
|
161
|
+
|
|
162
|
+
var index = cannotBeBracketedIndex;
|
|
163
|
+
for (i = 0; i < bracketCount; i++) {
|
|
164
|
+
|
|
165
|
+
var size = Math.min(length - index, bracketSize);
|
|
166
|
+
|
|
167
|
+
var bracketId = page.oid + "_" + page.getWidth() + "_" + page.getHeight() + "_" + listOfTModel.slice(index, index + size).oids('_');
|
|
168
|
+
var bracket;
|
|
169
|
+
|
|
170
|
+
if (Bracket.bracketAllMap[bracketId]) {
|
|
171
|
+
bracket = Bracket.bracketAllMap[bracketId];
|
|
172
|
+
} else {
|
|
173
|
+
bracket = new Bracket(page);
|
|
174
|
+
|
|
175
|
+
Bracket.bracketAllMap[bracketId] = bracket;
|
|
176
|
+
|
|
177
|
+
bracket.actualValues.tchildren = listOfTModel.slice(index, index + size);
|
|
178
|
+
|
|
179
|
+
if (bracket.actualValues.tchildren[0].type === 'BI') {
|
|
180
|
+
|
|
181
|
+
bracket.actualValues.children.forEach(function(b) {
|
|
182
|
+
b.bracketParent = bracket;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
bracket.bracketParent = page;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
brackets.list.push(bracket);
|
|
190
|
+
index += size;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (brackets.list.length - cannotBeBracketedIndex > tapp.locationManager.bracketThreshold) {
|
|
194
|
+
brackets = Bracket.generate(page, brackets.list);
|
|
195
|
+
} else {
|
|
196
|
+
Bracket.bracketMap[page.oid] = brackets;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return brackets;
|
|
201
|
+
};
|
package/src/Browser.js
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
var browser = {
|
|
2
|
+
style: undefined,
|
|
3
|
+
localStorage: null,
|
|
4
|
+
startTimes: [],
|
|
5
|
+
callCount: {},
|
|
6
|
+
delayProcess: {},
|
|
7
|
+
setup: function () {
|
|
8
|
+
|
|
9
|
+
if (typeof String.prototype.trim !== 'function') {
|
|
10
|
+
String.prototype.trim = function () {
|
|
11
|
+
return this.replace(/^\s+|\s+$/g, '');
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
if (typeof String.prototype.startsWith !== 'function') {
|
|
15
|
+
String.prototype.startsWith = function (str) {
|
|
16
|
+
return this.indexOf(str) === 0;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (typeof String.prototype.endsWith !== 'function') {
|
|
21
|
+
String.prototype.endsWith = function (suffix) {
|
|
22
|
+
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof String.prototype.hashCode !== 'function') {
|
|
27
|
+
String.prototype.hashCode = function () {
|
|
28
|
+
var hash = 0, i, chr, len;
|
|
29
|
+
if (this.length === 0)
|
|
30
|
+
return hash;
|
|
31
|
+
for (i = 0, len = this.length; i < len; i++) {
|
|
32
|
+
chr = this.charCodeAt(i);
|
|
33
|
+
hash = ((hash << 5) - hash) + chr;
|
|
34
|
+
hash |= 0; // Convert to 32bit integer
|
|
35
|
+
}
|
|
36
|
+
return Math.abs(hash);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!Array.prototype.oids) {
|
|
41
|
+
Array.prototype.oids = function(separator) {
|
|
42
|
+
return this.map(function(o) { return o.oid; }).join(separator || " ");
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!Array.spaces) {
|
|
47
|
+
Array.spaces = function(count) {
|
|
48
|
+
return Array(count).join(' ');
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if (!Array.prototype.find) {
|
|
55
|
+
Object.defineProperty(Array.prototype, 'find', {
|
|
56
|
+
value: function(predicate) {
|
|
57
|
+
if (this === null) {
|
|
58
|
+
throw new TypeError('"this" is null or not defined');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var o = Object(this);
|
|
62
|
+
|
|
63
|
+
var len = o.length >>> 0;
|
|
64
|
+
|
|
65
|
+
if (typeof predicate !== 'function') {
|
|
66
|
+
throw new TypeError('predicate must be a function');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var thisArg = arguments[1];
|
|
70
|
+
|
|
71
|
+
var k = 0;
|
|
72
|
+
|
|
73
|
+
while (k < len) {
|
|
74
|
+
var kValue = o[k];
|
|
75
|
+
if (predicate.call(thisArg, kValue, k, o)) {
|
|
76
|
+
return kValue;
|
|
77
|
+
}
|
|
78
|
+
k++;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return undefined;
|
|
82
|
+
},
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if (!document.getElementsByClassName) {
|
|
90
|
+
var indexOf = [].indexOf || function (prop) {
|
|
91
|
+
for (var i = 0; i < this.length; i++) {
|
|
92
|
+
if (this[i] === prop)
|
|
93
|
+
return i;
|
|
94
|
+
}
|
|
95
|
+
return -1;
|
|
96
|
+
};
|
|
97
|
+
var getElementsByClassName = function (className, context) {
|
|
98
|
+
var elems = document.querySelectorAll ? context.querySelectorAll("." + className) : (function () {
|
|
99
|
+
var all = context.getElementsByTagName("*"),
|
|
100
|
+
elements = [],
|
|
101
|
+
i = 0;
|
|
102
|
+
for (; i < all.length; i++) {
|
|
103
|
+
if (all[i].className && (" " + all[i].className + " ").indexOf(" " + className + " ") > -1 && indexOf.call(elements, all[i]) === -1)
|
|
104
|
+
elements.push(all[i]);
|
|
105
|
+
}
|
|
106
|
+
return elements;
|
|
107
|
+
})();
|
|
108
|
+
return elems;
|
|
109
|
+
};
|
|
110
|
+
document.getElementsByClassName = function (className) {
|
|
111
|
+
return getElementsByClassName(className, document);
|
|
112
|
+
};
|
|
113
|
+
Element.prototype.getElementsByClassName = function (className) {
|
|
114
|
+
return getElementsByClassName(className, this);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var lastTime = 0;
|
|
119
|
+
var vendors = ['ms', 'moz', 'webkit', 'o'];
|
|
120
|
+
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
|
121
|
+
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
|
122
|
+
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
|
|
123
|
+
window[vendors[x] + 'CancelRequestAnimationFrame'];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!window.requestAnimationFrame) {
|
|
127
|
+
window.requestAnimationFrame = function (callback, element) {
|
|
128
|
+
var currTime = new Date().getTime();
|
|
129
|
+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
|
130
|
+
var id = window.setTimeout(function () {
|
|
131
|
+
callback(currTime + timeToCall);
|
|
132
|
+
},
|
|
133
|
+
timeToCall);
|
|
134
|
+
lastTime = currTime + timeToCall;
|
|
135
|
+
return id;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!window.cancelAnimationFrame) {
|
|
140
|
+
window.cancelAnimationFrame = function (id) {
|
|
141
|
+
clearTimeout(id);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.style = {
|
|
146
|
+
transform: this.prefixStyle('transform'),
|
|
147
|
+
transitionTimingFunction: this.prefixStyle('transitionTimingFunction'),
|
|
148
|
+
transitionDuration: this.prefixStyle('transitionDuration')
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
},
|
|
152
|
+
log: function(condition) {
|
|
153
|
+
if (condition === true) {
|
|
154
|
+
return console.log;
|
|
155
|
+
} else {
|
|
156
|
+
return function() {};
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
getLocalStorage: function () {
|
|
160
|
+
if (this.localStorage === null) {
|
|
161
|
+
try {
|
|
162
|
+
this.localStorage = window.localStorage; // This will throw an exception in some browsers when cookies/localStorage are explicitly disabled (i.e. Chrome)
|
|
163
|
+
this.localStorage.setItem('TEST', '1');
|
|
164
|
+
this.localStorage.removeItem('TEST');
|
|
165
|
+
} catch (e) {
|
|
166
|
+
this.localStorage = false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return this.localStorage;
|
|
171
|
+
},
|
|
172
|
+
prefixStyle: function (style) {
|
|
173
|
+
var elementStyle = document.createElement('div').style;
|
|
174
|
+
|
|
175
|
+
var vendor = '';
|
|
176
|
+
|
|
177
|
+
var vendors = ['webkitT', 'MozT', 'msT', 'OT', 't'];
|
|
178
|
+
|
|
179
|
+
for (var i = 0; i < vendors.length; i++) {
|
|
180
|
+
var transform = vendors[i] + 'ransform';
|
|
181
|
+
if (transform in elementStyle) {
|
|
182
|
+
vendor = vendors[i].substr(0, vendors[i].length - 1);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
style = vendor === '' ? style : vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
187
|
+
|
|
188
|
+
return style;
|
|
189
|
+
},
|
|
190
|
+
getParameterByName: function (name) {
|
|
191
|
+
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
|
192
|
+
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
|
193
|
+
results = regex.exec(location.search);
|
|
194
|
+
return results === null ? 0 : decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
195
|
+
},
|
|
196
|
+
now: Date.now || function () {
|
|
197
|
+
return new Date().getTime();
|
|
198
|
+
},
|
|
199
|
+
nowInSeconds: function () {
|
|
200
|
+
return Math.floor(this.now() / 1000);
|
|
201
|
+
},
|
|
202
|
+
time: function (s) {
|
|
203
|
+
this.startTimes.push({label: s, time: this.now()});
|
|
204
|
+
},
|
|
205
|
+
timeEnd: function (minTime) {
|
|
206
|
+
minTime = minTime || 0;
|
|
207
|
+
var total = 0, diff;
|
|
208
|
+
var key, out = [];
|
|
209
|
+
browser.time("#end#");
|
|
210
|
+
for (var i = 1; i < this.startTimes.length; i++) {
|
|
211
|
+
|
|
212
|
+
diff = (this.startTimes[i].time - this.startTimes[i - 1].time);
|
|
213
|
+
total += diff;
|
|
214
|
+
|
|
215
|
+
if (diff >= minTime) {
|
|
216
|
+
out.push(this.startTimes[i - 1].label + " = " + diff);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
for (key in this.callCount) {
|
|
221
|
+
out.push("count: " + key + " = " + this.callCount[key]);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
console.log(out);
|
|
225
|
+
|
|
226
|
+
this.startTimes.length = 0;
|
|
227
|
+
this.callCount = {};
|
|
228
|
+
|
|
229
|
+
return out;
|
|
230
|
+
},
|
|
231
|
+
createCookie: function (name, value, days) {
|
|
232
|
+
if (!name) return;
|
|
233
|
+
|
|
234
|
+
var expires;
|
|
235
|
+
|
|
236
|
+
if (days) {
|
|
237
|
+
var date = new Date();
|
|
238
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
239
|
+
expires = "; expires=" + date.toGMTString();
|
|
240
|
+
} else {
|
|
241
|
+
expires = "";
|
|
242
|
+
}
|
|
243
|
+
document.cookie = escape(name) + "=" + escape(value) + expires + "; path=/";
|
|
244
|
+
},
|
|
245
|
+
readCookie: function (name) {
|
|
246
|
+
var nameEQ = escape(name) + "=";
|
|
247
|
+
var ca = document.cookie.split(';');
|
|
248
|
+
for (var i = 0; i < ca.length; i++) {
|
|
249
|
+
var c = ca[i];
|
|
250
|
+
while (c.charAt(0) === ' ')
|
|
251
|
+
c = c.substring(1, c.length);
|
|
252
|
+
if (c.indexOf(nameEQ) === 0)
|
|
253
|
+
return unescape(c.substring(nameEQ.length, c.length));
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
},
|
|
257
|
+
eraseCookie: function (name) {
|
|
258
|
+
browser.createCookie(name, "", -1);
|
|
259
|
+
},
|
|
260
|
+
delay: function (fn, oid, delay) {
|
|
261
|
+
var timeStamp = browser.now() + delay;
|
|
262
|
+
|
|
263
|
+
var nextRun;
|
|
264
|
+
|
|
265
|
+
if (this.delayProcess.id) {
|
|
266
|
+
if (timeStamp >= this.delayProcess.timeStamp) {
|
|
267
|
+
nextRun = { timeStamp: timeStamp, oid: oid, delay: delay };
|
|
268
|
+
} else if (timeStamp < this.delayProcess.timeStamp) {
|
|
269
|
+
nextRun = { timeStamp: this.delayProcess.timeStamp, oid: this.delayProcess.oid, delay: this.delayProcess.delay };
|
|
270
|
+
|
|
271
|
+
clearTimeout(this.delayProcess.id);
|
|
272
|
+
|
|
273
|
+
//console.log("clearing: " + oid + ", " + (this.delayProcess.timeStamp) + " vs " + timeStamp);
|
|
274
|
+
|
|
275
|
+
this.delayProcess.oid = oid;
|
|
276
|
+
this.delayProcess.timeStamp = timeStamp;
|
|
277
|
+
this.delayProcess.delay = delay;
|
|
278
|
+
|
|
279
|
+
this.delayProcess.id = setTimeout(function() {
|
|
280
|
+
fn();
|
|
281
|
+
browser.delayProcess = {};
|
|
282
|
+
}, delay);
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
this.delayProcess.oid = oid;
|
|
286
|
+
this.delayProcess.timeStamp = timeStamp;
|
|
287
|
+
this.delayProcess.delay = delay;
|
|
288
|
+
|
|
289
|
+
this.delayProcess.id = setTimeout(function() {
|
|
290
|
+
fn();
|
|
291
|
+
browser.delayProcess = {};
|
|
292
|
+
}, delay);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return nextRun;
|
|
296
|
+
}
|
|
297
|
+
};
|
package/src/Dim.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function Dim() {
|
|
2
|
+
function my() {}
|
|
3
|
+
|
|
4
|
+
my.screen ={
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0,
|
|
7
|
+
width: 0,
|
|
8
|
+
height: 0
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
my.measureScreen = function() {
|
|
12
|
+
my.screen.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
13
|
+
my.screen.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
14
|
+
|
|
15
|
+
return my;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return my;
|
|
19
|
+
}
|