]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge pull request #780 from nextcloud/copy_fed_cloud_id
authorRoeland Jago Douma <rullzer@users.noreply.github.com>
Tue, 9 Aug 2016 14:18:15 +0000 (16:18 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Aug 2016 14:18:15 +0000 (16:18 +0200)
Add clipboard action to Personal Settings Fed Cloud Id

1  2 
apps/federatedfilesharing/js/settings-personal.js

index 031a3c9617a2e19ce493a2ae76270d297d2a2f7a,052ff5b4ed6051a9a6f3c40291d31fc281094f4f..f89022dc8a02ded49661d418a55a7a06002651c8
@@@ -13,11 -13,38 +13,42 @@@ $(document).ready(function() 
        });
  
        $('#oca-files-sharing-add-to-your-website').click(function() {
 -              $('#oca-files-sharing-add-to-your-website-expanded').slideDown();
 +              if ($('#oca-files-sharing-add-to-your-website-expanded').is(':visible')) {
 +                      $('#oca-files-sharing-add-to-your-website-expanded').slideUp();
 +              } else {
 +                      $('#oca-files-sharing-add-to-your-website-expanded').slideDown();
 +              }
        });
  
+       // Clipboard!
+       var clipboard = new Clipboard('.clipboardButton');
+       clipboard.on('success', function(e) {
+               $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) {
+               $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);
+       });
  });