Greasy Fork

Greasy Fork is available in English.

网易美化

隐藏网易邮箱广告,隐藏网易新闻推荐、新闻内容居中显示

当前为 2021-04-14 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         网易美化
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  隐藏网易邮箱广告,隐藏网易新闻推荐、新闻内容居中显示
// @author       AN drew
// @match        *://*.163.com/*
// @match        *://*.126.com/*
// @match        *://*.yeah.net/*
// @exclude      https://music.163.com
// @grant        none
// ==/UserScript==
 
(function() {
    'use strict';
 
    if(window.location.host=='dy.163.com' || window.location.href.indexOf('www.163.com/news') > -1)
    {
        $('#contain') && $('#contain').attr('style','display:flex; justify-content:center;'); //居中对齐
        $('#container') && $('#container').attr('style','display:flex; justify-content:center;'); //居中对齐
        $('.post_content') && $('.post_content').css('padding-left','0px'); //内容居中
        setInterval(()=>{
            if(!$('.post_top').hasClass('post_top_fixed')) //分享按钮居左
            {
                $('.post_top').addClass('post_top_fixed');
            }
 
            $('.post_side').hide(); //隐藏侧边栏
            $('.newsapp-qrcode').hide(); //隐藏二维码
            $('.post_next').hide(); //隐藏下一篇
            $('.post_recommends').hide(); //隐藏推荐
 
            $('.ntes-nav-mobile-title').hide(); //隐藏移动端
            $('.ntes-nav-select-title-lofter').hide(); //隐藏严选
            $('.ntes-nav-select-title-money').hide(); //隐藏支付
            $('.ntes-nav-select-title-cart').hide(); //隐藏电商
        },1);
    }
    else
    {
        //隐藏网易邮箱广告
        setInterval(function(){
            document.querySelector('.gWel-bottom') && (document.querySelector('.gWel-bottom').style.display='none');
        },100);
 
        if(window.location.href.indexOf('auto.163.com') > -1) //汽车频道
        {
            document.querySelector('.post_main') && (document.querySelector('.post_main').style.cssText='margin-left:170px;'); //内容居中
        }
        else
        {
            document.querySelector('#contain') && (document.querySelector('#contain').style.cssText='display:flex; justify-content:center;'); //居中对齐
            document.querySelector('#container') && (document.querySelector('#container').style.cssText='display:flex; justify-content:center;'); //居中对齐
        }
 
        if(window.location.href.indexOf('house.163.com') > -1) //房产频道
        {
            document.querySelector('#post_comment_area') && (document.querySelector('#post_comment_area').style.cssText='margin-left:-170px;'); //评论居中
        }
        else if(window.location.href.indexOf('home.163.com') > -1) //家居频道
        {
            document.querySelector('.post_content') && (document.querySelector('.post_content').style.cssText='padding-left:170px;'); //内容居中
            document.querySelector('#post_comment_area') && (document.querySelector('#post_comment_area').style.cssText='margin-left:-170px;'); //评论居中
        }
        else
        {
            document.querySelector('.post_content') && (document.querySelector('.post_content').style.cssText='padding-left:0px;'); //内容居中
        }
        document.querySelector('div.post_content.post_area.clearfix') && (document.querySelector('div.post_content.post_area.clearfix').style.cssText='display:flex; justify-content:center;'); //居中对齐
 
        var parent = document.getElementById('epContentLeft');
        parent && parent.insertBefore(document.querySelector('.post_crumb'),parent.childNodes[0]); //移动目录树到epContentLeft
 
        if(document.querySelector('div.post_content.post_area.clearfix') && document.querySelector('div.post_content.post_area.clearfix').childNodes[3].className=='clearfix') //删除原先目录树所在clearfix
        {
            document.querySelector('div.post_content.post_area.clearfix').removeChild(document.querySelector('div.post_content.post_area.clearfix').childNodes[3])
        }
 
        document.getElementById('endText') && (document.getElementById('endText').style.cssText='margin-left:-170px;'); //内容居中
        document.querySelector('.gallery-tie-main') && (document.querySelector('.gallery-tie-main').style.cssText='margin-right:0px;'); //评论居中
 
 
        setInterval(()=>{
            if(document.getElementsByClassName('post_topshare_wrap')[0] && document.getElementsByClassName('post_topshare_wrap')[0].className.indexOf('post_topshare_wrap_fixed') == -1) //分享按钮居左
            {
                document.getElementsByClassName('post_topshare_wrap')[0].className='post_topshare_wrap post_topshare_wrap_fixed';
            }
            if(document.querySelector('.post_top') && document.querySelector('.post_top').className.indexOf('post_top_fixed') == -1) //分享按钮居左
            {
                document.querySelector('.post_top').className='post_top post_top_fixed';
            }
 
            document.querySelector('#module-float-ask-price') && (document.querySelector('#module-float-ask-price').style.cssText='display:none;'); //隐藏车价广告
            document.querySelector('.houseJrtt') && (document.querySelector('.houseJrtt').style.cssText='display:none;'); //隐藏房产广告
            document.querySelector('.commend-list') && (document.querySelector('.commend-list').style.cssText='display:none;'); //隐藏楼盘广告
 
            document.querySelector('.post_side') && (document.querySelector('.post_side').style.cssText='display:none;'); //隐藏侧边栏
            document.querySelector('.post_comment_toolbar.post_comment_toolbarfix') && (document.querySelector('.post_comment_toolbar.post_comment_toolbarfix').className='post_comment_toolbar'); //固定跟帖
 
            document.querySelector('.newsapp-qrcode') && (document.querySelector('.newsapp-qrcode').style.cssText='display:none;'); //隐藏二维码
            document.querySelector('.post_next') && (document.querySelector('.post_next').style.cssText='display:none;'); //隐藏下一篇
            document.querySelector('.post_recommends') && (document.querySelector('.post_recommends').style.cssText='display:none;'); //隐藏推荐
 
            document.getElementById('epContentRight') && (document.getElementById('epContentRight').style.cssText='display:none;'); //隐藏侧边栏
            document.querySelector('.newsapp-qrcode') && (document.querySelector('.newsapp-qrcode').style.cssText='display:none;'); //隐藏二维码
            document.getElementById('post_recommend') && (document.getElementById('post_recommend').style.cssText='display:none;'); //隐藏推荐
            document.querySelector('.post_next_post_wrap') && (document.querySelector('.post_next_post_wrap').style.cssText='display:none;'); //隐藏下一篇
 
            document.querySelector('.ntes-nav-mobile-title') && (document.querySelector('.ntes-nav-mobile-title').style.cssText='display:none;'); //隐藏移动端
            document.querySelector('.ntes-nav-select-title-lofter') && (document.querySelector('.ntes-nav-select-title-lofter').style.cssText='display:none;'); //隐藏严选
            document.querySelector('.ntes-nav-select-title-money') && (document.querySelector('.ntes-nav-select-title-money').style.cssText='display:none;'); //隐藏支付
            document.querySelector('.ntes-nav-select-title-cart') && (document.querySelector('.ntes-nav-select-title-cart').style.cssText='display:none;'); //隐藏电商
 
            document.querySelector('.gallery-tie-right') && (document.querySelector('.gallery-tie-right').style.cssText='display:none;'); //隐藏花田广告
            document.querySelector('.p-w-top') && (document.querySelector('.p-w-top').style.cssText='display:none;'); //隐藏车型推荐
            document.querySelector('.related_article') && (document.querySelector('.related_article').style.cssText='display:none;'); //隐藏延伸阅读
 
        },1);
    }
})();