Google-Style Bing + AdBlock

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

Versione datata 26/02/2025. Vedi la nuova versione l'ultima versione.

// ==UserScript==
// @name         Google-Style Bing + AdBlock
// @namespace    http://tampermonkey.net/
// @version      1.3
// @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 applyVisitedColor() {
        // 모든 링크를 찾아서 방문 여부에 맞는 색상 적용
        document.querySelectorAll('a').forEach(link => {
            if (link.href && link.href.startsWith('http')) {
                if (link.matches(':visited')) {
                    link.style.color = '#660099'; // 방문한 링크는 보라색
                } else {
                    link.style.color = '#1a0dab'; // 방문하지 않은 링크는 파란색
                }
            }
        });
    }

    // 페이지 로드 후 적용
    applyVisitedColor();

    // MutationObserver를 통해 동적 변경된 링크에 적용
    const observer = new MutationObserver(() => {
        applyVisitedColor();
    });

    // body 내부의 모든 자식 요소가 변경될 때마다 색상 적용
    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 });

})();