diff options
| author | Paul Braeuning <paul@paulgo.io> | 2023-11-11 16:19:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-11 16:19:58 +0100 |
| commit | 7b1951aa97f05bf679d36574a16c8a85995cc9c1 (patch) | |
| tree | c275777cd83c575944e7158b9cefbd572cc48352 /searx/static/themes/simple/src/js | |
| parent | 96ccec1aa6507ef4d3dc05a08e01187f80080972 (diff) | |
| parent | 727de1c4efc17a91ce3837f827ee7a779a12ed6a (diff) | |
Merge pull request #2835 from BernieHuang2008/auto-copy
[feature] added a "copy" button in `search url` sidebar.
Diffstat (limited to 'searx/static/themes/simple/src/js')
| -rw-r--r-- | searx/static/themes/simple/src/js/main/results.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/static/themes/simple/src/js/main/results.js b/searx/static/themes/simple/src/js/main/results.js index 4eae58435..2309297df 100644 --- a/searx/static/themes/simple/src/js/main/results.js +++ b/searx/static/themes/simple/src/js/main/results.js @@ -16,6 +16,8 @@ } )); + d.querySelector('#search_url button#copy_url').style.display = "block"; + searxng.on('.btn-collapse', 'click', function () { var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed'); var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed'); @@ -41,6 +43,12 @@ } }); + searxng.on('#copy_url', 'click', function () { + var target = this.parentElement.querySelector('pre'); + navigator.clipboard.writeText(target.innerText); + this.innerText = this.dataset.copiedText; + }); + searxng.selectImage = function (resultElement) { /* eslint no-unused-vars: 0 */ if (resultElement) { |