-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
133 lines (86 loc) · 2.27 KB
/
Copy pathapp.js
File metadata and controls
133 lines (86 loc) · 2.27 KB
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
document.addEventListener("DOMContentLoaded",()=>{
const loader=document.createElement("div");
loader.id="app-loader";
loader.style.cssText=`
position:fixed;
inset:0;
background:#020617;
display:flex;
align-items:center;
justify-content:center;
flex-direction:column;
z-index:999999;
transition:.5s;
`;
loader.innerHTML=`
<div style="width:90px;height:90px;border-radius:50%;border:5px solid rgba(255,255,255,.15);border-top:5px solid #38bdf8;animation:spin 1s linear infinite"></div>
<h2 style="margin-top:25px;color:#fff;font-family:Segoe UI;">Python Learning</h2>
<p style="color:#94a3b8;">Loading Application...</p>
`;
document.body.appendChild(loader);
const style=document.createElement("style");
style.innerHTML=`
@keyframes spin{
0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}
}
.toast{
position:fixed;
left:50%;
bottom:20px;
transform:translateX(-50%);
background:#0f172a;
color:#fff;
padding:14px 20px;
border-radius:12px;
border:1px solid #334155;
box-shadow:0 10px 30px rgba(0,0,0,.4);
z-index:999999;
font-family:Segoe UI;
animation:fade .35s;
}
@keyframes fade{
from{opacity:0;transform:translate(-50%,20px);}
to{opacity:1;transform:translate(-50%,0);}
}
`;
document.head.appendChild(style);
window.addEventListener("load",()=>{
setTimeout(()=>{
loader.style.opacity="0";
setTimeout(()=>loader.remove(),500);
},1200);
});
function toast(message){
const t=document.createElement("div");
t.className="toast";
t.innerHTML=message;
document.body.appendChild(t);
setTimeout(()=>{
t.remove();
},3000);
}
window.addEventListener("online",()=>{
toast("✅ Internet Connected");
});
window.addEventListener("offline",()=>{
toast("⚠️ You are Offline");
});
if(!localStorage.getItem("python_learning_first_open")){
localStorage.setItem("python_learning_first_open","true");
setTimeout(()=>{
toast("👋 Welcome to Python Learning");
},1800);
}
console.log("Python Learning");
console.log("Version : 1.0.0");
console.log("Developed by Lalan Kumar");
document.addEventListener("keydown",e=>{
if(e.key==="F12")e.preventDefault();
if(e.ctrlKey&&e.shiftKey&&["I","J","C"].includes(e.key.toUpperCase()))e.preventDefault();
if(e.ctrlKey&&e.key.toUpperCase()==="U")e.preventDefault();
});
document.addEventListener("contextmenu",e=>{
e.preventDefault();
});
});