dropbox.js 865 B

123456789101112131415161718192021222324252627282930
  1. $(document).ready(function() {
  2. function generateUrl($tr) {
  3. var app_key = $tr.find('[data-parameter="app_key"]').val();
  4. if (app_key) {
  5. return 'https://www.dropbox.com/developers/apps/info/' + app_key;
  6. } else {
  7. return 'https://www.dropbox.com/developers/apps';
  8. }
  9. }
  10. OCA.External.Settings.mountConfig.whenSelectBackend(function($tr, backend, onCompletion) {
  11. if (backend === 'dropbox') {
  12. var backendEl = $tr.find('.backend');
  13. var el = $(document.createElement('a'))
  14. .attr('href', generateUrl($tr))
  15. .attr('target', '_blank')
  16. .attr('title', t('files_external', 'Dropbox App Configuration'))
  17. .addClass('icon-settings svg')
  18. ;
  19. el.on('click', function(event) {
  20. var a = $(event.target);
  21. a.attr('href', generateUrl($(this).closest('tr')));
  22. });
  23. el.tooltip({placement: 'top'});
  24. backendEl.append(el);
  25. }
  26. });
  27. });