diff --git a/index.html b/index.html
index 9bb809c..8f0a151 100644
--- a/index.html
+++ b/index.html
@@ -120,7 +120,7 @@
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/js/main.js b/js/main.js
index 21195a6..b195e27 100644
--- a/js/main.js
+++ b/js/main.js
@@ -119,6 +119,12 @@ qrModal.addEventListener('show.bs.modal', function (event) {
}
})
+// Test link button
+document.getElementById('link-test-btn').addEventListener('click', function () {
+ var currentLink = document.getElementById('link-output').value
+ window.open(currentLink, '_blank')
+})
+
// Email button
document.getElementById('email-btn').addEventListener('click', function () {
var currentLink = document.getElementById('link-output').value
@@ -134,17 +140,29 @@ document.getElementById('sms-btn').addEventListener('click', function () {
})
// Mastodon button
-document.getElementById('mastodon-btn').addEventListener('click', function () {
+document.getElementById('mastodon-share-btn').addEventListener('click', function () {
var currentLink = document.getElementById('link-output').value
var defaultServer = localStorage['mastodon-server'] || 'mastodon.social'
var server = window.prompt('Which Mastodon server do you want to use?', defaultServer)
if (server) {
localStorage['mastodon-server'] = server
var link = 'https://' + server + '/share?text=' + encodeURIComponent('Type something here\n\n' + currentLink)
- popupWindow(link, '_blank', window, 500, 400)
+ window.open(link, '_blank')
}
})
+// Twitter / X button
+document.getElementById('x-share-btn').addEventListener('click', function () {
+ var link = 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(document.getElementById('link-output').value)
+ window.open(link, '_blank')
+})
+
+// Telegram button
+document.getElementById('telegram-share-btn').addEventListener('click', function () {
+ var link = 'https://t.me/share/url?url=' + encodeURIComponent(document.getElementById('link-output').value)
+ window.open(link, '_blank')
+})
+
// Show Shortcut prompt on iOS
if (ifiOS()) {
document.getElementById('apple-shortcut-btn').style.display = 'block'
diff --git a/js/shared.js b/js/shared.js
index d37459d..1c2b718 100644
--- a/js/shared.js
+++ b/js/shared.js
@@ -98,14 +98,6 @@ function addToHistory(link) {
}
}
-// Function for generating popup window
-// Based on: https://stackoverflow.com/a/32261263
-function popupWindow(url, windowName, win, w, h) {
- const y = win.top.outerHeight / 2 + win.top.screenY - (h / 2)
- const x = win.top.outerWidth / 2 + win.top.screenX - (w / 2)
- return win.open(url, windowName, `toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no, width=${w}, height=${h}, top=${y}, left=${x}`)
-}
-
// Save settings automatically to localStorage
document.querySelectorAll('input[type="checkbox"]').forEach(function (el) {
el.addEventListener('change', function () {