-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
35 lines (29 loc) · 1.3 KB
/
content.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
chrome.storage.local.get(["username", "password"], function(data) {
if (data && data.username && data.password) {
// Listen for changes in the URL
const checkUrl = setInterval(function() {
// Check if the URL contains the expected part of the URL
if (window.location.href.includes("192.168.55.253:1003/keepalive")) {
// Stop checking the URL
clearInterval(checkUrl);
const currentUrl = window.location.href;
// Save the current URL to local storage
chrome.storage.local.set({ "submittedUrl": currentUrl });
//show the saved url in the log
console.log("The submitted URL is: " + currentUrl);
// Display popup message
//window.alert("Thanks for signing in using our CRISPR.");
setTimeout(function() {
// Redirect to the server URL
window.location.href = "http://192.168.77.84";
}, 1000); // Adjust the delay time as needed
}
}, 100); // Check the URL every 100 milliseconds
// Fill the form with saved username and password
document.getElementById("ft_un").value = data.username;
document.getElementById("ft_pd").value = data.password;
// Get the current URL before submitting the form
// Submit the form programmatically
document.querySelector("form").submit();
}
});