Google-Style Bing + AdBlock

Bing 검색 결과를 Google 스타일로 바꾸고, 광고를 차단합니다

目前为 2025-02-26 提交的版本。查看 最新版本

// ==UserScript==
// @name         Google-Style Bing + AdBlock
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Bing 검색 결과를 Google 스타일로 바꾸고, 광고를 차단합니다
// @author       lanpod
// @match        *://www.bing.com/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 기본 스타일 적용
    GM_addStyle(`
        /* 일반 검색 결과 링크 */
        #b_results>li a, h2 a,
        /* 뉴스 및 기타 검색 결과 */
        .b_algo a, .b_algo h2 a, 
        .b_caption a, .b_vList a,
        .news-card a, .b_ans a {
            font-weight: normal !important;
            color: #1a0dab !important; /* Google blue */
        }

        /* 방문한 링크 강제 적용 */
        a:visited, 
        #b_results>li a:visited,
        .b_algo a:visited, 
        .b_caption a:visited, 
        .b_vList a:visited,
        .news-card a:visited, 
        .b_ans a:visited {
            color: #660099 !important; /* Google purple */
        }
    `);

    // 방문한 링크 색상을 강제 업데이트하는 함수
    function fixVisitedLinks() {
        document.querySelectorAll("a").forEach(link => {
            if (link.href && link.href.includes("http")) {
                link.style.color = link.matches(":visited") ? "#660099" : "#1a0dab";
            }
        });
    }

    // 페이지 로드 후 한 번 실행
    fixVisitedLinks();

    // 동적으로 추가되는 링크에 대해서도 적용
    const observer = new MutationObserver(() => {
        fixVisitedLinks();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // JavaScript를 이용한 광고 제거
    function removeAds() {
        document.querySelectorAll('.b_ad').forEach(ad => ad.remove());
    }

    // 처음 실행 시 광고 제거
    removeAds();

    // 동적 광고 제거 (MutationObserver 활용)
    const adObserver = new MutationObserver(() => {
        removeAds();
    });

    adObserver.observe(document.body, { childList: true, subtree: true });

})();