V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lcj2class
V2EX  ›  程序员

一个火狐插件 gcleaner

  •  
  •   lcj2class · 2014-09-17 08:04:41 +08:00 via Android · 2118 次点击
    这是一个创建于 3499 天前的主题,其中的信息可能已经有所发展或是发生改变。
    大家好,
    众所周知,因为gfw,导致如果网站(比如stackoverflow)引用了google的JS,font时网站加载巨慢。
    google的chrome貌似不受影响,不知道chrome采用了什么功能能绕开这些加载不到的JS,直接显示dom。但chrome太吃内存了,所以我还是选择了mozilla的firefox。
    插件代码在
    https://github.com/jiacai2050/gcleaner
    大家有什么好建议,欢迎pull request

    安装的话直接下载xpi文件,之后拖到firefox上即可。
    第 1 条附言  ·  2014-09-17 14:04:57 +08:00
    目前发现插件一个bug,还不能去掉页面中的google link,解决ing
    https://github.com/jiacai2050/gcleaner#warning
    第 2 条附言  ·  2014-09-17 16:18:02 +08:00
    目前可以删掉(and不用加载)网页中引用google的script了,但是不能把相应的script给替换上。

    欢迎有mozilla addon开发经验的程序员给我些指导,把这个addon完善起来。

    感谢!
    第 3 条附言  ·  2014-09-19 01:01:09 +08:00
    现在已经发布到AMO,并且改名为gooreplacer,地址:
    https://addons.mozilla.org/zh-CN/firefox/addon/gooreplacer/
    27 条回复    2014-09-19 17:07:44 +08:00
    endintro
        1
    endintro  
       2014-09-17 10:00:09 +08:00
    chrome 也受影响的
    invsbelephant
        2
    invsbelephant  
       2014-09-17 10:13:16 +08:00
    想法很不错,希望发布到 mozilla addons。
    sagitarr
        3
    sagitarr  
       2014-09-17 10:15:01 +08:00
    没错 chrome 太吃内存了 现在办公室老机子用惯了 firefox 而且使用了收藏夹同步 所以回家后也基本上放弃了chrome
    lcj2class
        4
    lcj2class  
    OP
       2014-09-17 10:33:53 +08:00
    @endintro 我机器上用chrome打so没什么延迟感觉
    lcj2class
        5
    lcj2class  
    OP
       2014-09-17 10:35:20 +08:00
    @invsbelephant 感谢支持,现在这个addon还有些小问题,我再多测试测试,之后在发布。
    Ranler
        6
    Ranler  
       2014-09-17 10:51:54 +08:00
    请教,能不能把这些请求定向到国内的CDN上呢?
    PP
        7
    PP  
       2014-09-17 10:56:03 +08:00 via iPad
    Nice!
    lcj2class
        8
    lcj2class  
    OP
       2014-09-17 10:57:58 +08:00
    @Ranler 我这个插件已经支持这个功能https://github.com/jiacai2050/gcleaner#develop
    Ranler
        9
    Ranler  
       2014-09-17 11:05:02 +08:00
    @lcj2class 酷!我看介绍上说只是remove link
    invsbelephant
        10
    invsbelephant  
       2014-09-17 11:25:53 +08:00
    @lcj2class 发布后请再开新帖告知,谢谢
    lcj2class
        11
    lcj2class  
    OP
       2014-09-17 12:11:49 +08:00
    @invsbelephant 嗯,应该会在这两天发布。Stay tuned!
    ilihai
        12
    ilihai  
       2014-09-17 12:24:34 +08:00 via Android
    nice.
    google 的东西都自动翻了,但有这个更好。
    jzhone
        13
    jzhone  
       2014-09-17 12:35:36 +08:00   ❤️ 1
    muzuiget
        14
    muzuiget  
       2014-09-17 13:44:33 +08:00
    我看了下楼主的代码,这种直接替换 <head> 的里的 script 你确定大丈夫?这会打乱 JavaScript 的加载顺序的,破坏了后续代码的依赖。

    正确做法应该是在 Firefox 的 HTTP 请求层面进行重定向。
    lcj2class
        15
    lcj2class  
    OP
       2014-09-17 13:59:26 +08:00
    lcj2class
        16
    lcj2class  
    OP
       2014-09-17 14:00:44 +08:00
    @jzhone 稍后我会进行速度测试,如果快的话会采用科大的链接
    jzhone
        17
    jzhone  
       2014-09-17 15:50:48 +08:00
    @lcj2class 做成让用户选择吧,毕竟各地的网络情况不一样
    shijnmichael
        18
    shijnmichael  
       2014-09-17 16:04:58 +08:00
    樱木干得好
    imn1
        19
    imn1  
       2014-09-17 16:07:01 +08:00
    你这个名字起得……
    我第一反应还以为是firefox的GC回收加强,进来才知道是google相关
    lcj2class
        20
    lcj2class  
    OP
       2014-09-17 16:21:05 +08:00
    @imn1 你有什么好名字吗?
    lcj2class
        21
    lcj2class  
    OP
       2014-09-17 16:21:30 +08:00
    @jzhone 恩,后期可以做成这样
    imn1
        22
    imn1  
       2014-09-17 16:40:41 +08:00
    @lcj2class 木有,但觉得应该属于filter,用clean不好
    wenketel
        23
    wenketel  
       2014-09-17 17:32:39 +08:00
    https://fonts.lug.ustc.edu.cn/css?family=Open+Sans
    科大的话主要是可以用https,现在火狐已经默认在https页面禁止载入http内容,虽然可以关掉。
    可以考虑http用360,https用科大。
    sun019
        24
    sun019  
       2014-09-17 17:58:58 +08:00
    还是找个 shadowsocks 吧
    一劳永逸 就算慢点的访问网页也基本上没问题
    lcj2class
        25
    lcj2class  
    OP
       2014-09-17 19:42:44 +08:00
    @sun019 如果多一种选择,不是更好嘛
    cyio
        26
    cyio  
       2014-09-19 08:36:04 +08:00
    恳请楼主考虑开发Chrome扩展。
    lcj2class
        27
    lcj2class  
    OP
       2014-09-19 17:07:44 +08:00
    @cyio 好吧,虽说Chrome有些吃内存,但貌似大家都还痴迷chrome,OK!已经加到TO-DO中
    https://github.com/jiacai2050/gooreplacer#to-do
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1035 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:16 · PVG 03:16 · LAX 12:16 · JFK 15:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.