Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
hcr5 authored Feb 17, 2024
1 parent 020531a commit dffda93
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scratch Followers</title>
<style>
#result {
display: none;
margin-top: 20px;
}
</style>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>

<input type="text" id="username" placeholder="Enter Username">
<button onclick="loadFollowers()">Load Followers</button>
<button onclick="stopLoading()">Stop</button>
<div id="result"></div>

<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script>
var loading = false;

function loadFollowers() {
if (loading) return; // Prevent multiple requests
loading = true;

var username = document.getElementById("username").value;
var page = 1;

$('#result').empty(); // Clear previous results

function load() {
$.get("https://scratch.mit.edu/users/" + username + "/followers/?page=" + page, loaded);
}
Expand All @@ -46,22 +30,11 @@
}

page++;
if ($users.length > 0) {
// Load next page
load();
} else {
// Show the result container when all followers are loaded
$('#result').show();
loading = false;
}
$.get("https://scratch.mit.edu/users/" + username + "/followers/?page=" + page, loaded);
}

load();
}

function stopLoading() {
loading = false;
}
</script>

</body>
Expand Down

0 comments on commit dffda93

Please sign in to comment.