forked from Hamidcc/de
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkey.js
35 lines (32 loc) · 1.01 KB
/
key.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
const allowedUrls = [
// Secure URLs without authuser parameter
"https://mail.google.com/",
"https://translate.google.com/",
"https://www.google.com/",
"https://drive.google.com/",
"https://www.classlink.com/",
"https://classroom.google.com/",
"https://www.khanacademy.org/",
"https://kahoot.com/",
"https://docs.google.com/presentation/create",
"https://docs.google.com/spreadsheets/create",
// Add more URLs to your list...
];
// Validate URL before opening
function isValidUrl(url) {
// Implement your URL validation logic here
// You can check for whitelisted domains, specific patterns, etc.
return true; // Replace with your actual validation logic
}
function getRandomPageIndex() {
return Math.floor(Math.random() * allowedUrls.length);
}
function openRandomStudyResource() {
const randomPageIndex = getRandomPageIndex();
const url = allowedUrls[randomPageIndex];
if (isValidUrl(url)) {
window.open(url, "_blank");
} else {
console.warn("Invalid URL detected. Skipping...");
}
}