Greasy Fork

Greasy Fork is available in English.

隐藏Outlook广告

隐藏Outlook网页端的各种内嵌广告

当前为 2018-03-10 提交的版本,查看 最新版本

// ==UserScript==
// @name              Hide Outlook ads
// @name:zh-CN        隐藏Outlook广告
// @namespace         http://greasyfork.icu/zh-CN/users/42351
// @require           https://code.jquery.com/jquery-3.2.1.min.js
// @version           1.1
// @description       Hide embedded ads in Outlook
// @description:zh-CN 隐藏Outlook网页端的各种内嵌广告
// @author            Antecer
// @match             https://outlook.live.com/*
// @grant             none
// @compatible        chrome 测试通过
// @compatible        firefox 未测试
// @compatible        opera 未测试
// @compatible        safari 未测试
// ==/UserScript==

// outlook标准版广告屏蔽css
var cssNomal = [
    '<style>',
    '._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;}', //隐藏收件箱>其他选项卡的内嵌广告
    '</style>'
].join("\r\n");
// outlook测试版广告屏蔽css
var cssBeta = [
    '<style>',
    '#app>div>div:last-child>div>div:first-child>div:last-child {display: none !important;}', //隐藏右侧广告
    '#app>div>div:last-child>div>div>div:first-child>div>div:last-child>:last-child {display: none !important;}', //隐藏订阅outlook广告
    'div[role=listbox]>div>div>div:first-child {display: none !important;}', //隐藏收件箱>其他选项卡的内嵌广告
    '#app>div>div:last-child>div>div:last-child {display: none !important;}', //隐藏底部MSN广告
    '</style>'
].join("\r\n");
// 执行css规则
jQuery.noConflict();
(function($){ $(function(){
    if($('img').length > 0)
    {
        $("head:first").append(cssNomal);
    }
    else
    {
        $("head:first").append(cssBeta);
    }
});})(jQuery);