Pure JS now has its button disabled during search

This commit is contained in:
Taevas 2021-03-06 17:12:51 +01:00
parent 47df44ca38
commit 41adf539c9
2 changed files with 6 additions and 5 deletions

View file

@ -10,14 +10,14 @@
<div id="rest">
<h1>WEBSITE-FINDER</h1>
<form>
<input type="button" onclick="findWebsites()" value="Find websites!">
<input type="button" id="btn" onclick="findWebsites()" value="Find websites!">
<label>Number of URLs to check:</label>
<input type="number" id="times" value="3000">
<label>Domains to check (separated with commas):</label>
<input type="text" id="domains" value=".co, .com, .net, .edu, .gov, .cn, .org, .cc, .us, .mil, .ac, .it, .de">
<label>Chances out of 100 for a URL to have two domains:</label>
<input type="number" id="second" value="1">
<label>Application protocols (separated with commas):</label>
<label>Application protocols (separated with ", "):</label>
Please note that http requests (not https) will not work if the file is not run locally, <b>putting http in that field is useless if you're using GitHub Pages</b>
<input type="text" id="mode" value="https">
<label>Minimum URL length (excluding domain and protocol):</label>

View file

@ -5,6 +5,7 @@ function findWebsites() {
count.innerHTML = `COUNT: ${i+1}/${times}`
const url = await url_generator()
url_show.innerHTML = `CHECKING: ${url}`
try {
const response = await fetch(url, {mode: "no-cors"})
let li = document.createElement("LI")
@ -14,13 +15,12 @@ function findWebsites() {
li.appendChild(a)
list.appendChild(li)
}
catch (e) {
let a = 0
}
catch (e) {} // No server for this URL
}
console.log('\nFinished at ' + String(new Date().getHours()) + 'h' + String(new Date().getMinutes()) + 'm')
status.innerHTML = "STATUS: STOPPED"
document.getElementById("btn").disabled = false
}
function url_generator() {
@ -55,6 +55,7 @@ function findWebsites() {
status.innerHTML = "STATUS: ACTIVE"
document.getElementById("btn").disabled = true
main_loop()