feat: update copyLink function to directly copy link

This commit is contained in:
Viren070
2024-07-30 18:21:23 +01:00
parent e9231aa544
commit d2c7d41455
2 changed files with 22 additions and 12 deletions
+9 -4
View File
@@ -102,10 +102,15 @@
});
})
function copyLink(event, link) {
let copyLinkMsg = 'Copy Share Link to Clipboard: Ctrl+C, Enter\nPaste in the Search of the Stremio App'
if (window.isMobile)
copyLinkMsg = 'Copy Share Link to Clipboard: Long Press Text, Select Copy\nPaste in the Search of the Stremio App'
window.prompt(copyLinkMsg, link)
let copyLinkMsg = 'The link was copied to your clipboard\nPress Ctrl + V in the search bar of the Stremio app and press Enter'
if (window.isMobile)
copyLinkMsg = 'The link was copied to your clipboard\nPress and hold in the search bar of the Stremio app and select Paste'
navigator.clipboard.writeText(link).then(function() {
console.log('Link copied to clipboard');
}, function(err) {
console.error('Could not copy text: ', err);
});
window.alert(copyLinkMsg)
}
</script>
</body>
+13 -8
View File
@@ -117,14 +117,19 @@
loadIsotope()
})
function copyLink(event, link) {
console.log('link', link)
console.log('event', event)
let copyLinkMsg = 'Copy Share Link to Clipboard: Ctrl+C, Enter\nPaste in the Search of the Stremio App'
if (window.isMobile)
copyLinkMsg = 'Copy Share Link to Clipboard: Long Press Text, Select Copy\nPaste in the Search of the Stremio App'
window.prompt(copyLinkMsg, link)
event.preventDefault()
return false
console.log('link', link)
console.log('event', event)
let copyLinkMsg = 'The link was copied to your clipboard\nPress Ctrl + V in the search bar of the Stremio app and press Enter'
if (window.isMobile)
copyLinkMsg = 'The link was copied to your clipboard\nPress and hold in the search bar of the Stremio app and select Paste'
navigator.clipboard.writeText(link).then(function() {
console.log('Link copied to clipboard');
}, function(err) {
console.error('Could not copy text: ', err);
});
window.alert(copyLinkMsg)
event.preventDefault()
return false
}
</script>
</body>