ProtonMail Beta

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

  1. // ==UserScript==
  2. // @name ProtonMail Beta
  3. // @version 1.2
  4. // @author openpaige
  5. // @description A basic userscript to automatically switch to ProtonMail's beta subdomain by redirecting mail.protonmail.com to beta.protonmail.com.
  6. // @icon https://gitlab.com/openpaige-user-scripts/protonmail-beta/-/raw/master/media/protonmail-sign-dark.png
  7. // @match *://mail.protonmail.com/*
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/users/668007
  10. // ==/UserScript==
  11.  
  12. function checkURL(url){
  13. return !!url.match(/^(|http(s?):\/\/)(|mail.)protonmail.com(\/.*|$)/gim);
  14. }
  15.  
  16. function newURL(url){
  17. return 'https://beta.protonmail.com' + url.split('protonmail.com').pop();
  18. }
  19.  
  20. if(checkURL(window.location.href)){window.location.assign(newURL(window.location.href));}