🏠 Home 

Greasy Fork is available in English.

网易美化

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

  1. // ==UserScript==
  2. // @name 网易美化
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4.1
  5. // @description 隐藏网易邮箱广告,隐藏网易新闻推荐、新闻内容居中显示
  6. // @author AN drew
  7. // @match *://*.163.com/*
  8. // @match *://*.126.com/*
  9. // @match *://*.yeah.net/*
  10. // @exclude https://music.163.com
  11. // @run-at document-start
  12. // @grant GM_addStyle
  13. // ==/UserScript==
  14. (function() {
  15. 'use strict';
  16. if(window.location.host=='dy.163.com' || window.location.href.indexOf('www.163.com/news') > -1)
  17. {
  18. //内容居中
  19. GM_addStyle(`#contain{ display:flex; justify-content:center;}
  20. #container{display:flex; justify-content:center;}
  21. .post_columnad_top{ display: none!important;}
  22. .post_columnad_mid{ display: none!important;}
  23. .post_columnad_btm{ display: none!important;}
  24. /*.post_body{margin-left:-170px;}*/
  25. /*.post_statement{margin-left:-170px;}*/
  26. /*#tie{margin-left:-170px;}*/
  27. .post_content#content{padding-left:0px!important}`);
  28. setInterval(()=>{
  29. if(!$('.post_top').hasClass('post_top_fixed')) //分享按钮居左
  30. {
  31. $('.post_top').addClass('post_top_fixed');
  32. }
  33. $('.post_side').hide(); //隐藏侧边栏
  34. $('.newsapp-qrcode').hide(); //隐藏二维码
  35. $('.post_next').hide(); //隐藏下一篇
  36. $('.post_recommends').hide(); //隐藏推荐
  37. $('.ntes-nav-mobile-title').hide(); //隐藏移动端
  38. $('.ntes-nav-select-title-lofter').hide(); //隐藏严选
  39. $('.ntes-nav-select-title-money').hide(); //隐藏支付
  40. $('.ntes-nav-select-title-cart').hide(); //隐藏电商
  41. },1);
  42. }
  43. else
  44. {
  45. //隐藏网易广告
  46. GM_addStyle(`.gWel-bottom{ display: none!important;}
  47. .post_columnad_top{ display: none!important;}
  48. .post_columnad_mid{ display: none!important;}
  49. .post_columnad_btm{ display: none!important;}
  50. #module-float-ask-price {display: none!important;}
  51. .houseJrtt {display: none!important;}
  52. .commend-list {display: none!important;}
  53. .post_side {display: none!important;}
  54. .newsapp-qrcode {display: none!important;}
  55. .post_next {display: none!important;}
  56. .post_recommends {display: none!important;}
  57. #epContentRight {display: none!important;}
  58. .newsapp-qrcode {display: none!important;}
  59. #post_recommend {display: none!important;}
  60. .post_next_post_wrap {display: none!important;}
  61. .ntes-nav-mobile-title {display: none!important;}
  62. .ntes-nav-select-title-lofter {display: none!important;}
  63. .ntes-nav-select-title-money {display: none!important;}
  64. .ntes-nav-select-title-cart {display: none!important;}
  65. .gallery-tie-right {display: none!important;}
  66. .p-w-top {display: none!important;}
  67. .related_article {display: none!important;}
  68. .tN0.nui-closeable {display: none!important;}
  69. .tI0.txt-info {display: none!important;} `);
  70. if(window.location.href.indexOf('auto.163.com') > -1) //汽车频道
  71. {
  72. //内容居中
  73. GM_addStyle(`.post_main{ margin-left:170px;}`);
  74. }
  75. else
  76. {
  77. //内容居中
  78. GM_addStyle(`#contain{ display:flex; justify-content:center;}
  79. #container{display:flex; justify-content:center;}`);
  80. }
  81. if(window.location.href.indexOf('house.163.com') > -1) //房产频道
  82. {
  83. //评论居中
  84. GM_addStyle(`#post_comment_area{ margin-left:-170px;}`);
  85. }
  86. else if(window.location.href.indexOf('home.163.com') > -1) //家居频道
  87. {
  88. //内容居中、评论居中
  89. GM_addStyle(`.post_content#content{padding-left:0px!important}
  90. #post_comment_area{ margin-left:-170px;}`);
  91. }
  92. else
  93. {
  94. //内容居中
  95. GM_addStyle(`.post_content#content{padding-left:0px!important}`);
  96. }
  97. //内容居中、评论居中
  98. GM_addStyle(`.post_content.post_area{ display:flex; justify-content:center;}
  99. /*.post_body{margin-left:-170px;}*/
  100. /*.post_statement{margin-left:-170px;}*/
  101. /*#tie{margin-left:-170px;}*/
  102. ._xhi4tc4xf89 {display: none!important;}
  103. #endText{margin-left:-170px;}
  104. .gallery-tie-main{margin-right:0px;}`);
  105. if(window.location.href.indexOf('www.163.com/renjian') > -1)
  106. {
  107. GM_addStyle(`#endText{margin-left:0px;}`);
  108. }
  109. var parent = document.getElementById('epContentLeft');
  110. parent && parent.insertBefore(document.querySelector('.post_crumb'),parent.childNodes[0]); //移动目录树到epContentLeft
  111. if(document.querySelector('div.post_content.post_area.clearfix') && document.querySelector('div.post_content.post_area.clearfix').childNodes[3].className=='clearfix') //删除原先目录树所在clearfix
  112. {
  113. document.querySelector('div.post_content.post_area.clearfix').removeChild(document.querySelector('div.post_content.post_area.clearfix').childNodes[3])
  114. }
  115. setInterval(()=>{
  116. if(document.getElementsByClassName('post_topshare_wrap')[0] && document.getElementsByClassName('post_topshare_wrap')[0].className.indexOf('post_topshare_wrap_fixed') == -1) //分享按钮居左
  117. {
  118. document.getElementsByClassName('post_topshare_wrap')[0].className='post_topshare_wrap post_topshare_wrap_fixed';
  119. }
  120. if(document.querySelector('.post_top') && document.querySelector('.post_top').className.indexOf('post_top_fixed') == -1) //分享按钮居左
  121. {
  122. document.querySelector('.post_top').className='post_top post_top_fixed';
  123. }
  124. document.querySelector('.post_comment_toolbar.post_comment_toolbarfix') && (document.querySelector('.post_comment_toolbar.post_comment_toolbarfix').className='post_comment_toolbar'); //固定跟帖
  125. },1);
  126. }
  127. })();