您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
-
当前为
// ==UserScript== // @name:ko 구글 무한스크롤과 파비콘 // @name Google Infinite scroll and Favicon // @name:jp Google無限スクロールおよびFavicon // @name:zh-TW Google无限滚动和Favicon // @name:zh-CN Google無限滾動和Favicon // @description:ko - // @description - // @description:jp - // @description:zh-TW - // @description:zh-CN - // @namespace https://ndaesik.tistory.com/ // @version 2022.04.23.23:40 // @author ndaesik // @icon https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://www.google.com // @include https://www.google.com/search* // ==/UserScript== document.querySelector(`#xjs`).style.visibility = `hidden`; document.querySelector(`#xjs`).parentElement.style.height = `0` for (let i = 0; i < document.querySelectorAll(`cite`).length; ++i) { let lnk = document.querySelector(`#center_col>[role="main"]`).querySelectorAll(`cite`)[i], txt = lnk.textContent, url = txt.match(/\./g) ? (txt.match(/\/\//g) ? txt.match(/(?<=\/\/)[^\s]*/g) : txt.match(/^[^\s]*/g)) : null, fav = url ? `/s2/favicons?domain=` + url : `` if (url) { let img = document.createElement(`div`) img.style.cssText = `background-image:url("`+ fav +`"); width:16px; height:16px; display:inline-block; margin-right:6px`; lnk.prepend(img) lnk.style.cssText = `display:inline-block` } } let numb = 1, func = () => { let next = new URL((document.querySelector(`#xjs a:first-child`).href).replace(/(?<=start=)(.*?)(?=\&)/g,numb * 10)); fetch(next.href) .then(response => response.text()) .then(text => { let html = (new DOMParser()).parseFromString(text, `text/html`), cont = html.documentElement.querySelector(`#center_col > [role="main"]`), addC = document.createElement(`div`); for (let i = 0; cont.querySelectorAll(`#center_col > [role="main"] #rso > div:not(.g)`).length; ++i) { cont.querySelectorAll(`#center_col > [role="main"] #rso > div:not(.g)`)[i].remove() } for (let i = 0; i < html.querySelectorAll(`cite`).length; ++i) { let lnk = html.querySelector(`#center_col>[role="main"]`).querySelectorAll(`cite`)[i], txt = lnk.textContent, url = txt.match(/\./g) ? (txt.match(/\/\//g) ? txt.match(/(?<=\/\/)[^\s]*/g) : txt.match(/^[^\s]*/g)) : null, fav = url ? `/s2/favicons?domain=` + url : `` if (url) { let img = html.createElement(`div`) img.style.cssText = `background-image:url("`+ fav +`"); width:16px; height:16px; display:inline-block; margin-right:6px`; lnk.prepend(img) lnk.style.cssText = `display:inline-block` } } (html.querySelector(`.g`)) ? (addC.appendChild(cont), document.querySelector(`#center_col > [role='main']`).parentElement.appendChild(cont)) : null }) } document.addEventListener(`scroll`, () => { if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight - 2) { func() numb = numb + 1 } })