Outlook Extend Panel

Extend right side panel of Outlook mail

Fra og med 15.06.2017. Se den nyeste version.

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

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

(function ()
{
	"use strict";
	// jshint multistr:true
	
function initStyle()
{
	GM_addStyle
	(" \
		/* STSH Modify CSS */ \
		._rp_g.scrollContainer { margin-left: 13px !important; } \
		.treeHeaderContainer .firstHeaderTreeNodeRow { padding-left: 15px !important; } \
		.ms-bgc-nlr .subfolders .nowrap { margin-left: -30px; } \
		.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()
{	
	var countExtend = 100;
	var tmExtend = setInterval(function()
	{
		var eleNext = document.querySelector("#GoToNextRegion");
		if (eleNext)
		{
			eleNext.nextElementSibling.classList.add("oep_ExtendRight");
			eleNext.previousElementSibling.classList.add("oep_Hidden");
			clearInterval(tmExtend);
		}
		if (countExtend-- < 0)
		{
			clearInterval(tmExtend);
		}
	}, 200);
	
	var countExtend2 = 100;
	var tmExtend2 = setInterval(function()
	{
		var eleSwitch = document.querySelector("div[aria-label='Module switcher']");
		if (eleSwitch)
		{
			eleSwitch.parentElement.classList.add("oep_Hidden");
			eleSwitch.parentElement.previousElementSibling.classList.add("oep_ExtendBottom");
			clearInterval(tmExtend2);
		}
		if (countExtend2-- < 0)
		{
			clearInterval(tmExtend2);
		}
	}, 200);
	
	setTimeout(function()
	{
		var eleBtn = document.querySelector(".landing .headerHero .buttonLargeBlue");
		if (eleBtn)
		{
			if (eleBtn.textContent.trim() === "Sign in")
			{
				// Auto click sign in
				eleBtn.click();
			}
		}
	}, 3000);
}

attachOnReady(initStyle);
attachOnReady(ready);

})();

// End