diff --git a/src/main.js b/src/main.js index e955a77d..6591cddb 100644 --- a/src/main.js +++ b/src/main.js @@ -586,6 +586,19 @@ class WebSearchNavigator { }); return false; }); + this.register(getOpt('copyUrlKey'), () => { + const link = this.resultsManager.getElementToNavigate(); + if ( + link == null || link.localName !== 'a' || !link.href || + !navigator.clipboard + ) { + return true; + } + navigator.clipboard.writeText(link.href).then( + () => false, + (err) => true, + ); + }); } initChangeToolsNavigation() { diff --git a/src/options.js b/src/options.js index b0db4cdd..999a1d3b 100644 --- a/src/options.js +++ b/src/options.js @@ -152,6 +152,7 @@ const DEFAULT_KEYBINDINGS = { showImagesLarge: ['z l'], showImagesMedium: ['z e'], showImagesIcon: ['z i'], + copyUrlKey: [], }; const DEFAULT_OPTIONS = { diff --git a/src/options_page.html b/src/options_page.html index 76d3ee7b..764b202a 100644 --- a/src/options_page.html +++ b/src/options_page.html @@ -101,6 +101,10 @@

Keybindings

+
+ + +

Results filtering

diff --git a/src/options_page.js b/src/options_page.js index a82acdd3..b35290e5 100644 --- a/src/options_page.js +++ b/src/options_page.js @@ -103,6 +103,7 @@ const KEYBINDING_TO_DIV = { showImagesLarge: 'show-images-large', showImagesMedium: 'show-images-medium', showImagesIcon: 'show-images-icon', + copyUrlKey: 'copy-url-key', }; /**