-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin11.js
105 lines (89 loc) · 2.81 KB
/
win11.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
function createAlert(modal, titleStr, messageStr){
var modalBackground = document.createElement("div");
modalBackground.classList.add("popover-modal-background");
modalBackground.setAttribute("data-theme", "dark");
modalBackground.style.opacity = "0";
var popover = document.createElement("div");
popover.classList.add("popover");
popover.classList.add("alert");
popover.classList.add("popover-hidden");
popover.style.display = "none";
var title = document.createElement("div");
title.classList.add("title");
var button = document.createElement("div");
button.classList.add("button");
button._popover = popover;
button.onclick = function(){
var popover = this._popover;
popover.classList.add("popover-hidden");
modalBackground.style.opacity = "0";
setTimeout(function(){
popover.remove();
modalBackground.remove();
}, 500);
};
var img = document.createElement("img");
img.src="icons/arrow-back.svg";
img.classList.add("glyph");
button.appendChild(img);
title.appendChild(button);
var span = document.createElement("span");
span.innerHTML = titleStr;
title.appendChild(span);
popover.appendChild(title);
var body = document.createElement("div");
body.classList.add("body");
body.innerHTML = messageStr;
popover.appendChild(body);
document.getElementById("rootcontainer").appendChild(modalBackground);
document.getElementById("rootcontainer").appendChild(popover);
popover.style.display = "";
setTimeout(function(){
popover.classList.remove("popover-hidden");
modalBackground.style.opacity = "0.75";
}, 50);
}
$(document).ready(function(){
$(".main-panel").click(function() {
var displaying = this.classList.contains("main-panel-opened");
var parent = this.parentElement;
var childAnchors = parent.getElementsByClassName("dropdown-children");
if (childAnchors.length == 0){
return;
}
for (var j = 0; j < childAnchors.length; j++){
var childAnchor = childAnchors[j];
if (displaying)
childAnchor.style.display = "none";
else
childAnchor.style.display = "";
childAnchor.classList.remove("animate-height");
childAnchor.style.height = "";
if (!displaying){
var realHeight = childAnchor.offsetHeight;
childAnchor.style.height = "0px";
setTimeout(function(){
childAnchor.classList.add("animate-height");
childAnchor.style.height = realHeight + "px";
setTimeout(function(){
childAnchor.classList.remove("animate-height");
childAnchor.style.height = "";
}, 500);
}, 10);
}
}
if (displaying)
this.classList.remove("main-panel-opened");
else
this.classList.add("main-panel-opened");
});
$(".main-panel").keypress(function(e) {
var key = e.which;
if(key == 13) // the enter key code
{
$(this).click();
return false;
}
});
$(".dropdown-children").css("display", "none");
});