Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zclip-rails

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zclip-rails

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

:warning: Author Warning :warning:

I added this wrapper to give access to the zclip Jquery plugin. Nevertheless I can not recommend Zclip. A better solution is to use the zeroclipboard-rails.

Zclip::Rails

Adds easy copytoclipboard functionality to your html-elements this is done by including the Jquery zClip libary to Rails 3.x.

Installation

Add this line to your application's Gemfile:

gem 'zclip-rails'

And then execute:

$ bundle

Add this line to your application.js:

//= require zclip

Usage

Add an element (button, input, div, span etc.) somewhere in your .erb template e.g.:

<button type="button" id="copy-some-txt">example</button>

Add this in some required js file of your app:

$('#copy-some-txt').zclip({
    copy: "this is the text to copy"
});

Supply custom callback functions

$('#copy-some-txt').zclip({
    copy: "this is the text to copy",
    beforeCopy: function() {
      alert("I am going to copy some text to your clipboard");
    },
    afterCopy: function() {
      alert("done");
    }
});

Settings

Settings
Variable
Default Value
Available Values
copy *nullany string, or any javascript expression or function that returns a string
afterCopynullspecify a function to call after text is copied.

(your afterCopy function will overwrite the default alert box.)
beforeCopynullspecify a function to call before text is copied.
clickAftertruetrue
false
setHandCursortruetrue
false
setCSSEffectstruetrue
false
* required

Notes

Proper CSS effects

zClip is a flash overlay, so it must provide the target element with "hover" and "active" classes to simulate native :hover and :active states. Be sure to write your CSS as follows for best results:

a:hover, a.hover {...}
a:active, a.active {...}

$('a.copy').zclip('show'); // enable zClip on the selected element

$('a.copy').zclip('hide'); // hide zClip on the selected element

$('a.copy').zclip('remove'); // remove zClip from the selected element

Requirements

  • jquery
  • Rails 3.x

Browsersupport

The Zero Clipboard Library has been tested on the following browsers / platforms:

BrowserWindows XP SP3Windows VistaMac OS X Leopard
Internet Exploder 7.0 7.0 -
Firefox 3.0 3.0 3.0
Safari - - 3.0
Google Chrome 1.0 1.0 -

Adobe Flash Flash Player versions 9 and 10 are supported.

TODO

  • Write a gem tests

Credits

  • Thanks to Joseph Huckaby for writing the zeroclipboard libary.

  • Thanks to steamdev.com for writing the jQuery wrapper.

  • Thanks to all the contributers to this Project.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 26 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc