-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadix.min.ts
91 lines (65 loc) · 2.43 KB
/
adix.min.ts
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
/*
________
/ ____ \
/ |____| \
/ ____ \
/ / \ \
/____/ \____\
Welcome to
Adix, a UI library for Javascript, writen in typescript.
*/
var Adix = {
One:function(Selector){
document.querySelector(Selector);
},
More:function(Selector){
document.querySelectorAll(Selector);
}
}
var Widgets = { //UI features like modal and tabs
modal:function(code){
var modal = document.createElement("modalwindow");// create element(where the modal lives)
modal.setAttribute("id","modal");// give it a id attridute
modal.innerHTML = code; //put the window in the element
document.body.appendChild(modal);// make it a child of the body tag
function Delete(){ //funition to remove the modal.
var bodyclass = document.body;
Animate.hide(modal);
}
modal.addEventListener('click',Delete);//listen for a click to close the window.
},
accordion:function(ele){
Animate.hide(document.getElementsByClassName('accordion-panel'));
ele.addEventListener('click','.accordion-btn',function(e){
e.preventDefault();
Animate.toggle(document.getElementsByClassName('accordion-panel'));
});
},
tabs:function(ele){
ele.addEventListener('click',document.getElementsByClassName('tabs-btn'),function(e){
e.preventDefault();
Animate.toggle(document.getElementsByClassName('tabs-panel'));
});
}
}
var Animate ={ // animate elements
shown:false,
hide: function(ele){ // hide
document.body.removeChild(ele);
Animate.shown = false;
},
show: function(ele){ //show
document.body.appendChild(ele);
Animate.shown = true;
},
toggle: function(ele){ //toggle, means if hiden show or if shown hide.
if(Animate.shown =false ) {
document.body.appendChild(ele);
Animate.shown = true;
}
else{
document.body.removeChild(ele);
Animate.shown = false;
}
}//end of Animate
}