This repository has been archived on 2023-02-22. You can view files and clone it, but cannot push or open issues or pull requests.
redirect-extention-chrome/popup.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-12-25 14:25:24 +01:00
const searchButton = document.getElementById('searchButton');
2022-12-24 01:38:21 +01:00
var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}`;
2022-12-25 17:58:17 +01:00
document.getElementById('title').innerHTML = config.customName
2022-12-24 01:38:21 +01:00
if (searchButton) {
searchButton.addEventListener('click', () => {
searchRedirect();
});
}
const newButton = document.getElementById('newButton');
if (newButton) {
newButton.addEventListener('click', () => {
newRedirect();
});
}
const copyShortUrlBtn = document.getElementById('copyShortUrl-btn');
if (copyShortUrlBtn) {
copyShortUrlBtn.addEventListener('click', () => {
copyShortUrl();
});
}
const openShlinkAppBtn = document.getElementById('openShlinkApp-btn');
if (openShlinkAppBtn) {
2022-12-25 14:25:24 +01:00
openShlinkAppBtn.addEventListener('click', () => {
2022-12-24 01:38:21 +01:00
chrome.tabs.create({url:shlinkAppBtnRdUrl});
});
}
function copyShortUrl () {
var shortUrlOut = document.getElementById("output-shortUrl");
shortUrlOut.select();
shortUrlOut.setSelectionRange(0, 99999);
navigator.clipboard.writeText(shortUrlOut.value);
}