-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
128 lines (116 loc) · 5.22 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bing search</title>
<style>
div {
display: flexbox;
}
</style>
</head>
<body>
<script>
function surf() {
var search = document.getElementById("search").value
var times = document.getElementById("number").value
var Timeout = document.getElementById("Timeout").value
var closingLatency = document.getElementById("closingLatency").value
const space = "+";
function openAndCloseWindow(i) {
var newWindow = window.open("https://www.bing.com/search?q=" + search + space.repeat(i));
setTimeout(function () {
newWindow.close();
}, closingLatency);
}
for (let i = 1; i <= times; i++) {
setTimeout(function () {
openAndCloseWindow(i);
}, i * Timeout);
}
}
document.addEventListener("DOMContentLoaded", function () {
if (typeof Storage !== "undefined") {
console.log("new");
if (!localStorage.getItem("Autorun")) {
localStorage.setItem("Autorun", "false");
localStorage.setItem("search", document.getElementById("search").value);
localStorage.setItem("number", document.getElementById("number").value.toString());
localStorage.setItem("Timeout", document.getElementById("Timeout").value.toString());
localStorage.setItem("closingLatency", document.getElementById("closingLatency").value.toString());
console.log("values stored");
} else {
document.getElementById("search").value = localStorage.getItem("search");
document.getElementById("number").value = parseInt(localStorage.getItem("number"));
document.getElementById("Timeout").value = parseInt(localStorage.getItem("Timeout"));
document.getElementById("closingLatency").value = parseInt(localStorage.getItem("closingLatency"));
console.log("retrieved values");
if (localStorage.getItem("Autorun") === "true") {
document.getElementById("AutoRun").checked = true;
console.log("surf activated");
surf();
}
}
} else {
console.log("block");
document.getElementById("AutoRun").style.display = "none";
document.getElementById("save").style.display = "none";
document.getElementById("AutoRun").disabled = true;
document.getElementById("save").disabled = true;
alert("Autorun feature is not available in this browser");
}
})
function switchCheck() {
console.log("activated");
if (localStorage.getItem("Autorun") === "true") {
localStorage.setItem("Autorun", "false");
} else {
localStorage.setItem("Autorun", "true");
console.log("set true");
}
}
function save() {
console.log("saving");
localStorage.setItem("search", document.getElementById("search").value);
localStorage.setItem("number", document.getElementById("number").value.toString());
localStorage.setItem("Timeout", document.getElementById("Timeout").value.toString());
localStorage.setItem("closingLatency", document.getElementById("closingLatency").value.toString());
}
</script>
<div>
<input type="text" id="search" value="search">
<input type="number" id="number" value="34">
<input type="range" id="Timeout" name="Timeout" min="0" max="1000" step="25" value="200">
<input type="range" id=closingLatency name="closingLatency" min="500" max="5000" step="100" value="1500">
<button onclick="surf()"> start search</button>
<p><input type="checkbox" name="AutoRun" id="AutoRun" onclick="switchCheck()"> AutoRun </p>
<button id="save" onclick="save()"> save</button>
</div>
</body>
</html>
<!-- function openAndCloseWindow(i) {
var newWindow = window.open("https://www.bing.com/search?q=" + search + space.repeat(i));
setTimeout(function() {
newWindow.close();
}, 2000); // Close the window after 2000 milliseconds (2 seconds)
}
for (let i = 1; i <= times; i++) {
setTimeout(function() {
openAndCloseWindow(i);
}, i * 100); // Delay opening the window by i * 100 milliseconds
} -->
<!-- function surf() {
var search = document.getElementById("search").value
var times = document.getElementById("number").value
const space = "+";
function openWindowWithDelay(i) {
setTimeout(function () {
window.open("https://www.bing.com/search?q=" + search + space.repeat(i));
}, i * 600);
}
for (let i = 1; i <= times; i++) {
openWindowWithDelay(i);
}
} -->