-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
30 lines (28 loc) · 1.03 KB
/
background.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
document.getElementById("bypassButton").addEventListener("click", bypass);
window.onload = function () {
let queryInfo = {
active: true,
currentWindow: true,
};
chrome.tabs.query(queryInfo, function (tabs) {
document.getElementById("url").value = tabs[0].url;
});
};
async function bypass() {
const baseLink = "https://bypass.pm/bypass2?url=";
const bypassLink = document.getElementById("url").value;
if (!bypassLink)
return (document.getElementById("result").innerHTML =
"no url provided");
await fetch(baseLink + bypassLink)
.then((response) => response.json())
.then((data) => {
if (data.success) {
document.getElementById(
"result"
).innerHTML = `<h3>Result:</h3><h4><a href="${data.destination}" target="_blank">${data.destination}</a></h4>`;
} else {
document.getElementById("result").innerHTML = data.msg;
}
});
}