summaryrefslogtreecommitdiff
path: root/searx/static/themes/simple/src/js
diff options
context:
space:
mode:
authorPaul Braeuning <paul@paulgo.io>2023-11-11 16:19:58 +0100
committerGitHub <noreply@github.com>2023-11-11 16:19:58 +0100
commit7b1951aa97f05bf679d36574a16c8a85995cc9c1 (patch)
treec275777cd83c575944e7158b9cefbd572cc48352 /searx/static/themes/simple/src/js
parent96ccec1aa6507ef4d3dc05a08e01187f80080972 (diff)
parent727de1c4efc17a91ce3837f827ee7a779a12ed6a (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.js8
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) {