您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
清理新版巴哈姆特的广告、扩宽首页显示区域、移除页脚与浮动区块
当前为
// ==UserScript== // @name New Bahamut Cleaner & Homepage Content Widening // @name:zh-TW 新版巴哈姆特清爽化 & 擴寬首頁顯示區域 // @name:zh-CN 新版巴哈姆特清爽化 & 扩宽首页显示区域 // @namespace https://www.tampermonkey.net/ // @version 1.7 // @description Cleans up ads on the new version of Bahamut, widens the homepage content area, and removes the footer and floating elements. // @description:zh-TW 清理新版巴哈姆特的廣告、擴寬首頁顯示區域、移除頁腳與浮動區塊 // @description:zh-CN 清理新版巴哈姆特的广告、扩宽首页显示区域、移除页脚与浮动区块 // @author ChatGPT // @match https://www.gamer.com.tw/* // @match https://gnn.gamer.com.tw/* // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; // ===== 首頁區模組 ===== const cleanBahaAds = () => { const bannerImg = document.querySelector('#adunit img[alt="超級看板廣告"]'); if (bannerImg) { const adContainer = bannerImg.closest('div.GoogleActiveViewElement'); if (adContainer) adContainer.remove(); } const gapContainer = document.querySelector('#billboardAd.BH-banner--lg'); if (gapContainer) gapContainer.remove(); const rightAdItems = document.querySelectorAll('.main-container__right .BH-banner__item'); rightAdItems.forEach(item => item.remove()); const bannerRow = document.querySelector('.main-container__right .BH-banner__row'); if (bannerRow) { bannerRow.style.minHeight = '0'; bannerRow.style.padding = '0'; bannerRow.style.margin = '0'; } const fuliSection = document.querySelector('div.main-container__right > section.index-fuli'); if (fuliSection) fuliSection.remove(); const fixedRightLinks = document.querySelectorAll('div.fixed-right div.column a.fixed-right__link'); fixedRightLinks.forEach(link => link.remove()); const mainRow = document.querySelector('main.main-container__row'); if (mainRow) { mainRow.style.width = '126%'; mainRow.style.margin = '0 auto'; } const mainContent = document.querySelector('.main-index__content'); if (mainContent) { mainContent.style.width = '100%'; mainContent.style.maxWidth = '1350px'; } const postPanel = document.querySelector('#postPanel.section-index'); if (postPanel) { const adWrappers = postPanel.querySelectorAll('.ad__wrapper'); adWrappers.forEach(ad => { if (ad.parentElement?.children.length > 1) { ad.style.display = 'none'; } }); } if (!document.querySelector('div.pswp')) { const pswp = document.createElement('div'); pswp.className = 'pswp'; document.body.appendChild(pswp); } const footer = document.querySelector('footer.main-container__footer'); if (footer) footer.remove(); }; // ===== 新聞區模組 ===== const cleanGNN = () => { const shop = document.querySelector('div#shop.lazyloaded'); if (shop) shop.remove(); const banner4gamer = document.querySelector('div#banner-4gamer'); if (banner4gamer) banner4gamer.remove(); const gptBanner = document.querySelector('div#div-gpt-ad-banner'); if (gptBanner) gptBanner.remove(); const googleImageDiv = document.querySelector('div#google_image_div.GoogleActiveViewElement'); if (googleImageDiv) googleImageDiv.remove(); const flySalve = document.querySelector('div#flySalve'); if (flySalve) flySalve.remove(); const bhSlave = document.querySelector('div#BH-slave'); if (bhSlave) bhSlave.remove(); const bhWrapper = document.querySelector('div#BH-wrapper'); if (bhWrapper) { bhWrapper.style.maxWidth = '100%'; } const bhMaster = document.querySelector('div#BH-master'); if (bhMaster) { bhMaster.style.width = 'calc(100%)'; } const gnTopimg = document.querySelector('div#BH-master div.GN-topimg'); if (gnTopimg) { gnTopimg.style.width = '100%'; } }; // ===== 執行首區模組 ===== setTimeout(() => cleanBahaAds(), 500); const mainContent = document.querySelector('.main-index__content'); if (mainContent) { let debounceTimer1 = null; const observer1 = new MutationObserver(() => { clearTimeout(debounceTimer1); debounceTimer1 = setTimeout(() => cleanBahaAds(), 200); }); observer1.observe(mainContent, { childList: true, subtree: true }); } // ===== 執行新聞區模組 ===== setTimeout(() => cleanGNN(), 500); const bhWrapper = document.querySelector('div#BH-wrapper'); if (bhWrapper) { let debounceTimer2 = null; const observer2 = new MutationObserver(() => { clearTimeout(debounceTimer2); debounceTimer2 = setTimeout(() => cleanGNN(), 300); }); observer2.observe(bhWrapper, { childList: true, subtree: true }); } })();