diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 14e18334..81da5029 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -1,6 +1,6 @@ import fs from 'fs' import path from 'path' -import { defineConfigWithTheme } from 'vitepress' +import { defineConfigWithTheme, type HeadConfig } from 'vitepress' import type { Config as ThemeConfig } from '@vue/theme' import baseConfig from '@vue/theme/config' import { headerPlugin } from './headerMdPlugin' @@ -577,6 +577,17 @@ export const sidebar: ThemeConfig['sidebar'] = { // const i18n: ThemeConfig['i18n'] = { // } +function inlineScript(file: string): HeadConfig { + return [ + 'script', + {}, + fs.readFileSync( + path.resolve(__dirname, `./inlined-scripts/${file}`), + 'utf-8' + ) + ] +} + export default defineConfigWithTheme({ extends: baseConfig, @@ -618,22 +629,8 @@ export default defineConfigWithTheme({ href: 'https://sponsors.vuejs.org' } ], - [ - 'script', - {}, - fs.readFileSync( - path.resolve(__dirname, './inlined-scripts/restorePreference.js'), - 'utf-8' - ) - ], - [ - 'script', - {}, - fs.readFileSync( - path.resolve(__dirname, './inlined-scripts/uwu.js'), - 'utf-8' - ) - ], + inlineScript('restorePreference.js'), + inlineScript('uwu.js'), [ 'script', { @@ -649,7 +646,8 @@ export default defineConfigWithTheme({ src: 'https://vueschool.io/banner.js?affiliate=vuejs&type=top', async: 'true' } - ] + ], + inlineScript('perfops.js') ], themeConfig: { diff --git a/.vitepress/inlined-scripts/perfops.js b/.vitepress/inlined-scripts/perfops.js new file mode 100644 index 00000000..381ff494 --- /dev/null +++ b/.vitepress/inlined-scripts/perfops.js @@ -0,0 +1,9 @@ +;((d) => { + window.rum = { key: 'a9efvfeu' } + var script = d.createElement('script') + script.src = '/rom3.min.js' + script.type = 'text/javascript' + script.defer = true + script.async = true + d.getElementsByTagName('head')[0].appendChild(script) +})(document) diff --git a/src/public/rom3.min.js b/src/public/rom3.min.js new file mode 100644 index 00000000..fa8b81b1 --- /dev/null +++ b/src/public/rom3.min.js @@ -0,0 +1 @@ +"use strict";function _slicedToArray(n,e){return _arrayWithHoles(n)||_iterableToArrayLimit(n,e)||_unsupportedIterableToArray(n,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(n,e){if(n){if("string"==typeof n)return _arrayLikeToArray(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(n,e):void 0}}function _arrayLikeToArray(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);tDate.now())return l.resolve(n.data);for(var o=[],e=0;eDate.now()?(n.config&&E(n.config),l.resolve(n.data)):S(t,{headers:{"X-Partner-Id":y||"perfops","X-Partner-Hostname":window.location.hostname||"unknown"}}).then(function(n){return JSON.parse(n.response)}).then(function(n){if(!n||!n.data)throw new Error("Empty response.data");return window.localStorage.setItem(e,JSON.stringify({data:n.data,config:n.config,expiry:Date.now()+r})),n.config&&E(n.config),n.data}).catch(function(){return[{id:17,cdnUrl:"https://edgecast-perfops.azureedge.net/500b-bench.jpg",p:0},{id:18,cdnUrl:"https://azure-perfops.azureedge.net/500b-bench.jpg",p:0},{id:89,cdnUrl:"https://25748s.ha.azioncdn.net/500b-az-bench.jpg",p:0},{id:93,cdnUrl:"https://staticperfops.cdn.hoy.sh/500b-bench.jpg",p:0},{id:96,cdnUrl:"https://cdn23602612.ahacdn.me/500b-bench.jpg",p:0},{id:100,cdnUrl:"https://pfps17ssl.cdnvideo.ru/500b-bench.jpg",p:0},{id:55,cdnUrl:"https://perfops.s.llnwi.net/500b-bench.jpg",p:1},{id:66,cdnUrl:"https://vodstreaming01.video.globo.com/500b-bench.jpg",p:0},{id:99,cdnUrl:"https://test-perfops.ecn.zenlayer.net/500b-bench.jpg",p:0},{id:85,cdnUrl:"https://proxy.canary.scrubbingcenter.com/test_image.png",p:0},{id:84,cdnUrl:"https://ultrawaf.canary.scrubbingcenter.com/test_image.png",p:0},{id:74,cdnUrl:"https://test-perfops.haproxy.com/500b-bench.jpg",p:0},{id:58,cdnUrl:"https://perfops-cds.s.llnwi.net/500b-bench.jpg",p:0},{id:72,cdnUrl:"https://rum.perfops.mdb.cdn.orange.com/500b-bench.jpg",p:0},{id:87,cdnUrl:"https://test-perfops.ldgslb.com/500b-bench.jpg",p:1},{id:20,cdnUrl:"https://cdnperf.cachefly.net/500b-bench.jpg",p:1},{id:9,cdnUrl:"https://1596384882.rsc.cdn77.org/500b-bench.jpg",p:1},{id:3,cdnUrl:"https://perfops.cloudflareperf.com/500b-cf-bench.jpg",p:1},{id:7,cdnUrl:"https://cpt96125.shopvoxpopulus.com/pics/500b-bench.jpg",p:1},{id:65,cdnUrl:"https://perfops.glbcdn.net/500b-bench.jpg",p:0},{id:40,cdnUrl:"https://perfops.swiftycdn.net/500b-sw-bench.jpg",p:0},{id:11,cdnUrl:"https://perfops1.b-cdn.net/500b-bunny-bench.jpg",p:1},{id:75,cdnUrl:"https://cdnperf-rum.quantil.com/500b-bench.jpg",p:0},{id:67,cdnUrl:"https://media-edge.1e100cdn.net/pics/500b-bench.jpg",p:0},{id:92,cdnUrl:"https://perfops.byte-test.com/500b-bench.jpg",p:1},{id:98,cdnUrl:"https://perfops2.byte-test.com/500b-bench.jpg",p:0},{id:77,cdnUrl:"https://cdnperf.qwilt.com/500b-bench.jpg",p:0},{id:97,cdnUrl:"https://medianova-cdnvperf.mncdn.com/500b-bench.jpg",p:0},{id:5,cdnUrl:"https://d3888oxgux3fey.cloudfront.net/500b-bench.jpg",p:1},{id:10,cdnUrl:"https://akamai-cdn.perfops.io/500b-bench.jpg",p:1},{id:12,cdnUrl:"https://cdn.jsdelivr.net/gh/jimaek/js-test@1.1/500b-bench.jpg",p:1},{id:83,cdnUrl:"https://medianova-cdnperf.mncdn.com/500b-bench.jpg",p:1},{id:2,cdnUrl:"https://ovh-cdn.perfops.io/500b-bench.jpg",p:1},{id:4,cdnUrl:"https://perfops-static.freetls.fastly.net/500b-bench.jpg",p:1},{id:8,cdnUrl:"https://perfops.gcorelabs.com/500b-bench.jpg",p:1},{id:76,cdnUrl:"https://img.perfops.net/500b-bench.jpg",p:0},{id:94,cdnUrl:"https://rum.perfops.cdb.cdn.orange.com/500b-bench.jpg",p:0},{id:35,cdnUrl:"https://cdn81795137.blazingcdn.net/500b-blz-bench.jpg",p:1},{id:15,cdnUrl:"https://cdnperf-rum.cdnetworks.net/500b-bench.jpg",p:1},{id:14,cdnUrl:"https://perfops.r.worldssl.net/500b-bench.jpg",p:1}]})})().then(function(n){var e={ua:navigator.userAgent,hostname:window.location.hostname,client:y,clientdns:c,platform:m,timeElapsed:0,sessionId:"",version:4},t=[];performance.clearResourceTimings();function r(){var n=t.splice(0,t.length);return function(n){var e=0,t=0;return n.forEach(function(n){n.up?2e3