[go: up one dir, main page]

Skip to content

pokutuna/chrome-cocopy

Repository files navigation

cocopy

logo

a chrome extension to copy text by your code.

(In Japanese) コードで(by code) コピー(copy)

Install

Install from Chrome Web Store

Usage

Execute Function to Copy

  • By selecting a function, it runs with the current page content.
  • The return value of the function is copied to the clipboard.
  • You can use the number keys to select a function.

run a function to copy

Create & Edit Function

  • You can open the options page from the cog icon ⚙️ on the popup and define & edit a function
  • The function receives an object having these properties.
property type description
title string The page title. Same as document.title.
url string The page url. Same as location.href.
content string HTML content of current page.
Same as document.documentElement.outerHTML
You can query this using DOMParser.
selectingText string Text currently selected on the page.
Same as window.getSelection().toString().
modifier object Flags of modifier key being pressed when a function executed.
The keys are alt, ctrl, meta and shift
  • The code runs safely under the sandbox, not under the page.

edit a function

Keyboard Shortcut (optional)

Set it up in chrome://extensions/shortcuts .

The default suggested keys to open popup are Ctrl+Shift+L or Cmd+Shift+L(Mac).

Check for the settings conflicts with other extensions and re-input your shortcut keys if it doesn't work. (e.g. 1Password X)

Function Gallery

Go to the gallery to add more functions and see sample codes.

There are functions to ...

  • Simplify Amazon.co.jp URL.
  • Copy current playing position on YouTube video.

Import/Export

In options page & open console

// export to clipboard
chrome.storage.sync.get('functions', copy)

// import
const obj = /* paste here */;
chrome.storage.sync.set(obj)