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

36 lines
989 B
JavaScript
Raw Normal View History

2022-12-24 01:38:21 +01:00
var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}`;
const searchButton = document.getElementById('searchButton');
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) {
copyShortUrlBtn.addEventListener('click', () => {
chrome.tabs.create({url:shlinkAppBtnRdUrl});
});
}
function copyShortUrl () {
var shortUrlOut = document.getElementById("output-shortUrl");
shortUrlOut.select();
shortUrlOut.setSelectionRange(0, 99999);
navigator.clipboard.writeText(shortUrlOut.value);
}