V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
vitovan
V2EX  ›  分享创造

于是我重新设计了 V2EX - v2excellent.js

  vitovan · 2015-11-24 07:05:19 +08:00 · 15513 次点击
这是一个创建于 3069 天前的主题,其中的信息可能已经有所发展或是发生改变。

跳过正文:https://vitovan.github.io/v2excellent.js/

缘起

看到一个贴子 于是我攒了一个黑苹果 ,大家讨论的热火朝天,于是我点了进去:

贴子倒是没什么可吐槽的,关键是回复

根本看不懂啊,不知道大家都在讨论什么呀!!

“ I217 可以用 AppleIntelE1000e.kext 来完美驱动”,这...... 指的是......

于是我拖到下方,找到分页按钮,用强大的人工智能,终于搞清楚了大家都在说些什么。

于是

想,平时看 HackerNews 的评论体验多好呀,明确的知道大家都在讨论什么,评论嵌套着很方便阅读么!为毛 V2EX 不搞一搞?

于是我决定搞一搞。

然后

发现 V2EX 与 HN 不同的一点是:回复中可以同时回复多人,这...... 不是嵌套关系。

不好搞啊......

不过

还是搞了出来。

可能算法上不很严谨,但效果还是蛮好的。

发出来给大家试试,要是觉得不错的话,封成插件呀~

效果是这样的:

主页在这里:https://vitovan.github.io/v2excellent.js/

源码在这里:https://github.com/VitoVan/v2excellent.js

第 1 条附言  ·  2015-11-24 08:15:00 +08:00
要是大家觉得有用的话,要不封装成插件?支持 Chrome / Firefox / User Script ?
第 2 条附言  ·  2015-11-24 09:19:10 +08:00
支持跨页啊,盆友们。自动提取帖子所有回复。
第 3 条附言  ·  2015-11-24 16:06:21 +08:00
第 4 条附言  ·  2015-11-25 11:31:28 +08:00

升级了,请删除当前书签,前往项目主页重新添加 http://vitovan.github.io/v2excellent.js/

2015/11/25 Add feature: Image Upload
2015/11/25 Add feature: #reply42 Jump
2015/11/25 Add feature: Gift ClickOnce
2015/11/25 Add feature: Floor Specification

第 5 条附言  ·  2015-11-25 12:56:03 +08:00
第 6 条附言  ·  2017-04-15 08:38:06 +08:00
125 条回复    2018-01-05 13:48:10 +08:00
1  2  
lenovo
    101
lenovo  
   2015-11-27 02:27:30 +08:00
r#100 @vitovan https://greasyfork.org/en/scripts/3452-v2ex 增强插件
之前签到用的这个脚本
starship
    102
starship  
   2015-11-27 13:05:11 +08:00
r#101 @vitovan 感谢回复,还是不行。我先安装了 https://greasyfork.org/en/scripts/14182-v2excellent-js ,然后打开 V2EX 首页,按 F12 , console ,然后点击“领取今日奖励”,显示的错误信息为: XMLHttpRequest cannot load https://v2ex.com/mission/daily. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.v2ex.com' is therefore not allowed access.
另外点击回复按钮,有些时候直接显示 r#+楼层数,后面跟上 @用户名;有些时候没有显示,直接 @用户名。
starship
    103
starship  
   2015-11-27 13:05:39 +08:00
r#101 @lenovo 感谢,已经用上。
vitovan
    104
vitovan  
OP
   2015-11-27 13:22:21 +08:00 via Android
r#102 @starship
哈,我知道啦,你用的是 http 协议且带 www 头的网址访问的 V2EX ,而领取今日奖励的页面默认是 https 且不带 www 头的地址,所以出现了跨域问题。

等晚上更新一下,多谢回復呀。

在此期间你可以试试用 https://v2ex.com 的方式访问 V2EX 应该就没有问题啦!
starship
    105
starship  
   2015-11-27 14:09:48 +08:00
r#104 @vitovan 经过你一点拨,原来如此,那请问 http://www.v2ex.comhttps://v2ex.com 有什么区别吗?是不是 https://v2ex.com 相对更安全些?
starship
    106
starship  
   2015-11-27 14:17:18 +08:00
r#104 @vitovan 看了源代码,因为自己不知道如何才能使函数在上面两个网址都生效,于是很笨地复制粘贴了两份,把第二份的网址修改成$.get('http://www.v2ex.com/mission/daily',function(result),似乎有效果,还是等更新吧。
vitovan
    107
vitovan  
OP
   2015-11-27 16:25:29 +08:00 via Android
r#105 @starship 是的, https://v2ex.com 更安全有些,通常情况下还可以防止被监听。
vitovan
    108
vitovan  
OP
   2015-11-27 18:23:11 +08:00
r#106 @starship 已修复,更新下明天试试吧~
starship
    109
starship  
   2015-11-27 20:02:45 +08:00
r#108 @vitovan thankyou 啦,原来直接去掉前面的域名就好:)
starship
    110
starship  
   2015-11-27 20:19:50 +08:00
r#108 @vitovan 另外建议: function reArrangeComments 那 margin-left 由 21px 改为 5px 或者 2px ,这样当有很多层嵌套关系时,排列比较好看:)
vitovan
    111
vitovan  
OP
   2015-11-28 05:33:29 +08:00
r#110 @starship 已修正,更新试试?

另外,如果你用 GitHub 的话,随意发 Pull Request 啊~

https://github.com/VitoVan/v2excellent.js
restran
    112
restran  
   2015-11-30 09:13:12 +08:00
很棒的想法,我觉得知乎回答的长文阅读体验不是很好,是不是也可以用类似的方法美化一下。
vitovan
    113
vitovan  
OP
   2015-11-30 12:22:35 +08:00 via Android
@restran 很少上知乎呀…………
cwhong4399
    114
cwhong4399  
   2015-12-01 13:49:02 +08:00
嵌套太多层,头像挤到用户名了,看楼上的那些回复
vitovan
    115
vitovan  
OP
   2015-12-02 05:55:27 +08:00
r#114 @cwhong4399 可否帮忙截个图?另外发下您的浏览器版本号?我这里没有出现您說的那个情况呀~
jaylong
    116
jaylong  
   2017-01-05 23:36:08 +08:00
这个目前还有没有 bookmarklet 版本啊?必须要装油猴才能用吗?
vitovan
    117
vitovan  
OP
   2017-01-06 11:04:52 +08:00 via Android
@jaylong 没有呢~等有时间了试着加上。
vitovan
    118
vitovan  
OP
   2017-04-15 08:17:53 +08:00
@starship #103 Test new feature
vitovan
    119
vitovan  
OP
   2017-04-15 08:18:40 +08:00
@dotpig
@vitovan #113 Testing new feature, sorry for bothering.
starship
    120
starship  
   2017-04-15 16:18:32 +08:00
#118 感谢更新,参见 issues : https://github.com/VitoVan/v2excellent.js/issues/6
vitovan
    121
vitovan  
OP
   2017-05-29 22:40:19 +08:00
@starship #120 已修复呦~
slimyy
    122
slimyy  
   2017-09-15 12:06:56 +08:00
这个东西现在不能用了吗?还是有新版本或替代方案?
vitovan
    123
vitovan  
OP
   2017-09-23 09:44:38 +08:00
@slimyy 为什么不能用啦?
slimyy
    124
slimyy  
   2018-01-03 14:31:28 +08:00
@vitovan 用不起来,我在 360 极速模式下(请原谅我使用 360 ),将你的 JS 拖入到扩展里,启用后,打开 V2EX,并没有什么改变,F12 看 console,是:
Uncaught ReferenceError: $ is not defined
at chrome-extension://nijlkkfjhphodcfpgcjhlonjepbdddnh/script.js:13
at chrome-extension://nijlkkfjhphodcfpgcjhlonjepbdddnh/script.js:368

然后,我在 chrome 下来试。也是同样拖入 JS。但再次打开的时候,提示就是“此扩展程序可能已损坏。” chrome 版本是 63.0.3239.84 (正式版本) ( 64 位)

我该怎么办。
vitovan
    125
vitovan  
OP
   2018-01-05 13:48:10 +08:00
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2790 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms · UTC 11:43 · PVG 19:43 · LAX 04:43 · JFK 07:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.