settings-personal.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. $(document).ready(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. $('#fileSharingSettings .clipboardButton').tooltip({placement: 'bottom', title: t('core', 'Copy'), trigger: 'hover'});
  20. // Clipboard!
  21. var clipboard = new Clipboard('.clipboardButton');
  22. clipboard.on('success', function(e) {
  23. $input = $(e.trigger);
  24. $input.tooltip('hide')
  25. .attr('data-original-title', t('core', 'Copied!'))
  26. .tooltip('fixTitle')
  27. .tooltip({placement: 'bottom', trigger: 'manual'})
  28. .tooltip('show');
  29. _.delay(function() {
  30. $input.tooltip('hide')
  31. .attr('data-original-title', t('core', 'Copy'))
  32. .tooltip('fixTitle');
  33. }, 3000);
  34. });
  35. clipboard.on('error', function (e) {
  36. $input = $(e.trigger);
  37. var actionMsg = '';
  38. if (/iPhone|iPad/i.test(navigator.userAgent)) {
  39. actionMsg = t('core', 'Not supported!');
  40. } else if (/Mac/i.test(navigator.userAgent)) {
  41. actionMsg = t('core', 'Press ⌘-C to copy.');
  42. } else {
  43. actionMsg = t('core', 'Press Ctrl-C to copy.');
  44. }
  45. $input.tooltip('hide')
  46. .attr('data-original-title', actionMsg)
  47. .tooltip('fixTitle')
  48. .tooltip({placement: 'bottom', trigger: 'manual'})
  49. .tooltip('show');
  50. _.delay(function () {
  51. $input.tooltip('hide')
  52. .attr('data-original-title', t('core', 'Copy'))
  53. .tooltip('fixTitle');
  54. }, 3000);
  55. });
  56. $('#fileSharingSettings .hasTooltip').tooltip({placement: 'right'});
  57. });