体验槽点:知乎评论区混乱的时间顺序

今天去知乎看一个数理相关的问题,下面有一段讨论,但是时间错乱,无法按时间排序,同一天没有精准时间显示,导致我看得云里雾里,难以理清二人讨论的逻辑…


「体验槽点」这个选题灵感来自龙爪槐守望者周报

只有手机端能够看到精准的评论排序,电脑端不行,知乎故意的,阉割了很多PC端体验

5 个赞

可惜小众软件不是故意的

后端一般都返回了时间戳,前端转换时去掉了,非要找的话在开发者控制台搜索内容定位到时间戳然后手动转换 :cry:

小众论坛设计的还行吧右侧有时间线,光标放到右上角的时间上会显示精确到分的时间

1 个赞

这功能不看到你的回复我还真不知道 :joy_cat:

bilibili的评论也是这样吧,都好烦,太讨厌这帮网站了,简直不顾PC网页端体验
发现B站这学习笔记功能也给来了一刀,连展开的按钮都没有。难道产品经理觉得没人用电脑的?????

我感觉这些评论就是按照知乎自己制定的规则排序的,不是按时间顺序来的

1 个赞

我是最开始在Reddit发现的,后来有这种时间格式的网站会下意识的尝试,小众的时间位置确实不好发现 :joy:

默认请求有的是order_by=ts,有的是order_by=score,不知道啥意思


@ DavidJoy

试着学了下油猴脚本,写了个Dome,有兴趣的话可以尝试一下

代码写的很烂,各位大佬见谅:


不好意思 :cry:,才发现0.1版本点赞有bug,0.2已经将时间在原有位置替换了

// ==UserScript==
// @name         知乎评论时间精确到秒
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       You
// @match        https://www.zhihu.com/*
// @icon         http://zhihu.com/favicon.ico
// @grant       GM_addStyle
// @run-at document-start
// @require https://scriptcat.org/lib/637/1.3.3/ajaxHooker.js

// ==/UserScript==

GM_addStyle(`
  .CommentContent.css-1t9bp9f {
		position: relative;
		overflow: visible;
	}

	/* 	精确时间 */
	.commentTime {
		position: absolute;
		left: 0;
		bottom: -25px;
		color: #999;
	}

	.css-140jo2{
		position: relative;
	}

	/* 原时间	 */
	.css-12cl38p,.css-12cl38p+span,.css-nm6sok+span {
		display: none;
	}

	/* ip属地	 */
	.css-8hxn0r .css-nm6sok {
		position: absolute;
		left: 160px;
		top: 3px;
	}
	/* 热评	 */
	.css-8hxn0r .css-33kuns {
		position: absolute;
		left: 240px;
		top: 3px;
	}
`);



(function () {
  'use strict';
  function timestampToTime(timestamp) {
    const milliseconds = timestamp * 1000; // 将秒转换为毫秒
    const date = new Date(milliseconds);
    const year = date.getFullYear();
    const month = addZero(date.getMonth() + 1);
    const day = addZero(date.getDate());
    const hour = addZero(date.getHours());
    const minute = addZero(date.getMinutes());
    const second = addZero(date.getSeconds());

    return `${ year }-${ month }-${ day } ${ hour }:${ minute }:${ second }`;
  }

  function addZero(num) {
    return num < 10 ? `0${ num }` : `${ num }`;
  }

  ajaxHooker.hook(request => {
    if (request.url.includes("https://www.zhihu.com/api/v4/comment_v5/comment/") || request.url.includes("https://www.zhihu.com/api/v4/comment_v5/answers/")) {

      request.response = res => {
        // console.log(res.json.data);
        if (res.json.data) {
          res.json.data.forEach(item => {
            // console.log(timestampToTime(item.created_time));
            // item.created_time = timestampToTime(item.created_time)
            item.content =  item.content +   '<span class="commentTime">' + timestampToTime(item.created_time) + '</span>'
            if (item.child_comments.length >= 1) {
              item.child_comments.forEach(child => {
                child.content =   child.content  + '<span class="commentTime">' + timestampToTime(child.created_time) + '</<span>'

              });
            }
          });
        }
      };
    }

  });
  // Your code here...
})();
1 个赞

我觉得是网站官方想把用户赶到手机APP上去,故意降低的PC网页版体验,比如豆瓣也是。

pc用户没人权呀,我收到别人发的链接,都会刻意从电脑上打开,只能说体验真的很差

才发现

电脑上 怎么做画像分析,pc浏览器都是沙盒,url参数可以用插件清空;跟手机比起来简直安全太多了。

仔细看看公众号的URL参数 包含了系统版本 网络状况 从哪跳转这类信息,都是钱啊 :rofl: 更别说还有读取剪贴板这类的,电脑上可不好操作

对啊,所以想尽办法把用户往手机客户端赶,吃相可见一斑。

断人财路啊,他们能不拼命? :rofl:

另一方面也是贪得无厌吧?

Hi 似乎失效了?

我也发现了,有时候当「课代表」分享笔记不好用,还得再发一份评论版的

试试:

// ==UserScript==
// @name         知乎评论时间精确到秒
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  try to take over the world!
// @author       You
// @match        https://www.zhihu.com/*
// @match        https://zhuanlan.zhihu.com/*
// @icon         http://zhihu.com/favicon.ico
// @grant       GM_addStyle
// @run-at document-start
// @require https://scriptcat.org/lib/637/1.3.3/ajaxHooker.js

// ==/UserScript==


(function () {
	'use strict';
	function timestampToTime(timestamp) {
		const milliseconds = timestamp * 1000;
		const date = new Date(milliseconds);
		const year = date.getFullYear();
		const month = addZero(date.getMonth() + 1);
		const day = addZero(date.getDate());
		const hour = addZero(date.getHours());
		const minute = addZero(date.getMinutes());
		const second = addZero(date.getSeconds());

		return `${ year }-${ month }-${ day } ${ hour }:${ minute }:${ second }`;
	}

	function addZero(num) {
		return num < 10 ? `0${ num }` : `${ num }`;
	}

	ajaxHooker.hook(request => {
		if (request.url.includes("https://www.zhihu.com/api/v4/comment_v5/comment/") || request.url.includes("https://www.zhihu.com/api/v4/comment_v5/answers/") || request.url.includes("https://www.zhihu.com/api/v4/comment_v5/articles/")) {

			request.response = res => {
				// console.log('\n== ↓ ↓ ↓ ↓ ↓ == \n', res)

				if (res.json.data) {

					res.json.data.forEach(item => {
						// console.log(timestampToTime(item.created_time));
						item.content =  item.content +   '<span class="commentTime">' + timestampToTime(item.created_time) + '</span>'
						if (item.child_comments.length >= 1) {
							item.child_comments.forEach(child => {
								child.content =   child.content  + '<span class="commentTime">' + timestampToTime(child.created_time) + '</<span>'
							});
						}
					});
					GM_addStyle(`
					.CommentContent {
							position: relative;
							overflow: visible;
						}

						/* 	精确时间 */
						.commentTime {
							position: absolute;
							left: 0;
							bottom: -25px;
							color: #999;
						}

						.css-140jo2 {
							position: relative;
						}

						/* 原时间	 */
						.css-12cl38p,
						.css-12cl38p + span,
						.css-nm6sok + span {
							display: none;
						}

						/* ip属地	 */
						.css-8hxn0r .css-nm6sok {
							position: absolute;
							left: 160px;
							top: 3px;
						}
						/* 热评	 */
						.css-8hxn0r .css-33kuns {
							position: absolute;
							left: 240px;
							top: 3px;
						}
						/*  作者置顶	 */
						.css-1o87v1m{
						    position: absolute;
  						    top: 22px;
   						    left: -4px;
						}
					`);
				}

			};
		}

	});
})();
1 个赞

不打算发布到 Greasy Fork 嘛

能把显示提问题的精确时间的功能加入吗?