WeTransfer Default to link

Picking email leaves you without a link on the upload page. You have to actually check your email.

  1. /* eslint-disable */
  2. // ==UserScript==
  3. // @name WeTransfer Default to link
  4. // @description Picking email leaves you without a link on the upload page. You have to actually check your email.
  5. // @version 0.1.2
  6. // @namespace https://greasyfork.org/users/40601
  7. // @homepage https://greasyfork.org/scripts/392431
  8. // @supportURL https://greasyfork.org/scripts/392431/feedback
  9. // @author Leeroy
  10. // @icon https://cdn.browsercam.com/com.wetransfer.app.live-logo.png
  11. // @match *://wetransfer.com/*
  12. // @match *://we.tl/*
  13. // @license GPL-3.0
  14. // ==/UserScript==
  15. /* eslint-enable */
  16.  
  17. 'use strict';
  18.  
  19. function waitForSelector(selector) {
  20. return new Promise((resolve, _reject) => {
  21. const interval = setInterval(() => {
  22. const el = document.querySelector(selector);
  23. if (el instanceof HTMLElement) {
  24. clearInterval(interval);
  25. resolve(el);
  26. }
  27. }, 100);
  28. });
  29. }
  30.  
  31. const dots = '.transfer__toggle-options';
  32. const link = '#transfer__type-link';
  33.  
  34. waitForSelector(dots)
  35. .then(dotsElement => {
  36. dotsElement.click();
  37. document.querySelector(link).click();
  38. dotsElement.click();
  39. })
  40. .catch(console.error);