Skip to content

Commit f07d078

Browse files
authored
Add files via upload
1 parent d93a1c4 commit f07d078

3 files changed

Lines changed: 185 additions & 0 deletions

File tree

Go-Back-No-Popup.txt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// ==UserScript==
2+
// @name URL Change Alert
3+
// @namespace https://github.com/NullPounce
4+
// @version 1.0
5+
// @description goes back one page without notice if the user changes urls twice witin 10 seconds.
6+
// @author Your Name
7+
// @match *://*/*
8+
// @grant none
9+
// ==/UserScript==
10+
let urlChanges = 0;
11+
let lastUrl = window.location.href;
12+
let timerId;
13+
14+
setInterval(function() {
15+
if (window.location.href !== lastUrl) {
16+
urlChanges++;
17+
lastUrl = window.location.href;
18+
if (urlChanges >= 2) {
19+
let popup = document.createElement('div');
20+
popup.textContent = 'You have changed URLs 2 times within 10 seconds. You will be redirected to the previous page in 3 seconds...';
21+
popup.style.position = 'fixed';
22+
popup.style.bottom = '50px';
23+
popup.style.left = '50%';
24+
popup.style.transform = 'translate(-50%, 0)';
25+
popup.style.backgroundColor = 'white';
26+
popup.style.padding = '10px';
27+
document.body.appendChild(popup);
28+
29+
let closePopup = function() {
30+
popup.parentNode.removeChild(popup);
31+
clearInterval(timerId);
32+
};
33+
34+
timerId = setInterval(function() {
35+
closePopup();
36+
history.back();
37+
urlChanges = 0;
38+
}, 3000);
39+
40+
popup.addEventListener('click', function() {
41+
closePopup();
42+
history.back();
43+
urlChanges = 0;
44+
});
45+
}
46+
} else {
47+
urlChanges = 0;
48+
if (!timerId) {
49+
timerId = setTimeout(function() {
50+
urlChanges = 0;
51+
timerId = null;
52+
}, 10000);
53+
}
54+
}
55+
}, 5000);
56+
57+
58+

Go-Back-URL-Alert-Counter.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ==UserScript==
2+
// @name URL Change Alert
3+
// @namespace https://github.com/NullPounce
4+
// @version 1.0
5+
// @description Alerts the user if they change URLs 2 times within ten seconds then goes back a page. If there have been 5 popups, a non-closeable popup is displayed for 15 seconds.
6+
// @author NullPounce
7+
// @match *://*/*
8+
// @grant none
9+
// ==/UserScript==
10+
11+
let popupCounter = 0;
12+
let urlChanges = 0;
13+
let lastUrl = window.location.href;
14+
let timerId;
15+
let uncloseablePopup = null;
16+
17+
setInterval(function() {
18+
if (window.location.href !== lastUrl) {
19+
urlChanges++;
20+
lastUrl = window.location.href;
21+
if (urlChanges >= 2) {
22+
popupCounter++; // Increment the counter for each popup displayed
23+
console.log('Popup displayed ' + popupCounter + ' times.');
24+
if (popupCounter >= 5) {
25+
if (!uncloseablePopup) {
26+
uncloseablePopup = document.createElement('div');
27+
uncloseablePopup.style.cssText = `
28+
position: fixed;
29+
top: 0;
30+
left: 0;
31+
width: 100%;
32+
height: 100%;
33+
background: white;
34+
z-index: 9999;
35+
display: flex;
36+
align-items: center;
37+
justify-content: center;
38+
`;
39+
const message = document.createElement('p');
40+
message.textContent = '⌚️Time-Out: You are lucky to be doing school at Home on a computer💻. Wait longer before changing pages.';
41+
message.style.cssText = `
42+
font-size: 24px;
43+
text-align: center;
44+
margin: 20px;
45+
`;
46+
uncloseablePopup.appendChild(message);
47+
document.body.appendChild(uncloseablePopup);
48+
setTimeout(() => {
49+
document.body.removeChild(uncloseablePopup);
50+
uncloseablePopup = null;
51+
popupCounter = 0;
52+
}, 15000);
53+
}
54+
} else {
55+
let result = confirm('🤖 You are changing pages too fast. Please slow down and focus 🧠💪');
56+
if (result) {
57+
history.back();
58+
} else {
59+
history.back();
60+
}
61+
urlChanges = 0;
62+
}
63+
}
64+
} else {
65+
urlChanges = 0;
66+
if (!timerId) {
67+
timerId = setTimeout(function() {
68+
urlChanges = 0;
69+
timerId = null;
70+
}, 10000);
71+
}
72+
}
73+
}, 5000);

URL-Changer-Alert-Counter.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// ==UserScript==
2+
// @name URL Change Alert
3+
// @namespace https://github.com/NullPounce
4+
// @version 1.0
5+
// @description Alerts the user if they change URLs 2 times within ten seconds. If there have been 5 popups, a non-closeable popup is displayed for 15 seconds.
6+
// @author NullPounce
7+
// @match *://*/*
8+
// @grant none
9+
// ==/UserScript==
10+
let popupCounter = 0;
11+
let uncloseablePopup;
12+
let urlChanges = 0;
13+
let lastUrl = window.location.href;
14+
15+
setInterval(function() {
16+
if (window.location.href !== lastUrl) {
17+
urlChanges++;
18+
lastUrl = window.location.href;
19+
if (urlChanges >= 2) {
20+
popupCounter++;
21+
if (popupCounter === 5) {
22+
if (!uncloseablePopup) {
23+
uncloseablePopup = document.createElement('div');
24+
uncloseablePopup.textContent = '⌚️Time-Out: You are lucky to be doing school at Home on a computer💻. Wait longer before changing pages.';
25+
uncloseablePopup.style.position = 'fixed';
26+
uncloseablePopup.style.top = '0';
27+
uncloseablePopup.style.left = '0';
28+
uncloseablePopup.style.width = '100%';
29+
uncloseablePopup.style.height = '100%';
30+
uncloseablePopup.style.display = 'flex';
31+
uncloseablePopup.style.justifyContent = 'center';
32+
uncloseablePopup.style.alignItems = 'center';
33+
uncloseablePopup.style.backgroundColor = '#ffffff';
34+
uncloseablePopup.style.zIndex = 999999;
35+
document.body.appendChild(uncloseablePopup);
36+
setTimeout(() => {
37+
document.body.removeChild(uncloseablePopup);
38+
uncloseablePopup = null;
39+
popupCounter = 0;
40+
}, 15000);
41+
}
42+
} else {
43+
let result = confirm('🤖 You are changing pages too fast. Please slow down and focus 🧠💪');
44+
console.log('Popup displayed ' + popupCounter + ' times.');
45+
if (!result) {
46+
urlChanges = 0;
47+
}
48+
}
49+
urlChanges = 0;
50+
}
51+
} else {
52+
urlChanges = 0;
53+
}
54+
}, 5000);

0 commit comments

Comments
 (0)