Zoom redirector with Subdomains

Transparently redirects any meeting links to use Zoom's browser based web client

// ==UserScript==
// @name           Zoom redirector with Subdomains
// @match          https://zoom.us/*
// @match          https://*.zoom.us/*
// @version        1.0
// @author         clemente, Adam Novak
// @license        MIT
// @description    Transparently redirects any meeting links to use Zoom's browser based web client
// @icon           https://i.imgur.com/y8BXA8l.png
// @inject-into    content
// @run-at         document-start
// @noframes
// @namespace https://greasyfork.org/users/22981
// ==/UserScript==

const url = new URL(document.URL);
const match = /^\/[js]\/(\d+)\/?$/.exec(url.pathname);
if (match === undefined || match === null || match[1] === undefined) {
  return;
}

const urlEnding = match[0][1];
const meetingId = match[1];
const mapping = {'j': '/join', 's': '/start'};

document.location.pathname = '/wc/' + encodeURIComponent(meetingId) + mapping[urlEnding];