-
Notifications
You must be signed in to change notification settings - Fork 2
/
baseFunctions.js
133 lines (117 loc) · 4.75 KB
/
baseFunctions.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
let lastZIndexAppBOx = undefined;
setInterval(function(){
let date = new Date();
let hrs = date.getHours();
let min = date.getMinutes();
let day = date.getDay() % 7;
let sec = date.getSeconds();
let daysArray = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
let amOrPm = (hrs<12) ? 'AM':'PM';
for(let i=0;i<daysArray.length;i++){
if(day==i){
day=daysArray[i];
}
}
let homePageTitleDateTime = document.querySelector('.homePageTitleDateTime');
homePageTitleDateTime.innerText = `${day} ${hrs}:${min} ${amOrPm}`;
},1000);
function dockIconDblClick(currDockIcon,appName){
currDockIcon.addEventListener("dblclick",function(e){
toRemoveLaunchPad();
let appBox=`.box-box[appbox="${appName}"]`
let boxBox = document.querySelector(appBox);
let attributeCheck = boxBox.getAttribute("style")
currDockIcon.removeAttribute('style');
if(attributeCheck){
if(attributeCheck=="display: none;" || attributeCheck=="z-index: 80; display: none;" || attributeCheck=="display: none; z-index: 80;"){
currDockIcon.style.animation="box 1s normal";
boxBox.style.display ="block";
return;
}
}
boxBox.classList.add("box-exit-ani");
setTimeout(()=>{
boxBox.classList.remove("box-exit-ani");
boxBox.style.display ="none";
},500);
});
}
function toRemoveLaunchPad(){
let launchPad = document.querySelector(`.dockIcon[dockapp="Launch"]`);
let lp = document.querySelector(".launchPad-container");
let divDot = launchPad.querySelector('.active-dot[appbox-dot="Launch-dot"]');
if(divDot){
lp.classList.add("lp-exit-ani");
setTimeout(()=>{
lp.parentNode.removeChild(lp);
},500);
divDot.parentNode.removeChild(divDot);
}
}
function cancelCircle(currDockIcon,appBox){
let cancelCircleBox= document.querySelector(appBox);
let cancelCircle = cancelCircleBox.querySelector('.mac-dialogBox-title-icon1');
let checkBox = document.querySelector(appBox);
let checkBoxDot = checkBox.getAttribute('appbox')
cancelCircle.addEventListener("click",function(){
if(erase){
erase=false;
}
if(isDrawing){
isDrawing=false;
}
if(color){
color="black";
}
let boxBox = document.querySelector(appBox);
boxBox.removeAttribute('style');
boxBox.classList.add("box-exit-ani");
setTimeout(()=>{
boxBox.classList.remove("box-exit-ani");
boxBox.style.display ="none";
boxBox.parentNode.removeChild(boxBox);
currDockIcon.removeAttribute('style')
let divDot = document.querySelector(`.active-dot[appbox-dot="${checkBoxDot}-dot"]`)
divDot.parentNode.removeChild(divDot);
return;
},220);
});
}
function fullScreenCircle(appBox){
let fullScreenCircleBox= document.querySelector(appBox);
let fullScreenCircle = fullScreenCircleBox.querySelector('.mac-dialogBox-title-icon2');
fullScreenCircle.addEventListener("click",function(){
let boxBox = document.querySelector(appBox);
console.log(appBox);
if(document.querySelector(appBox).getAttribute('style') && document.querySelector(appBox).getAttribute('style').includes("position: fixed;")){
// console.log(document.querySelector(appBox).getAttribute('style').includes("position: fixed;"));
console.log(document.querySelector(appBox).getAttribute('style'));
let boxContainer = document.querySelector('.box-container');
boxBox.style="";
boxBox.style.zIndex = "80";
boxContainer.removeAttribute("style");
return;
}
let boxContainer = document.querySelector('.box-container');
boxBox.style.position ="fixed";
boxBox.style.top ="0px";
boxBox.style.height ="100vh";
boxBox.style.width ="100vw";
boxBox.style.zIndex= '101';
});
}
function minimize(appBox){
let minimizeBox= document.querySelector(appBox);
let minimize = minimizeBox.querySelector('.mac-dialogBox-title-icon3');
minimize.addEventListener("click",function(){
let boxBox = document.querySelector(appBox);
boxBox.removeAttribute('style');
boxBox.classList.add("box-exit-ani");
setTimeout(()=>{
boxBox.classList.remove("box-exit-ani");
boxBox.style.display ="none";
},1000);
let boxContainer = document.querySelector('.box-container');
boxContainer.removeAttribute('style')
})
}