diff options
| author | 2021-01-03 12:20:15 -0500 | |
|---|---|---|
| committer | 2021-01-03 18:20:15 +0100 | |
| commit | 46c8f6e77b74c97993414af1c3a3a8a047414baf (patch) | |
| tree | eb1327838aee14be4b0ecae8be2670d69ee4f2e1 /p/scripts | |
| parent | 0567e3894745f541cef2acd7a85486c0f2e40656 (diff) | |
Add clipboard sharing (#3330)
When the discussion #3327 started, I thought that the clipboard share
is a good idea. It never occurred to me because I do not use a
smartphone.
It might need some polishing but it seems pretty usable as-is.
See #3327
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 1a3b02c2a..f8d20a622 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -946,7 +946,7 @@ function init_stream(stream) { return true; } - el = ev.target.closest('.item.share > a[href="#"]'); + el = ev.target.closest('.item.share > a[data-type="print"]'); if (el) { //Print const tmp_window = window.open(); for (var i = 0; i < document.styleSheets.length; i++) { @@ -960,6 +960,12 @@ function init_stream(stream) { return false; } + el = ev.target.closest('.item.share > a[data-type="clipboard"]'); + if (el && navigator.clipboard) { //Clipboard + navigator.clipboard.writeText(el.href); + return false; + } + el = ev.target.closest('.item.share > a[href="POST"]'); if (el) { //Share by POST const f = el.parentElement.querySelector('form'); |
