-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirector-.js
48 lines (44 loc) · 868 Bytes
/
director-.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
(function(w){
var $d = {
ht : new HashTable(),
global : new HashTable(),
add : function(key, open, close){
this.ht.add(key, {
open : open, close : close
})
},
$ : function(key, name){
if(this.ht.has(key) && typeof this.ht.get(key)[name] === 'function'){
this.ht.get(key)[name](this.global);
return true;
}
return false;
},
regdoc : function(doc){
if(!this.docs) this.docs = [];
this.docs.push(doc);
return doc;
},
flush : function(){
if(!this.docs) return;
for(var i = 0, len = this.docs.length; i < len; i++){
this.docs[i].clear();
this.docs[i].draw();
}
},
open : function(key){
this.flush();
if(this.$(key, 'open')){
this.pagename = key;
} else {
delete this.pagename;
}
},
close : function(key){
this.flush();
var b = this.$(key, 'close');
return b;
}
}
w.director = w.gd = $d;
})(window)