Skip to content

Instantly share code, notes, and snippets.

@fortserious
Last active March 3, 2025 11:50
Show Gist options
  • Save fortserious/aee38888a9c672c27682fa43940588fa to your computer and use it in GitHub Desktop.
Save fortserious/aee38888a9c672c27682fa43940588fa to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name outlook quick actions hotfix
// @namespace www.rossdoran.com
// @version 1.10
// @description m$.gfy
// @match https://outlook.office.com/mail/*
// @match https://outlook.live.com/*
// @require https://gist.githubusercontent.com/mjblay/18d34d861e981b7785e407c3b443b99b/raw/debc0e6d4d537ac228d1d71f44b1162979a5278c/waitForKeyElements.js
// @run-at document-start
// ==/UserScript==
// when updating this script - search for ".hDNlA.lHRXq.iZbPU.JCRRb.G1NES"
waitForKeyElements (".WP8_u .UWVIR", moveQuickActions);
waitForKeyElements(".gReZN", moveDeleteAction); // comment out this line to keep the delete quick action on the right
function navigateToInbox(elem)
{
elem.onclick = ()=> { document.querySelector("button[aria-label='Close']").click(); };
}
function detach(node) {
return node.parentElement.removeChild(node);
}
function moveDeleteAction(elem)
{
let parent = elem.closest(`.hDNlA.lHRXq.iZbPU.JCRRb.G1NES,
.hDNlA.lHRXq.IjQyD.JCRRb.G1NES,
.hDNlA.lHRXq.epBmH.IMyk_,
.zKDWD.YbB6r.IKvQi.IjQyD.JCRRb.cSOXK.G1NES,
.zKDWD.YbB6r.IKvQi.IjQyD.JCRRb.G1NES,
.zKDWD.YbB6r.IKvQi.iZbPU.JCRRb.G1NES,
.zKDWD.YbB6r.IKvQi.iZbPU.wZij3.G1NES,
.zKDWD.YbB6r.IKvQi.IjQyD.EhiOs.wZij3.G1NES,
.zKDWD.YbB6r.IKvQi.epBmH.EhiOs,
.zKDWD.IKvQi.IjQyD.JCRRb.G1NES,
.zKDWD.IKvQi.iZbPU.JCRRb._KLsp.G1NES,
.zKDWD.IKvQi.iZbPU.JCRRb.G1NES,
.zKDWD.IKvQi.gPZmZ.JCRRb.G1NES,
.zKDWD.IKvQi.epBmH,
.lHRXq.hDNlA.IjQyD.JCRRb.DLvHz.G1NES,
.lHRXq.hDNlA.IjQyD.JCRRb.G1NES,
.lHRXq.hDNlA.gPZmZ.JCRRb.G1NES
`); // different for pinned, flagged, returning to inbox after deleting, etc.
if (parent)
{
console.log("TRASHFIND", parent);
var newParent = parent.querySelector(`
.XG5Jd.y1E5h.zItCb,
.XG5Jd.hQj7T,
.OD8Ue.hQj7T,
.xc0ZS.hQj7T
`).firstChild;
if (newParent)
{
newParent.append(detach(elem));
}
}
}
function moveQuickActions(elem)
{
let parent = elem.closest(
`.XG5Jd.y1E5h.zItCb,
.XG5Jd.hQj7T,
.xc0ZS.hQj7T,
.OD8Ue.hQj7T`); // parent element of left items
if (parent)
{
var newParent = parent.firstChild; // append to first child of left item parent
if (newParent)
{
newParent.append(detach(elem));
}
}
}
@Peppins32
Copy link

Thanks a lot, it work! ;-)

@NinjaDuckie
Copy link

Thanks again for this Ross.

@Peppins32
Copy link

It's changed again and then doesn't work again, thanks microsoft uff :/

@fortserious
Copy link
Author

fortserious commented Feb 12, 2025

Updated 1.9 which fixes the delete icon, sorry for the delay.

Edit: And patched to 1.10 to fix delete icons on pinned messages as well.

@Peppins32
Copy link

Thanks a lot!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment