Greasy Fork

Greasy Fork is available in English.

网易新闻美化

隐藏新闻推荐,居中显示

当前为 2021-01-05 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         网易新闻美化
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  隐藏新闻推荐,居中显示
// @author       AN drew
// @match        https://*.163.com/*
// @exclude      https://music.163.com
// @exclude      https://mail.163.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if(window.location.host=='dy.163.com' || window.location.href.indexOf('www.163.com/dy/') > -1)
    {
        $('#contain') && $('#contain').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(); //隐藏推荐
            $('.show-all-tie').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
    {
        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('contain') && (document.getElementById('contain').style.cssText='display:flex; justify-content:center;'); //居中对齐
        document.querySelector('.post_content') && (document.querySelector('.post_content').style.cssText='padding-left:0px'); //内容居中

        document.querySelector('.post_main') && (document.querySelector('.post_main').style.cssText='margin-left:170px;'); //居中对齐
        document.getElementById('endText') && (document.getElementById('endText').style.cssText='margin-left:-170px;'); //内容居中

        setInterval(()=>{
            if(document.getElementsByClassName('post_top')[0] && document.getElementsByClassName('post_top')[0].className.indexOf('post_top_fixed') == -1) //分享按钮居左
            {
                document.getElementsByClassName('post_top')[0].className='post_top post_top_fixed';
            }

            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';
            }

            document.querySelector('.post_comment_toolbar.post_comment_toolbarfix') && (document.querySelector('.post_comment_toolbar.post_comment_toolbarfix').className='post_comment_toolbar'); //固定跟帖

            document.querySelector('.post_side') && (document.querySelector('.post_side').style.cssText='display:none;'); //隐藏侧边栏
            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.querySelector('.show-all-tie') && (document.querySelector('.show-all-tie').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;'); //隐藏电商
        },1);
    }
})();