36 lines
989 B
JavaScript
36 lines
989 B
JavaScript
|
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);
|
||
|
}
|