Browse Source

Add menu item for copying the link

tags/v0.1.0
Gerben 4 years ago
parent
commit
cb60c5592c
4 changed files with 22 additions and 2 deletions
  1. +10
    -2
      app/_locales/en/messages.json
  2. +2
    -0
      app/assets/main.css
  3. +9
    -0
      app/create-bookmarks/contentscript.js
  4. +1
    -0
      app/manifest.json

+ 10
- 2
app/_locales/en/messages.json View File

@@ -11,12 +11,20 @@
"message": "Browser extension to bookmark fragments of audio files", "message": "Browser extension to bookmark fragments of audio files",
"description": "The description of the application" "description": "The description of the application"
}, },
"copySelectionContextMenuItemForFragment": {
"message": "Copy link to selected fragment",
"description": "The context menu item to copy a selected audio fragment"
},
"copySelectionContextMenuItemForSingleMoment": {
"message": "Copy link to selected moment",
"description": "The context menu item to copy a selected moment"
},
"bookmarkSelectionContextMenuItemForFragment": { "bookmarkSelectionContextMenuItemForFragment": {
"message": "Bookmark selected fragment", "message": "Bookmark selected fragment",
"description": "The entry in the context ('right-click') menu when selecting an audio fragment"
"description": "The context menu item to bookmark a selected audio fragment"
}, },
"bookmarkSelectionContextMenuItemForSingleMoment": { "bookmarkSelectionContextMenuItemForSingleMoment": {
"message": "Bookmark selected moment", "message": "Bookmark selected moment",
"description": "The entry in the context ('right-click') menu when selecting a single moment"
"description": "The context menu item to bookmark a selected single moment"
} }
} }

+ 2
- 0
app/assets/main.css View File

@@ -99,6 +99,8 @@ input#volume:focus {
} }


.context-menu button { .context-menu button {
width: 100%;
text-align: unset;
background: none; background: none;
border: none; border: none;
font-size: 1em; font-size: 1em;


+ 9
- 0
app/create-bookmarks/contentscript.js View File

@@ -61,6 +61,15 @@ export default async function init(playlist) {
} }


const menuItems = [ const menuItems = [
{
title: browser.i18n.getMessage(end !== undefined
? 'copySelectionContextMenuItemForFragment'
: 'copySelectionContextMenuItemForSingleMoment'
),
async action() {
await navigator.clipboard.writeText(preciseUrl());
},
},
{ {
title: browser.i18n.getMessage(end !== undefined title: browser.i18n.getMessage(end !== undefined
? 'bookmarkSelectionContextMenuItemForFragment' ? 'bookmarkSelectionContextMenuItemForFragment'


+ 1
- 0
app/manifest.json View File

@@ -10,6 +10,7 @@
}, },
"permissions": [ "permissions": [
"<all_urls>", "<all_urls>",
"clipboardWrite",
"bookmarks", "bookmarks",
"tabs", "tabs",
"webRequest" "webRequest"


Loading…
Cancel
Save