Add clipboardjs for token
This commit is contained in:
parent
806f9b80f1
commit
79b7ff3bf8
|
@ -145,6 +145,15 @@ table.nostyle td { padding: 0.2em 0; }
|
|||
.app-password-row {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.app-password-row .icon {
|
||||
background-size: 16px 16px;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: 3px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.app-password-label {
|
||||
display: table-cell;
|
||||
padding-right: 1em;
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -211,6 +211,7 @@ if($_['passwordChangeSupported']) {
|
|||
<div class="app-password-row">
|
||||
<span class="app-password-label"><?php p($l->t('Password')); ?></span>
|
||||
<input id="new-app-password" type="text" readonly="readonly"/>
|
||||
<a class="clipboardButton icon icon-clippy" data-clipboard-target="#new-app-password"></a>
|
||||
<button id="app-password-hide" class="button"><?php p($l->t('Done')); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue