Thanks to visit codestin.com
Credit goes to github.com

Skip to content
forked from roosta/yank

Firefox extension that yank URL and title, format to a chosen markup language, and copy to clipboard. For fork go to:

License

nicolaus1990/yank

 
 

Repository files navigation

Yank

Build Status

A Firefox extension to copy current tab URL to clipboard, formatted for a markup language. Supports custom shortcuts and several different markup languages.

Usage

By default this plugin binds ctrl+y to copy URL as org-mode. To change this open up the options page, either from a about:addons or by clicking the addon icon in the toolbar

There is also a context menu option, that allows for copying an anchors href and content.

Quickly change the markup format by clicking the toolbar icon to display the popup menu.

Shortcut keys

Currently allowed shortcuts are any alphanumeric key and/or any combination of ctrl/alt/shift/meta

Supported formats

Yank currently supports these markup languages:

Development

The development of this extension was done using using leiningen version 2.7.0 running on OpenJDK Java version 1.8.0_181 on Arch linux. It also runs on travis-ci, refer to .travis.yaml.

$ git clone https://github.com/roosta/yank && cd yank

Building assets

To build HTML, manifest and CSS assets call:

$ lein build

Starting autobuild and repl

Start a repl either from an editor like emacs cider: M-x cider-jack-in, or from the terminal:

$ lein repl

You are then put into the user namespace where some figwheel helper functions are defined. To get started call the function start:

user=> (start)

This will start autobuilding. From here you can connect to a repl environment by calling:

user=> (cljs-repl "BUILD NAME HERE")

to exit out of a repl env, call

cljs.user=> :cljs/quit

That puts you back into the user namespace where you can (stop) figwheel or start another cljs-repl

Load extension in firefox

Open up Firefox and goto about:debugging -> Load Temporary Add-on -> browse to: [project-root]/resources/dev/manifest.json

Package/Release build

  1. To build a release version and package it run:
$ lein release

This will produce an unsigned .xpi file that can be temporarily loaded in firefox. Bear in mind that this package is unsigned and you'd need to sign it yourself to use it as anything but a temporary addon.

Troubleshooting

This plugin loads a content script that listens for a chosen key, but it is loaded as a context of the current page, which means it acts just like any other website key-press listener, therefore when the focus is on say an input field yank won't override any keyboard events and will simply not work. Just keep that in mind when trying to yank an URL and something else has the keyboard focus.

I wrote this plugin solely for org-mode, and just added the remaining formats since it required very little once the code surrounding it actually worked. Reason I mention this is that I don't actively use the other formats, so aside from org-mode and possibly markdown I can't say with certainty that the plugin handles it correctly.

Please open an issue if there is a problem, or any other format is desired.

Libs

  • Hiccup - Used to render HTML from clojure data structures
  • Mousetrap - Library to bind the custom shortcut keys.
  • Environ - Manage environment variables
  • Garden - Generate CSS
  • lein-asset-minifier - Minify generated CSS
  • Figwheel - Plugin used to hotload source code when developing
  • Piggieback - Used together with cider to get a CLJS REPL
  • Doo - JS test runner
  • lein-shell - Call shell from within Leiningen, used in packaging process
  • Hickory - Parse HTML as data for use in tests
  • Etaoin - Webdriver protocol implementation used for integration testing

Other projects

  • chromex-sample - Borrowed a fair bit from this project's tooling. Never coded a web-extension plugin before and this repo really helped

  • chrome-shortkeys - Inspired how to handle binding custom keys, before I stumbled on this plugin I really had no idea how to go about doing this.

About

Firefox extension that yank URL and title, format to a chosen markup language, and copy to clipboard. For fork go to:

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 54.7%
  • JavaScript 43.4%
  • Shell 1.9%