返回列表 发布新帖
查看: 167|回复: 0

Linux Do的服务器炸了?提供解决方案

发表于 2025-3-29 09:58:21 | 查看全部 |阅读模式

立刻注册账号,享受更清爽的界面!

您需要 登录 才可以下载或查看,没有账号?注册

×
我以为我的梯子出了问题……就跟早上 cursor 炸了一样,我第一反应就是梯子炸了
结果Google都能打开,竟还以为我被💩簧给清退了,测了下 cdn.linux.do 竟是404
1fe760c2bdbc1f2ea38f20883c297f34.jpg
不过没有图片确实减少了不少需要加载显示的资源,而且论坛变快了。
折腾了下发现只是 cdn.linux.do 暂时寄了,但是旧链接没寄 (去掉 cdn. 直接请求会重定向)
执行前 ↓
b926807fccff1b812f3462d59ff249a8.jpg
执行后 ↓
6b191fa41e5ea4073661438b354159fc.jpg

话不多说,上教程!
方式①:
打开论坛后在地址栏输入 java(和谐,不然还是 403)script: 前缀然后把 ↓ 粘贴到后面,回车。
前缀是必须的,如果你回车后跳转到搜索引擎。。。就用 方式② 吧。
  1. (function(){function r(){document.querySelectorAll('img[src^="https://cdn.linux.do/"]').forEach(i=>i.src=i.src.replace('https://cdn.linux.do/','https://linux.do/'))}r();let t;window.addEventListener('scroll',()=>{clearTimeout(t);t=setTimeout(r,200)});document.addEventListener('click',()=>setTimeout(r,500));new MutationObserver(m=>m.forEach(m=>{m.type==='childList'&&r()})).observe(document.body,{childList:!0,subtree:!0})})();
复制代码


PC端如果方法1用不了可以将下面这段代码保存到收藏夹栏
  1. java?script:(function(){function r(){document.querySelectorAll('img[src^="https://cdn.linux.do/"]').forEach(i=>i.src=i.src.replace('https://cdn.linux.do/','https://linux.do/'))}r();let t;window.addEventListener('scroll',()=>{clearTimeout(t);t=setTimeout(r,200)});document.addEventListener('click',()=>setTimeout(r,500));new MutationObserver(m=>m.forEach(m=>{m.type==='childList'&&r()})).observe(document.body,{childList:!0,subtree:!0})})();
复制代码

请将java ?script中的?去除然后点击新建的书签,就可以修复了。缺点是每进一个页面就要执行一次

方式②:
JS 源码,直接 F12 回车或塞油猴都行 ↓
  1. (function() {
  2.     function replaceImageUrls() {
  3.         const images = document.querySelectorAll('img[src^="https://cdn.linux.do/"]');
  4.         images.forEach(img => {
  5.             img.src = img.src.replace('https://cdn.linux.do/', 'https://linux.do/');
  6.         });
  7.     }

  8.     // 初始执行
  9.     replaceImageUrls();

  10.     // 监听滚动事件
  11.     let scrollTimer;
  12.     window.addEventListener('scroll', function() {
  13.         clearTimeout(scrollTimer);
  14.         scrollTimer = setTimeout(replaceImageUrls, 200);
  15.     });

  16.     // 监听点击事件
  17.     document.addEventListener('click', function() {
  18.         setTimeout(replaceImageUrls, 500);
  19.     });

  20.     // 监听 DOM 变化
  21.     const observer = new MutationObserver(function(mutations) {
  22.         mutations.forEach(function(mutation) {
  23.             if (mutation.type === 'childList') {
  24.                 replaceImageUrls();
  25.             }
  26.         });
  27.     });

  28.     observer.observe(document.body, { childList: true, subtree: true });
  29. })();
复制代码


感觉也暂时能接受看不了图片,因为加载速度快了很多
爱生活,爱奶昔~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

  • 关注公众号
  • 添加微信客服
© 2025 Naixi Networks 沪ICP备13020230号-1|沪公网安备 31010702007642号
关灯 在本版发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表