ProtonMail Beta

A basic userscript to automatically switch to ProtonMail's beta subdomain by redirecting mail.protonmail.com to beta.protonmail.com.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         ProtonMail Beta
// @version      1.2
// @author       openpaige
// @description  A basic userscript to automatically switch to ProtonMail's beta subdomain by redirecting mail.protonmail.com to beta.protonmail.com.
// @icon         https://gitlab.com/openpaige-user-scripts/protonmail-beta/-/raw/master/media/protonmail-sign-dark.png
// @match        *://mail.protonmail.com/*
// @run-at       document-start
// @namespace https://greasyfork.org/users/668007
// ==/UserScript==

function checkURL(url){
    return !!url.match(/^(|http(s?):\/\/)(|mail.)protonmail.com(\/.*|$)/gim);
}

function newURL(url){
    return 'https://beta.protonmail.com' + url.split('protonmail.com').pop();
}

if(checkURL(window.location.href)){window.location.assign(newURL(window.location.href));}