zclip-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Henrik Wenz
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # Zclip::Rails
2
+
3
+ Adds easy copytoclipboard functionality to your html-elements this is done by including the Jquery zClip libary to Rails 3.x.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'zclip-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Add this line to your application.js:
16
+
17
+ //= require zclip
18
+
19
+ ## Usage
20
+
21
+ Add an element (button, input, div, span etc.) somewhere in your .erb template e.g.:
22
+
23
+ <button type="button" id="copy-some-txt">example</button>
24
+
25
+ Add this in some required js file of your app:
26
+
27
+ $('#copy-some-txt').zclip({
28
+ copy: "this is the text to copy"
29
+ });
30
+
31
+ ### Supply custom callback functions
32
+
33
+ $('#copy-some-txt').zclip({
34
+ copy: "this is the text to copy",
35
+ beforeCopy: function() {
36
+ alert("I am going to copy some text to your clipboard");
37
+ },
38
+ afterCopy: function() {
39
+ alert("done");
40
+ }
41
+ });
42
+
43
+ ### Settings
44
+
45
+ <table>
46
+ <thead>
47
+ <tr>
48
+ <th colspan="3">
49
+ <h4>Settings</h4>
50
+ </th>
51
+ </tr>
52
+ <tr>
53
+ <th>
54
+ <h5>Variable</h5>
55
+ </th>
56
+ <th>
57
+ <h5>Default Value</h5>
58
+ </th>
59
+ <th>
60
+ <h5>Available Values</h5>
61
+ </th>
62
+ </tr>
63
+ </thead>
64
+ <tbody>
65
+ <tr>
66
+ <td>copy *</td>
67
+ <td>null</td>
68
+ <td>any string, or any javascript expression or function that returns a string</td>
69
+ </tr>
70
+ <tr>
71
+ <td>afterCopy</td>
72
+ <td>null</td>
73
+ <td>specify a function to call after text is copied.<br><br>(your afterCopy function will overwrite the default alert box.)</td>
74
+ </tr>
75
+ <tr>
76
+ <td>beforeCopy</td>
77
+ <td>null</td>
78
+ <td>specify a function to call before text is copied.</td>
79
+ </tr>
80
+ <tr>
81
+ <td>clickAfter</td>
82
+ <td>true</td>
83
+ <td>true<br>false</td>
84
+ </tr>
85
+ <tr>
86
+ <td>setHandCursor</td>
87
+ <td>true</td>
88
+ <td>true<br>false</td>
89
+ </tr>
90
+ <tr>
91
+ <td>setCSSEffects</td>
92
+ <td>true</td>
93
+ <td>true<br>false</td>
94
+ </tr>
95
+ <tr>
96
+ <td colspan="3" style="text-align:right">* required</td>
97
+ </tr>
98
+ </tbody>
99
+ </table>
100
+
101
+ ### Notes
102
+
103
+ #### Proper CSS effects
104
+ 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:
105
+
106
+ a:hover, a.hover {...}
107
+ a:active, a.active {...}
108
+
109
+ $('a.copy').zclip('show'); // enable zClip on the selected element
110
+
111
+ $('a.copy').zclip('hide'); // hide zClip on the selected element
112
+
113
+ $('a.copy').zclip('remove'); // remove zClip from the selected element
114
+
115
+ ### Requirements
116
+
117
+ * jquery
118
+ * Rails 3.x
119
+
120
+ ### Browsersupport
121
+
122
+ The Zero Clipboard Library has been tested on the following browsers / platforms:
123
+
124
+ <table>
125
+ <tr>
126
+ <td><strong>Browser</strong></td>
127
+ <td><strong>Windows XP SP3</strong></td>
128
+ <td><strong>Windows Vista</strong></td>
129
+ <td><strong>Mac OS X Leopard</strong></td>
130
+ </tr>
131
+ <tr>
132
+ <td> Internet Exploder </td>
133
+ <td> 7.0 </td>
134
+ <td> 7.0 </td>
135
+ <td> - </td>
136
+ </tr> <tr>
137
+ <td> Firefox </td>
138
+ <td> 3.0 </td>
139
+ <td> 3.0 </td>
140
+ <td> 3.0 </td>
141
+ </tr> <tr>
142
+ <td> Safari </td>
143
+ <td> - </td>
144
+ <td> - </td>
145
+ <td> 3.0 </td>
146
+ </tr> <tr>
147
+ <td> Google Chrome </td>
148
+ <td> 1.0 </td>
149
+ <td> 1.0 </td>
150
+ <td> - </td>
151
+ </tr>
152
+ </table>
153
+
154
+ Adobe Flash Flash Player versions 9 and 10 are supported.
155
+
156
+ ## TODO
157
+
158
+ * Write a gem tests
159
+
160
+ ## Credits
161
+
162
+ * Thanks to Joseph Huckaby for writing the zeroclipboard libary.
163
+
164
+ * Thanks to [steamdev.com](http://www.steamdev.com/zclip/) for writing the jQuery wrapper.
165
+
166
+ * Thanks to all the contributers to this Project.
167
+
168
+ ## Contributing
169
+
170
+ 1. Fork it
171
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
172
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
173
+ 4. Push to the branch (`git push origin my-new-feature`)
174
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ require "zclip-rails/version"
2
+
3
+ module Zclip
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Zclip
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ //= require "./zero-clipboard/zero-clipboard"
2
+ //= require "./zclip/jquery.zclip"
@@ -0,0 +1,141 @@
1
+ /*
2
+ * zClip :: jQuery ZeroClipboard v1.1.1
3
+ * http://steamdev.com/zclip
4
+ *
5
+ * Copyright 2011, SteamDev
6
+ * Released under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ *
9
+ * Date: Wed Jun 01, 2011
10
+ *
11
+ * Modified by Henrik Wenz
12
+ *
13
+ * Date: Mon Nov 07, 2012
14
+ */
15
+
16
+
17
+ (function ($) {
18
+
19
+ $.fn.zclip = function (params) {
20
+
21
+ if (typeof params == "object" && !params.length) {
22
+
23
+ var settings = $.extend({
24
+
25
+ path: '<%= asset_path 'ZeroClipboard10.swf' %>',
26
+ copy: null,
27
+ beforeCopy: null,
28
+ afterCopy: null,
29
+ clickAfter: true,
30
+ setHandCursor: true,
31
+ setCSSEffects: true
32
+
33
+ }, params);
34
+
35
+
36
+ return this.each(function () {
37
+
38
+ var o = $(this);
39
+
40
+ if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) {
41
+
42
+ ZeroClipboard.setMoviePath(settings.path);
43
+ var clip = new ZeroClipboard.Client();
44
+
45
+ if($.isFunction(settings.copy)){
46
+ o.bind('zClip_copy',settings.copy);
47
+ }
48
+ if($.isFunction(settings.beforeCopy)){
49
+ o.bind('zClip_beforeCopy',settings.beforeCopy);
50
+ }
51
+ if($.isFunction(settings.afterCopy)){
52
+ o.bind('zClip_afterCopy',settings.afterCopy);
53
+ }
54
+
55
+ clip.setHandCursor(settings.setHandCursor);
56
+ clip.setCSSEffects(settings.setCSSEffects);
57
+ clip.addEventListener('mouseOver', function (client) {
58
+ o.trigger('mouseenter');
59
+ });
60
+ clip.addEventListener('mouseOut', function (client) {
61
+ o.trigger('mouseleave');
62
+ });
63
+ clip.addEventListener('mouseDown', function (client) {
64
+
65
+ o.trigger('mousedown');
66
+
67
+ if(!$.isFunction(settings.copy)){
68
+ clip.setText(settings.copy);
69
+ } else {
70
+ clip.setText(o.triggerHandler('zClip_copy'));
71
+ }
72
+
73
+ if ($.isFunction(settings.beforeCopy)) {
74
+ o.trigger('zClip_beforeCopy');
75
+ }
76
+
77
+ });
78
+
79
+ clip.addEventListener('complete', function (client, text) {
80
+
81
+ if ($.isFunction(settings.afterCopy)) {
82
+
83
+ o.trigger('zClip_afterCopy');
84
+
85
+ } else {
86
+ if (text.length > 500) {
87
+ text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)";
88
+ }
89
+
90
+ o.removeClass('hover');
91
+ }
92
+
93
+ if (settings.clickAfter) {
94
+ o.trigger('click');
95
+ }
96
+
97
+ });
98
+
99
+
100
+ clip.glue(o[0], o.parent()[0]);
101
+
102
+ $(window).bind('load resize',function(){clip.reposition();});
103
+
104
+
105
+ }
106
+
107
+ });
108
+
109
+ } else if (typeof params == "string") {
110
+
111
+ return this.each(function () {
112
+
113
+ var o = $(this);
114
+
115
+ params = params.toLowerCase();
116
+ var zclipId = o.data('zclipId');
117
+ var clipElm = $('#' + zclipId + '.zclip');
118
+
119
+ if (params == "remove") {
120
+
121
+ clipElm.remove();
122
+ o.removeClass('active hover');
123
+
124
+ } else if (params == "hide") {
125
+
126
+ clipElm.hide();
127
+ o.removeClass('active hover');
128
+
129
+ } else if (params == "show") {
130
+
131
+ clipElm.show();
132
+
133
+ }
134
+
135
+ });
136
+
137
+ }
138
+
139
+ }
140
+
141
+ })(jQuery);
@@ -0,0 +1,337 @@
1
+ // Simple Set Clipboard System
2
+ // Author: Joseph Huckaby
3
+
4
+ window.ZeroClipboard = {
5
+
6
+ version: "1.0.8",
7
+ clients: {}, // registered upload clients on page, indexed by id
8
+ moviePath: 'ZeroClipboard.swf', // URL to movie
9
+ nextId: 1, // ID of next movie
10
+
11
+ $: function(thingy) {
12
+ // simple DOM lookup utility function
13
+ if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
14
+ if (!thingy.addClass) {
15
+ // extend element with a few useful methods
16
+ thingy.hide = function() { this.style.display = 'none'; };
17
+ thingy.show = function() { this.style.display = ''; };
18
+ thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
19
+ thingy.removeClass = function(name) {
20
+ var classes = this.className.split(/\s+/);
21
+ var idx = -1;
22
+ for (var k = 0; k < classes.length; k++) {
23
+ if (classes[k] == name) { idx = k; k = classes.length; }
24
+ }
25
+ if (idx > -1) {
26
+ classes.splice( idx, 1 );
27
+ this.className = classes.join(' ');
28
+ }
29
+ return this;
30
+ };
31
+ thingy.hasClass = function(name) {
32
+ return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
33
+ };
34
+ }
35
+ return thingy;
36
+ },
37
+
38
+ setMoviePath: function(path) {
39
+ // set path to ZeroClipboard.swf
40
+ this.moviePath = path;
41
+ },
42
+
43
+ // use this method in JSNI calls to obtain a new Client instance
44
+ newClient: function() {
45
+ return new ZeroClipboard.Client();
46
+ },
47
+
48
+ dispatch: function(id, eventName, args) {
49
+ // receive event from flash movie, send to client
50
+ var client = this.clients[id];
51
+ if (client) {
52
+ client.receiveEvent(eventName, args);
53
+ }
54
+ },
55
+
56
+ register: function(id, client) {
57
+ // register new client to receive events
58
+ this.clients[id] = client;
59
+ },
60
+
61
+ getDOMObjectPosition: function(obj, stopObj) {
62
+ // get absolute coordinates for dom element
63
+ var info = {
64
+ left: 0,
65
+ top: 0,
66
+ width: obj.width ? obj.width : obj.offsetWidth,
67
+ height: obj.height ? obj.height : obj.offsetHeight
68
+ };
69
+
70
+ while (obj && (obj != stopObj)) {
71
+ info.left += obj.offsetLeft;
72
+ info.left += obj.style.borderLeftWidth ? parseInt(obj.style.borderLeftWidth) : 0;
73
+ info.top += obj.offsetTop;
74
+ info.top += obj.style.borderTopWidth ? parseInt(obj.style.borderTopWidth) : 0;
75
+ obj = obj.offsetParent;
76
+ }
77
+
78
+ return info;
79
+ },
80
+
81
+ Client: function(elem) {
82
+ // constructor for new simple upload client
83
+ this.handlers = {};
84
+
85
+ // unique ID
86
+ this.id = ZeroClipboard.nextId++;
87
+ this.movieId = 'ZeroClipboardMovie_' + this.id;
88
+
89
+ // register client with singleton to receive flash events
90
+ ZeroClipboard.register(this.id, this);
91
+
92
+ // create movie
93
+ if (elem) this.glue(elem);
94
+ }
95
+ };
96
+
97
+ ZeroClipboard.Client.prototype = {
98
+
99
+ id: 0, // unique ID for us
100
+ title: "", // tooltip for the flash element
101
+ ready: false, // whether movie is ready to receive events or not
102
+ movie: null, // reference to movie object
103
+ clipText: '', // text to copy to clipboard
104
+ handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
105
+ cssEffects: true, // enable CSS mouse effects on dom container
106
+ handlers: null, // user event handlers
107
+ zIndex: 99, // default zIndex of the movie object
108
+
109
+ glue: function(elem, appendElem, stylesToAdd) {
110
+ // glue to DOM element
111
+ // elem can be ID or actual DOM element object
112
+ this.domElement = ZeroClipboard.$(elem);
113
+
114
+ // float just above object, or default zIndex if dom element isn't set
115
+ if (this.domElement.style.zIndex) {
116
+ this.zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
117
+ }
118
+
119
+ // check if the element has a title
120
+ if (this.domElement.getAttribute("title") != null) {
121
+ this.title = this.domElement.getAttribute("title");
122
+ }
123
+
124
+ if (typeof(appendElem) == 'string') {
125
+ appendElem = ZeroClipboard.$(appendElem);
126
+ }
127
+ else if (typeof(appendElem) == 'undefined') {
128
+ appendElem = document.getElementsByTagName('body')[0];
129
+ }
130
+
131
+ // find X/Y position of domElement
132
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
133
+
134
+ // create floating DIV above element
135
+ this.div = document.createElement('div');
136
+ var style = this.div.style;
137
+ style.position = 'absolute';
138
+ style.left = '' + box.left + 'px';
139
+ style.top = '' + box.top + 'px';
140
+ style.width = '' + box.width + 'px';
141
+ style.height = '' + box.height + 'px';
142
+ style.zIndex = this.zIndex;
143
+
144
+ if (typeof(stylesToAdd) == 'object') {
145
+ for (var addedStyle in stylesToAdd) {
146
+ style[addedStyle] = stylesToAdd[addedStyle];
147
+ }
148
+ }
149
+
150
+ // style.backgroundColor = '#f00'; // debug
151
+
152
+ appendElem.appendChild(this.div);
153
+
154
+ this.div.innerHTML = this.getHTML( box.width, box.height );
155
+ },
156
+
157
+ getHTML: function(width, height) {
158
+ // return HTML for movie
159
+ var html = '';
160
+ var flashvars = 'id=' + this.id +
161
+ '&width=' + width +
162
+ '&height=' + height,
163
+ title = this.title ? ' title="' + this.title + '"' : '';
164
+
165
+ if (navigator.userAgent.match(/MSIE/)) {
166
+ // IE gets an OBJECT tag
167
+ var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
168
+ html += '<object' + title + ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
169
+ }
170
+ else {
171
+ // all other browsers get an EMBED tag
172
+ html += '<embed' + title + ' id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
173
+ }
174
+ return html;
175
+ },
176
+
177
+ hide: function() {
178
+ // temporarily hide floater offscreen
179
+ if (this.div) {
180
+ this.div.style.left = '-2000px';
181
+ }
182
+ },
183
+
184
+ show: function() {
185
+ // show ourselves after a call to hide()
186
+ this.reposition();
187
+ },
188
+
189
+ destroy: function() {
190
+ // destroy control and floater
191
+ if (this.domElement && this.div) {
192
+ this.hide();
193
+ this.div.innerHTML = '';
194
+
195
+ var body = document.getElementsByTagName('body')[0];
196
+ try { body.removeChild( this.div ); } catch(e) {}
197
+
198
+ this.domElement = null;
199
+ this.div = null;
200
+ }
201
+ },
202
+
203
+ reposition: function(elem) {
204
+ // reposition our floating div, optionally to new container
205
+ // warning: container CANNOT change size, only position
206
+ if (elem) {
207
+ this.domElement = ZeroClipboard.$(elem);
208
+ if (!this.domElement) this.hide();
209
+ }
210
+
211
+ if (this.domElement && this.div) {
212
+ var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
213
+ var style = this.div.style;
214
+ style.left = '' + box.left + 'px';
215
+ style.top = '' + box.top + 'px';
216
+ }
217
+ },
218
+
219
+ setText: function(newText) {
220
+ // set text to be copied to clipboard
221
+ this.clipText = newText;
222
+ if (this.ready) this.movie.setText(newText);
223
+ },
224
+
225
+ setTitle: function(newTitle) {
226
+ // set title of flash element
227
+ this.title = newTitle;
228
+ if (this.ready) this.movie.setTitle(newTitle);
229
+ },
230
+
231
+ addEventListener: function(eventName, func) {
232
+ // add user event listener for event
233
+ // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
234
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
235
+ if (!this.handlers[eventName]) this.handlers[eventName] = [];
236
+ this.handlers[eventName].push(func);
237
+ },
238
+
239
+ setHandCursor: function(enabled) {
240
+ // enable hand cursor (true), or default arrow cursor (false)
241
+ this.handCursorEnabled = enabled;
242
+ if (this.ready) this.movie.setHandCursor(enabled);
243
+ },
244
+
245
+ setCSSEffects: function(enabled) {
246
+ // enable or disable CSS effects on DOM container
247
+ this.cssEffects = !!enabled;
248
+ },
249
+
250
+ receiveEvent: function(eventName, args) {
251
+ // receive event from flash
252
+ eventName = eventName.toString().toLowerCase().replace(/^on/, '');
253
+
254
+ // special behavior for certain events
255
+ switch (eventName) {
256
+ case 'load':
257
+ // movie claims it is ready, but in IE this isn't always the case...
258
+ // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
259
+ this.movie = document.getElementById(this.movieId);
260
+ if (!this.movie) {
261
+ var self = this;
262
+ setTimeout( function() { self.receiveEvent('load', null); }, 1 );
263
+ return;
264
+ }
265
+
266
+ // firefox on pc needs a "kick" in order to set these in certain cases
267
+ if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
268
+ var self = this;
269
+ setTimeout( function() { self.receiveEvent('load', null); }, 100 );
270
+ this.ready = true;
271
+ return;
272
+ }
273
+
274
+ this.ready = true;
275
+ this.movie.setText( this.clipText );
276
+ this.movie.setTitle( this.title );
277
+ this.movie.setHandCursor( this.handCursorEnabled );
278
+ break;
279
+
280
+ case 'mouseover':
281
+ if (this.domElement && this.cssEffects) {
282
+ this.domElement.addClass('hover');
283
+ if (this.recoverActive) this.domElement.addClass('active');
284
+ }
285
+ break;
286
+
287
+ case 'mouseout':
288
+ if (this.domElement && this.cssEffects) {
289
+ this.recoverActive = false;
290
+ if (this.domElement.hasClass('active')) {
291
+ this.domElement.removeClass('active');
292
+ this.recoverActive = true;
293
+ }
294
+ this.domElement.removeClass('hover');
295
+ }
296
+ break;
297
+
298
+ case 'mousedown':
299
+ if (this.domElement && this.cssEffects) {
300
+ this.domElement.addClass('active');
301
+ }
302
+ break;
303
+
304
+ case 'mouseup':
305
+ if (this.domElement && this.cssEffects) {
306
+ this.domElement.removeClass('active');
307
+ this.recoverActive = false;
308
+ }
309
+ break;
310
+ } // switch eventName
311
+
312
+ if (this.handlers[eventName]) {
313
+ for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
314
+ var func = this.handlers[eventName][idx];
315
+
316
+ if (typeof(func) == 'function') {
317
+ // actual function reference
318
+ func(this, args);
319
+ }
320
+ else if ((typeof(func) == 'object') && (func.length == 2)) {
321
+ // PHP style object + method, i.e. [myObject, 'myMethod']
322
+ func[0][ func[1] ](this, args);
323
+ }
324
+ else if (typeof(func) == 'string') {
325
+ // name of function
326
+ window[func](this, args);
327
+ }
328
+ } // foreach event handler defined
329
+ } // user defined handler for event
330
+ }
331
+
332
+ };
333
+
334
+ if (typeof module !== "undefined") {
335
+ module.exports = ZeroClipboard;
336
+ }
337
+
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zclip-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Henrik Wenz
9
+ - Joseph Huckaby
10
+ - SteamDev
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-11-07 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: railties
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: '3.1'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: '3.1'
32
+ - !ruby/object:Gem::Dependency
33
+ name: jquery-rails
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 1.0.17
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.17
48
+ description: Wrapper for jQuery - zClip (zeroclipboard). Adds easy copy to clipboard
49
+ functionality to your Rails 3.x app
50
+ email:
51
+ - handtrix@gmail.com
52
+ executables: []
53
+ extensions: []
54
+ extra_rdoc_files: []
55
+ files:
56
+ - lib/zclip-rails/version.rb
57
+ - lib/zclip-rails.rb
58
+ - vendor/assets/images/ZeroClipboard10.swf
59
+ - vendor/assets/javascripts/zclip/jquery.zclip.js.erb
60
+ - vendor/assets/javascripts/zclip.js
61
+ - vendor/assets/javascripts/zero-clipboard/zero-clipboard.js
62
+ - LICENSE
63
+ - README.md
64
+ homepage: https://github.com/HaNdTriX/zclip-rails
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 1.8.24
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Adds easy copy to clipboard functionality to your Rails 3.x app
88
+ test_files: []