// ==UserScript== // @name 国际网站伪装为国内网站(汇总) // @namespace userElaina // @version 2023.03.08.3 // @description 中国人就用中国网站 // @author userElaina // @license MIT // @match *://*.google.com // @match *://*.google.com/search* // @match *://*.google.com.hk // @match *://*.google.com.hk/search* // @match *://*.youtube.com/* // @match *://*.wikipedia.org/* // @match *://*.github.com/* // @match *://*.steampowered.com/* // @match *://*.steamcommunity.com/* // @grant none // @downloadURL none // ==/UserScript== (function () { if (document.domain.search('google') != -1) { var link = document.querySelector("link[rel*='icon']") || document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; link.href = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/baidu.ico'; document.getElementsByTagName('head')[0].appendChild(link); var searchStyle = document.getElementsByClassName('RNNXgb')[0].style; searchStyle.boxShadow = "0 0 0 0"; searchStyle.border = 0; searchStyle.borderRadius = 0; searchStyle.background = '#4e6ef21f'; if (window.location.href.indexOf("/search") > -1) { var logo = document.getElementById("logo"); var logoArr; if (logo === null) { logoArr = document.getElementsByClassName("logo"); if (logoArr.length > 0) { logo = logoArr[0]; } } if (logo === null) { logoArr = document.getElementsByClassName("logocont"); if (logoArr.length > 0) { logo = logoArr[0]; } } if (logo === null) { console.log("oops, pls wait for update"); } else { var imgSize = getImgSize(logo); logo.innerHTML = 'Baidu'; document.title = document.title.replace(/\s-[\s\S]*/g, " - 百度搜索"); } document.querySelectorAll("a h3").forEach(a => { a.style.color = "#0000cc"; }); document.querySelectorAll("span.st").forEach(a => { a.style.color = "#333333"; }); document.querySelectorAll("em, .rbt b, .c b, .fl b").forEach(a => { a.style.color = "#CC0000"; }); var Tg7LZd = document.getElementsByClassName('Tg7LZd')[0]; var height = Tg7LZd.clientHeight; Tg7LZd.innerHTML = ''; var naviImageUrl = "https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/icons.png"; var navTabSpans = document.getElementsByClassName("SJajHc"); for (var i = 0; i < navTabSpans.length; i++) { navTabSpans[i].style.width = "22px"; if (i === 0) { navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px'; } else if (i == navTabSpans.length - 1) { navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px'; } else if (navTabSpans[i].classList.contains("NVbCr")) { navTabSpans[i].style.background = i % 2 == 1 ? 'url("' + naviImageUrl + '") no-repeat -144px -288px' : 'url("' + naviImageUrl + '") no-repeat -144px -282px'; } else { navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat -96px -288px'; } } } else { let bannerLogo = document.querySelector("[alt=Google]"); bannerLogo.src = "https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/bd_logo1.png"; bannerLogo.removeAttribute("srcset"); bannerLogo.width = 270; bannerLogo.height = 129; let paddingTop = bannerLogo.style.paddingTop.replace("px", ""); let paddingTopInt = parseInt(paddingTop); bannerLogo.style.paddingTop = (paddingTopInt - 20) + "px"; document.title = "百度一下, 你就知道"; document.querySelectorAll('a.gb_d, a.gb_p').forEach(v => { if (v.dataset.pid === '2') { v.innerText = '百度识图'; } else if (v.dataset.pid === '23') { v.innerHTML = '百度邮箱'; } }); document.getElementsByName("btnK").forEach(v => { v.value = "百度搜索"; }); var footnote = document.getElementById("SIvCob"); if (footnote !== null) { footnote.innerHTML = '百度提供: ' + footnote.innerHTML.slice(footnote.innerHTML.indexOf('<')); } /* document.getElementsByClassName("Fx4vi").forEach(v =>{ v.innerHTML = v.innerHTML.replace(/Google\s?/, "百度"); }); */ } function getImgSize(elLogo) { var elImg = elLogo.querySelector("img"); if (elImg === null) { return { height: 30, width: 92 } } else { return { height: elImg.height, width: elImg.width } } } } else if (document.domain.search('youtube') != -1) { function sleep(time) { return new Promise((resolve) => setTimeout(resolve, time)); } var spl = window.location.href.split('/'); if (spl.length < 4 || (spl.length == 4 && spl[3].length == 0)) { document.title = "哔哩哔哩 (゜-゜)つロ 干杯~-bilibili"; } else { sleep(1000).then(() => { document.title = document.title.replace(/\s-\sYouTube*/g, " - 哔哩哔哩"); }); } sleep(1000).then(() => { document.querySelector('link[rel="icon"]').href = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/youtube/bilibili.ico'; var a = document.querySelector('div.yt-spec-icon-badge-shape__badge'); if (a != null) { a.style.backgroundColor = '#00aeec'; } /* // for youtube old version var subButton = document.querySelector('tp-yt-paper-button.style-scope.ytd-subscribe-button-renderer'); if (subButton.getAttribute('subscribed') === null) { subButton.innerText = '关注'; subButton.style.color = '#ffffff'; subButton.style.backgroundColor = '#00aeec'; } else { subButton.innerText = '已关注'; subButton.style.color = '#606060'; subButton.style.backgroundColor = '#e9e9e9'; } */ var b_style = document.createElement("style"); document.head.appendChild(b_style); var b_sheet = b_style.sheet; var s0 = ''; var s1 = 'background-color: #00aeec'; function changeColor(s0) { b_sheet.addRule(s0, s1); b_sheet.insertRule(s0 + ' { ' + s1 + ' }', 0); } // button.ytp-button.ytp-settings-button.ytp-hd-quality-badge::after changeColor('.ytp-settings-button.ytp-hd-quality-badge:after, .ytp-settings-button.ytp-hdr-quality-badge:after, .ytp-settings-button.ytp-4k-quality-badge:after, .ytp-settings-button.ytp-5k-quality-badge:after, .ytp-settings-button.ytp-8k-quality-badge:after, .ytp-settings-button.ytp-3d-badge-grey:after, .ytp-settings-button.ytp-3d-badge:after'); // button.ytp-subtitles-button.ytp-button::after changeColor('.ytp-chrome-controls .ytp-button[aria-pressed]:after'); /* document.querySelectorAll('div.ytp-play-progress.ytp-swatch-background-color').forEach(v => { v.style.backgroundColor = '#00aeec'; }); document.querySelector('div.ytp-scrubber-button.ytp-swatch-background-color').style.backgroundColor = '#00aeec'; */ changeColor('.ytp-swatch-background-color'); /* setInterval(() => { document.querySelectorAll('[id=progress]').forEach(v => { v.style.backgroundColor = '#00aeec'; }); }, 1000); */ changeColor('#progress.ytd-thumbnail-overlay-resume-playback-renderer'); }); document.getElementById("logo-icon").innerHTML = ''; } else if (document.domain.search('wikipedia.org') != -1) { document.querySelector('link[rel="icon"]').href = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/wikipedia/baidu.ico'; document.title = document.title.replace(/\s-[\s\S]*/g, " - 百度百科"); document.querySelector('input.vector-search-box-input').placeholder = '搜索百度百科'; document.getElementById("siteSub").innerText = '百度百科, 全球领先的中文百科全书!'; var wk_bigLogo = document.querySelector('a.mw-wiki-logo'); if (wk_bigLogo != null) { wk_bigLogo.innerHTML = ''; wk_bigLogo.className = ''; } wk_bigLogo = document.querySelector('a.mw-logo'); if (wk_bigLogo != null) { wk_bigLogo.innerHTML = ''; wk_bigLogo.className = ''; } } else if (document.domain.search('github') != -1) { document.querySelector('link[rel="icon"]').href = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/github/gitee.ico'; if (document.title.startsWith('GitHub')) { document.title = document.title.slice(6); if (document.title == '') { document.title = '- 基于 Git 的代码托管和研发协作平台'; } } else { document.title = '- ' + document.title; } document.title = 'Gitee ' + document.title; var gh_bigLogo = document.querySelector('a[class="Header-link"]'); var gh_height = gh_bigLogo.clientHeight; gh_bigLogo.innerHTML = ''; } else if (document.domain.search('steam') != -1) { document.title = document.title.replace(' Steam', 'Steam').replace('Steam ', 'Steam').replace('Steam', '蒸汽平台'); document.getElementById("logo_holder").childNodes[1].childNodes[1].src = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/steam/logo.svg'; var st_giftcard = document.getElementsByClassName('home_page_gutter_giftcard'); if (st_giftcard.length > 0) { st_giftcard[0].height = 0; } } })();