WeTransfer Default to link

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);