From 764134e8306d7e441aee372801e719bb5e8bcd9f Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Mon, 27 Nov 2023 22:22:41 +0530 Subject: [PATCH] (feat): implemented page linkInput copy to clipboard feature --- htdocs/assets/_floatingbar.php | 2 +- htdocs/assets/js/floatingbar-config.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/assets/_floatingbar.php b/htdocs/assets/_floatingbar.php index 10b5386..eb36c49 100644 --- a/htdocs/assets/_floatingbar.php +++ b/htdocs/assets/_floatingbar.php @@ -114,7 +114,7 @@

  Sharing Options

- +

SHARE ON

diff --git a/htdocs/assets/js/floatingbar-config.js b/htdocs/assets/js/floatingbar-config.js index 6590fa0..53b1d95 100644 --- a/htdocs/assets/js/floatingbar-config.js +++ b/htdocs/assets/js/floatingbar-config.js @@ -353,4 +353,17 @@ function call_webshare_api() { window.alert("Sorry, webShareAPI is not supported by your browser"); } } +} + +function copy_to_clipboard(textContent, copyContext) { + if(navigator.clipboard) { + navigator.clipboard.writeText(textContent).then(function() { + window.alert(copyContext + "Copied to Clipboard"); + }, function() { + window.alert("Failed to Copy the" + copyContext + "!"); + }) + } + else { + window.alert("Sorry, webClipboardAPI is not supported by your browser"); + } } \ No newline at end of file