This commit is contained in:
Tijl 2022-12-15 23:49:01 +01:00
parent a48e1f9b40
commit 9b739ce81f

View File

@ -1,17 +1,17 @@
const searchButton = document.getElementById('searchButton'); const searchButton = document.getElementById('searchButton');
if (searchButton) { if (searchButton) {
searchButton.addEventListener('click', () => { searchButton.addEventListener('click', () => {
searchRedirect('test'); searchRedirect();
}) })
} }
const newButton = document.getElementById('newButton'); const newButton = document.getElementById('newButton');
if (newButton) { if (newButton) {
newButton.addEventListener('click', () => { newButton.addEventListener('click', () => {
newRedirect('test'); newRedirect();
}) })
} }
function searchRedirect(host) { function searchRedirect() {
const request = new XMLHttpRequest(); const request = new XMLHttpRequest();
const url = 'https://url.example.com/rest/v3/short-urls'; const url = 'https://url.example.com/rest/v3/short-urls';
request.open('GET', url); request.open('GET', url);
@ -26,7 +26,7 @@ function searchRedirect(host) {
} }
} }
function newRedirect(host) { function newRedirect() {
chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => { chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => {
let currentUrl = tabs[0].url; let currentUrl = tabs[0].url;
const url = 'https://url.example.com/rest/v3/short-urls'; const url = 'https://url.example.com/rest/v3/short-urls';