perf: 增加gg proxy

pull/180/head
xiaojunnuo 2020-11-29 01:16:00 +08:00
parent 806ac046a9
commit fe57640317
5 changed files with 36 additions and 1 deletions

View File

@ -98,7 +98,13 @@ module.exports = {
'.*': { proxy: 'google-themes.proxy.ustclug.org' }
},
'www.google.com': {
'/recaptcha/.*': { proxy: 'www.recaptcha.net' }
'/recaptcha/.*': { proxy: 'www.recaptcha.net' },
'.*': {
proxy: 'gg.docmirror.top/_yxorp',
script: [
'google'
]
}
},
'fonts.gstatic.com': {
'.*': {

View File

@ -0,0 +1,20 @@
// ==UserScript==
// @name google增强
// @version 1.2.4
// @author Greper
// @description 去除ping链接
// @match https://www.google.com/*/*
// @icon https://www.google.com/favicon.ico
// @license GPL-3.0 License
// @run-at document-end
// @namespace
// ==/UserScript==
(function () {
console.log('google script loaded')
const aList = document.getElementsByTagName('a')
for (let i = 0; i <= aList.length; i++) {
console.log(aList[i].href)
aList[i].ping = undefined
}
})()

View File

@ -36,3 +36,10 @@
.md-mb-10{margin-bottom: 10px;}
.md-mb-15{margin-bottom: 15px;}
.md-mb-20{margin-bottom: 20px;}
ol{
margin-block-start: 0em;
margin-block-end: 0em;
padding-inline-start: 20px;
}

View File

@ -71,6 +71,7 @@ const api = {
load (rootDir) {
scripts = {}
scripts.github = loadScript(readFile(rootDir, 'github.script'))
scripts.google = loadScript(readFile(rootDir, 'google.js'))
scripts.jquery = { script: readFile(rootDir, 'jquery.min.js') }
scripts.global = { script: readFile(rootDir, 'global.script') }
return scripts

View File

@ -48,6 +48,7 @@ function injectScriptIntoHtml (tags, chunk, script) {
if (index < 0) {
continue
}
console.log('insert script:', tag)
const scriptBuf = Buffer.from(script)
const chunkNew = Buffer.alloc(chunk.length + scriptBuf.length)
chunk.copy(chunkNew, 0, 0, index)