WeTransfer Default to link

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

/* eslint-disable */
// ==UserScript==
// @name         WeTransfer Default to link
// @description  Picking email leaves you without a link on the upload page. You have to actually check your email.
// @version      0.1.2
// @namespace    https://greasyfork.org/users/40601
// @homepage     https://greasyfork.org/scripts/392431
// @supportURL   https://greasyfork.org/scripts/392431/feedback
// @author       Leeroy
// @icon         https://cdn.browsercam.com/com.wetransfer.app.live-logo.png
// @match        *://wetransfer.com/*
// @match        *://we.tl/*
// @license      GPL-3.0
// ==/UserScript==
/* eslint-enable */

'use strict';

function waitForSelector(selector) {
  return new Promise((resolve, _reject) => {
    const interval = setInterval(() => {
      const el = document.querySelector(selector);
      if (el instanceof HTMLElement) {
        clearInterval(interval);
        resolve(el);
      }
    }, 100);
  });
}

const dots = '.transfer__toggle-options';
const link = '#transfer__type-link';

waitForSelector(dots)
  .then(dotsElement => {
    dotsElement.click();
    document.querySelector(link).click();
    dotsElement.click();
  })
  .catch(console.error);