Greasy Fork is available in English.

Hide Outlook ads

Hide embedded ads in Outlook

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name              Hide Outlook ads
// @name:zh-CN        隐藏Outlook广告
// @namespace         https://greasyfork.org/zh-CN/users/42351
// @version           1.9
// @description       Hide embedded ads in Outlook
// @description:zh-CN 隐藏Outlook网页端的各种内嵌广告
// @icon64            https://antecer.gitlab.io/amusingdevice/icon/antecer.ico
// @icon              https://antecer.gitlab.io/amusingdevice/icon/antecer.ico
// @author            Antecer
// @include           http*://outlook.live.com/*
// @run-at            document-body
// @grant             none
// @compatible        chrome 测试通过
// @compatible        firefox 测试通过
// @compatible        opera 未测试
// @compatible        safari 未测试
// ==/UserScript==
// outlook标准版广告屏蔽规则
var cssNomal = [
    '._n_h{display: none !important;}', //隐藏右侧广告
    '#primaryContainer > div{right: 0px !important; bottom:0 !important;}', //消除上一条广告的占位
    '._n_15{display: none !important;}', //隐藏"升级到 Premium"按钮
    '._n_05{bottom: 40px !important;}', //消除上一条广告的占位
    'div[style*="height: 40px"][style*="bottom: 0px"]{display: none !important;}', //隐藏底部的推荐Edge广告
    'div[style*="top: 40px"] > div > div { bottom:0 !important;}', //消除上一条广告的占位
    '[role=listbox]>div>div>div>[style] {display: none !important;}', //隐藏收件箱>其他选项卡的内嵌广告
].join("\r\n");
// outlook测试版广告屏蔽规则
var cssBeta = [
    '#app>div>div:last-child>div>div:first-child>div:last-child {display: none !important;}', //隐藏右侧广告
    '[data-focuszone-id=FocusZone8]~div:not([role]) {display: none !important;}', //隐藏订阅outlook广告
    '._1i5KvAsU83Sr-2zY9weMMY {display: none !important;}', //隐藏收件箱>其他选项卡的内嵌广告
].join("\r\n");
// 创建CSS规则节点
function addStyle(css) {
    var node = document.createElement('style');
    node.type = 'text/css';
    node.id = 'blockAD';
    node.appendChild(document.createTextNode(css));
    document.querySelector('body').appendChild(node);
}
// 注入CSS规则节点
if(window.location.pathname.indexOf('mail') === 1){
    addStyle(cssBeta);
}
else if(window.location.pathname.indexOf('owa') === 1){
    addStyle(cssNomal);
}
else{
    window.location.hash = '缺少该页面的广告过滤规则!';
}