mirror of
https://github.com/nextcloud/passman.git
synced 2025-01-01 04:51:44 +08:00
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
/*! ngclipboard - v1.1.1 - 2016-02-26
|
|
* https://github.com/sachinchoolur/ngclipboard
|
|
* Copyright (c) 2016 Sachin; Licensed MIT */
|
|
(function() {
|
|
'use strict';
|
|
var MODULE_NAME = 'ngclipboard';
|
|
var angular, Clipboard;
|
|
|
|
// Check for CommonJS support
|
|
if (typeof module === 'object' && module.exports) {
|
|
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 {
|
|
restrict: 'A',
|
|
scope: {
|
|
ngclipboardSuccess: '&',
|
|
ngclipboardError: '&'
|
|
},
|
|
link: function(scope, element) {
|
|
var clipboard = new Clipboard(element[0]);
|
|
|
|
clipboard.on('success', function(e) {
|
|
scope.$apply(function () {
|
|
scope.ngclipboardSuccess({
|
|
e: e
|
|
});
|
|
});
|
|
});
|
|
|
|
clipboard.on('error', function(e) {
|
|
scope.$apply(function () {
|
|
scope.ngclipboardError({
|
|
e: e
|
|
});
|
|
});
|
|
});
|
|
|
|
}
|
|
};
|
|
});
|
|
}());
|