ngclipboard
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "ngclipboard", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/sachinchoolur/ngclipboard", | ||
@@ -18,3 +18,3 @@ "authors": [ | ||
"dependencies": { | ||
"clipboard": "^1.0.0", | ||
"clipboard": "~1.5.5", | ||
"angular": ">=1.2.0" | ||
@@ -21,0 +21,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
/*! ngclipboard - v1.0.0 - 2015-10-21 | ||
/*! ngclipboard - v1.1.0 - 2015-12-30 | ||
* https://github.com/sachinchoolur/ngclipboard | ||
@@ -6,3 +6,15 @@ * Copyright (c) 2015 Sachin; Licensed MIT */ | ||
'use strict'; | ||
angular.module('ngclipboard', []).directive('ngclipboard', function() { | ||
var MODULE_NAME = 'ngclipboard'; | ||
var angular, Clipboard; | ||
if (typeof module !== 'undefined' && typeof module.exports === 'object') { | ||
angular = require('angular'); | ||
Clipboard = require('clipboard'); | ||
module.exports = MODULE_NAME; | ||
} else { | ||
angular = window.angular; | ||
Clipboard = window.Clipboard; | ||
} | ||
angular.module(MODULE_NAME, []).directive('ngclipboard', function() { | ||
return { | ||
@@ -15,15 +27,7 @@ restrict: 'A', | ||
link: function(scope, element) { | ||
var clipboard = new Clipboard(element[0]); | ||
var _id = element.attr('id'); | ||
if (!_id) { | ||
element.attr('id', 'ngclipboard' + Date.now()); | ||
_id = element.attr('id'); | ||
} | ||
var clipboard = new Clipboard('#' + _id); | ||
clipboard.on('success', function(e) { | ||
scope.ngclipboardSuccess({ | ||
e: e, | ||
id: element.attr('id') | ||
e: e | ||
}); | ||
@@ -34,4 +38,3 @@ }); | ||
scope.ngclipboardError({ | ||
e: e, | ||
id: element.attr('id') | ||
e: e | ||
}); | ||
@@ -38,0 +41,0 @@ }); |
@@ -1,4 +0,4 @@ | ||
/*! ngclipboard - v1.0.0 - 2015-10-21 | ||
/*! ngclipboard - v1.1.0 - 2015-12-30 | ||
* https://github.com/sachinchoolur/ngclipboard | ||
* Copyright (c) 2015 Sachin; Licensed MIT */ | ||
!function(){"use strict";angular.module("ngclipboard",[]).directive("ngclipboard",function(){return{restrict:"A",scope:{ngclipboardSuccess:"&",ngclipboardError:"&"},link:function(a,b){var c=b.attr("id");c||(b.attr("id","ngclipboard"+Date.now()),c=b.attr("id"));var d=new Clipboard("#"+c);d.on("success",function(c){a.ngclipboardSuccess({e:c,id:b.attr("id")})}),d.on("error",function(c){a.ngclipboardError({e:c,id:b.attr("id")})})}}})}(); | ||
!function(){"use strict";var a,b,c="ngclipboard";"undefined"!=typeof module&&"object"==typeof module.exports?(a=require("angular"),b=require("clipboard"),module.exports=c):(a=window.angular,b=window.Clipboard),a.module(c,[]).directive("ngclipboard",function(){return{restrict:"A",scope:{ngclipboardSuccess:"&",ngclipboardError:"&"},link:function(a,c){var d=new b(c[0]);d.on("success",function(b){a.ngclipboardSuccess({e:b})}),d.on("error",function(b){a.ngclipboardError({e:b})})}}})}(); |
{ | ||
"name": "ngclipboard", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Angularjs directive for clipboard.js", | ||
@@ -31,2 +31,6 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"clipboard": "~1.5.5", | ||
"angular": ">=1.2.0" | ||
}, | ||
"devDependencies": { | ||
@@ -33,0 +37,0 @@ "grunt": "^0.4.5", |
@@ -1,3 +0,1 @@ | ||
# ngclipboard | ||
![license](https://img.shields.io/npm/l/ngclipboard.svg) | ||
@@ -8,2 +6,5 @@ ![travis](https://travis-ci.org/sachinchoolur/ngclipboard.svg?branch=master) | ||
# ngclipboard | ||
##### An angularjs directive to copy text to clipboard without using flash | ||
> Angularjs directive for [clipboard.js](http://zenorocha.github.io/clipboard.js/) by [@zenorocha](https://twitter.com/zenorocha) | ||
@@ -10,0 +11,0 @@ |
(function() { | ||
'use strict'; | ||
angular.module('ngclipboard', []).directive('ngclipboard', function() { | ||
var MODULE_NAME = 'ngclipboard'; | ||
var angular, Clipboard; | ||
if (typeof module !== 'undefined' && typeof module.exports === 'object') { | ||
angular = require('angular'); | ||
Clipboard = require('clipboard'); | ||
module.exports = MODULE_NAME; | ||
} else { | ||
angular = window.angular; | ||
Clipboard = window.Clipboard; | ||
} | ||
angular.module(MODULE_NAME, []).directive('ngclipboard', function() { | ||
return { | ||
@@ -11,15 +23,7 @@ restrict: 'A', | ||
link: function(scope, element) { | ||
var clipboard = new Clipboard(element[0]); | ||
var _id = element.attr('id'); | ||
if (!_id) { | ||
element.attr('id', 'ngclipboard' + Date.now()); | ||
_id = element.attr('id'); | ||
} | ||
var clipboard = new Clipboard('#' + _id); | ||
clipboard.on('success', function(e) { | ||
scope.ngclipboardSuccess({ | ||
e: e, | ||
id: element.attr('id') | ||
e: e | ||
}); | ||
@@ -30,4 +34,3 @@ }); | ||
scope.ngclipboardError({ | ||
e: e, | ||
id: element.attr('id') | ||
e: e | ||
}); | ||
@@ -34,0 +37,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18544
16
187
160
2
1
+ Addedangular@>=1.2.0
+ Addedclipboard@~1.5.5
+ Addedangular@1.8.3(transitive)
+ Addedclipboard@1.5.16(transitive)
+ Addeddelegate@3.2.0(transitive)
+ Addedgood-listener@1.2.2(transitive)
+ Addedselect@1.1.2(transitive)
+ Addedtiny-emitter@1.2.0(transitive)