Hide Email Address From Title Bar

Remove email address from title bar on Gmail, Outlook.com, Office365, and Yahoo Mail

  1. // ==UserScript==
  2. // @name Hide Email Address From Title Bar
  3. // @author Jefferson "jscher2000" Scher
  4. // @namespace JeffersonScher
  5. // @version 0.5
  6. // @copyright Copyright 2018 Jefferson Scher
  7. // @license BSD-3-Clause
  8. // @description Remove email address from title bar on Gmail, Outlook.com, Office365, and Yahoo Mail
  9. // @include https://mail.google.com/*
  10. // @include https://outlook.live.com/*
  11. // @include https://outlook.office.com/*
  12. // @include https://outlook.office365.com/*
  13. // @include https://mail.yahoo.com/*
  14. // @grant none
  15. // ==/UserScript==
  16.  
  17. function cleanTitle(){
  18. //console.log('Called cleanTitle');
  19. if (document.title.indexOf('@') > -1) {
  20. var titleparts = document.title.split(' '), titlenew = '';
  21. for (var i=0; i<titleparts.length; i++){
  22. if (titleparts[i].indexOf('@') < 0){
  23. titlenew += titleparts[i] + ' ';
  24. } else {
  25. if (location.hostname.indexOf('outlook.live') > -1) titlenew += 'Outlook ';
  26. if (location.hostname.indexOf('outlook.office') > -1) titlenew += 'Office365 ';
  27. }
  28. }
  29. titlenew = titlenew.replace('- - ', '- ').trim();
  30. document.title = titlenew;
  31. }
  32. }
  33. function setMutationWatch(){
  34. MutOb = (window.MutationObserver) ? window.MutationObserver : window.WebKitMutationObserver;
  35. if (MutOb){
  36. chgMon = new MutOb(function(mutationSet){
  37. mutationSet.forEach(function(mutation){
  38. for (var i=0; i<mutation.addedNodes.length; i++){
  39. if (mutation.addedNodes[i].nodeType == 1){ // Ignore some common nodes
  40. if ('LINK|META|SCRIPT|STYLE'.indexOf(mutation.addedNodes[i].nodeName) < -1) cleanTitle();
  41. } else { // There are rare but critical
  42. cleanTitle();
  43. }
  44. }
  45. });
  46. });
  47. // attach chgMon to <head>
  48. opts = {childList: true, subtree: true, attributes: false, characterData: false};
  49. chgMon.observe(document.getElementsByTagName('head')[0], opts);
  50. }
  51. }
  52. cleanTitle();
  53. setMutationWatch();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址