1
0

settings-personal.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. window.addEventListener('DOMContentLoaded', function() {
  2. $('#fileSharingSettings button.pop-up').click(function() {
  3. var url = $(this).data('url');
  4. if (url) {
  5. var width = 600;
  6. var height = 400;
  7. var left = (screen.width/2)-(width/2);
  8. var top = (screen.height/2)-(height/2);
  9. window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
  10. }
  11. });
  12. $('#oca-files-sharing-add-to-your-website').click(function() {
  13. if ($('#oca-files-sharing-add-to-your-website-expanded').is(':visible')) {
  14. $('#oca-files-sharing-add-to-your-website-expanded').slideUp();
  15. } else {
  16. $('#oca-files-sharing-add-to-your-website-expanded').slideDown();
  17. }
  18. });
  19. /* Verification icon tooltip */
  20. $('#personal-settings-container .verify img').tooltip({placement: 'bottom', trigger: 'hover'});
  21. $('#fileSharingSettings .clipboardButton').tooltip({placement: 'bottom', title: t('core', 'Copy'), trigger: 'hover'});
  22. // Clipboard!
  23. var clipboard = new Clipboard('.clipboardButton');
  24. clipboard.on('success', function(e) {
  25. var $input = $(e.trigger);
  26. $input.tooltip('hide')
  27. .attr('data-original-title', t('core', 'Copied!'))
  28. .tooltip('fixTitle')
  29. .tooltip({placement: 'bottom', trigger: 'manual'})
  30. .tooltip('show');
  31. _.delay(function() {
  32. $input.tooltip('hide')
  33. .attr('data-original-title', t('core', 'Copy'))
  34. .tooltip('fixTitle');
  35. }, 3000);
  36. });
  37. clipboard.on('error', function (e) {
  38. var $input = $(e.trigger);
  39. var actionMsg = '';
  40. if (/iPhone|iPad/i.test(navigator.userAgent)) {
  41. actionMsg = t('core', 'Not supported!');
  42. } else if (/Mac/i.test(navigator.userAgent)) {
  43. actionMsg = t('core', 'Press ⌘-C to copy.');
  44. } else {
  45. actionMsg = t('core', 'Press Ctrl-C to copy.');
  46. }
  47. $input.tooltip('hide')
  48. .attr('data-original-title', actionMsg)
  49. .tooltip('fixTitle')
  50. .tooltip({placement: 'bottom', trigger: 'manual'})
  51. .tooltip('show');
  52. _.delay(function () {
  53. $input.tooltip('hide')
  54. .attr('data-original-title', t('core', 'Copy'))
  55. .tooltip('fixTitle');
  56. }, 3000);
  57. });
  58. $('#fileSharingSettings .hasTooltip').tooltip({placement: 'right'});
  59. });