39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
const searchButton = document.getElementById('searchButton');
|
|
|
|
var shlinkAppBtnRdUrl = `${config.shlinkAppUrl}`;
|
|
|
|
document.getElementById('title').innerHTML = config.customName;
|
|
|
|
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) {
|
|
openShlinkAppBtn.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);
|
|
} |