Outlook Extend Panel

Extend right side panel of Outlook mail

目前為 2018-02-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Outlook Extend Panel
// @version     1.17
// @description Extend right side panel of Outlook mail
// @namespace   iFantz7E.OutlookExtendPanel
// @match       *://outlook.live.com/*
// @run-at      document-start
// @grant       GM_addStyle
// @icon        https://outlook.live.com/owa/favicon.ico
// @copyright	2014, 7-elephant
// ==/UserScript==

//// Compatibility: Firefox 14+ from Mutation Observer

// http://userscripts.org/scripts/show/293639
// https://greasyfork.org/scripts/9587-outlook-extend-panel

(function ()
{
	"use strict";
	// jshint multistr:true
	
function initStyle()
{
	GM_addStyle
	(" \
		/* OEP Modify CSS */ \
		._rp_g.scrollContainer { margin-left: 13px !important; } \
		.treeHeaderContainer .firstHeaderTreeNodeRow { padding-left: 15px !important; } \
		.ms-bgc-nlr .subfolders .nowrap { margin-left: -30px; } \
		 \
		/* OEP Modify CSS - Outlook new beta */ \
		div[tabindex='-1'] > div:nth-child(2) > .allowTextSelection { \
			margin-left: 0px; margin-right: 0px; } \
		div.false > div > div > div[tabindex='0'] > div:nth-child(3) { \
			display: none; } \
		#owaadbar0, .ms-FocusZone[role='menu'] { display: none; } \
		#app > :nth-child(1) > :nth-child(2) > :nth-child(1) > :nth-child(1) > :nth-child(4) { \
			display: none; } \
		div[style] > .ms-FocusZone[role='presentation'] { margin-left: -47px; } \
		span[title='Add to Favorites'] { display: none; } \
		 \
		/* OEP CSS */ \
		.oep_ExtendRight { right: 0px !important; } \
		.oep_ExtendBottom { bottom: 0px !important; } \
		.oep_Hidden { display: none !important; } \
	");
}

function attachOnLoad(callback)
{
	window.addEventListener("load", function (e) 
	{
		callback();
	});
}

function attachOnReady(callback) 
{
	document.addEventListener("DOMContentLoaded", function (e) 
	{
		callback();
	});
}

function ready()
{	
	if (window !== window.parent)
		return;
	
	// Auto click sign in
	setTimeout(function()
	{
		var eleBtn = document.querySelector(".landing .headerHero .buttonLargeBlue");
		if (eleBtn)
		{
			if (eleBtn.textContent.trim() === "Sign in")
			{
				eleBtn.click();
			}
		}
	}, 3000);
	
	var actionComplete = false;
	var actionRemoveRightPanel = false;
	var actionRemoveModulePanel = false;
	
	var obTarget_main = document.body;
	if (obTarget_main)
	{
		var obTm = -1;
		var obFunction = function(mutation)
		{
			clearTimeout(obTm);
			obTm = setTimeout(function()
			{
				if (!actionComplete)
				{
					var eleTarget = null;
					
					if (!actionRemoveRightPanel)
					{
						eleTarget = document.querySelector("#GoToNextRegion");
						if (eleTarget)
						{
							eleTarget.nextElementSibling.classList.add("oep_ExtendRight");
							eleTarget.previousElementSibling.classList.add("oep_Hidden");
							actionRemoveRightPanel = true;
						}
						else
						{
							// Outlook new beta
							eleTarget = document.querySelector("#owaadbar0");
							if (eleTarget)
							{
								eleTarget.parentElement.classList.add("oep_Hidden");
								actionRemoveRightPanel = true;
								actionRemoveModulePanel = true;
							}
						}
					}
					
					if (!actionRemoveModulePanel)
					{
						eleTarget = document.querySelector("div[aria-label='Module switcher']");
						if (eleTarget)
						{
							eleTarget.parentElement.classList.add("oep_Hidden");
							eleTarget.parentElement.previousElementSibling.classList.add("oep_ExtendBottom");
							actionRemoveModulePanel = true;
						}
					}
					
					if (actionRemoveRightPanel && actionRemoveModulePanel)
					{
						obMu_main.disconnect();
						actionComplete = true;
					}
				}
			}, 200);
		};
		
		var obMu_main = new MutationObserver(function(mutations)
		{
			mutations.forEach(obFunction);
		});
		
		var obConfig_main = { childList: true, subtree: true };
		obMu_main.observe(obTarget_main, obConfig_main);
	}	
}

attachOnReady(initStyle);
attachOnReady(ready);

})();

// End