summaryrefslogtreecommitdiffstats
path: root/settings/js/authtoken_view.js
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-10 09:10:39 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-10 09:10:39 +0200
commit965804425dd13ec9d7d2f5edbfbd62ed6939b12e (patch)
tree24397fcf74e29c4c9c6c31c4f1352ce9aa61f8b3 /settings/js/authtoken_view.js
parentde44ab0244a0a47dad04b8b53b5d55e31a0e430e (diff)
downloadnextcloud-server-965804425dd13ec9d7d2f5edbfbd62ed6939b12e.tar.gz
nextcloud-server-965804425dd13ec9d7d2f5edbfbd62ed6939b12e.zip
Add clipboardjs for token
Diffstat (limited to 'settings/js/authtoken_view.js')
-rw-r--r--settings/js/authtoken_view.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js
index c8cf66a6cea..03d6c188f6e 100644
--- a/settings/js/authtoken_view.js
+++ b/settings/js/authtoken_view.js
@@ -218,6 +218,38 @@
this._newAppPassword.on('focus', _.bind(this._onNewTokenFocus, this));
this._hideAppPasswordBtn = $('#app-password-hide');
this._hideAppPasswordBtn.click(_.bind(this._hideToken, this));
+
+ // Clipboard!
+ var clipboard = new Clipboard('.clipboardButton');
+ clipboard.on('success', function(e) {
+ var $input = $(e.trigger);
+ $input.tooltip({placement: 'bottom', trigger: 'manual', title: t('core', 'Copied!')});
+ $input.tooltip('show');
+ _.delay(function() {
+ $input.tooltip('hide');
+ }, 3000);
+ });
+ clipboard.on('error', function (e) {
+ var $input = $(e.trigger);
+ var actionMsg = '';
+ if (/iPhone|iPad/i.test(navigator.userAgent)) {
+ actionMsg = t('core', 'Not supported!');
+ } else if (/Mac/i.test(navigator.userAgent)) {
+ actionMsg = t('core', 'Press ⌘-C to copy.');
+ } else {
+ actionMsg = t('core', 'Press Ctrl-C to copy.');
+ }
+
+ $input.tooltip({
+ placement: 'bottom',
+ trigger: 'manual',
+ title: actionMsg
+ });
+ $input.tooltip('show');
+ _.delay(function () {
+ $input.tooltip('hide');
+ }, 3000);
+ });
},
render: function () {