Skip to content

Instantly share code, notes, and snippets.

@iqiancheng
Created January 11, 2024 11:28
Show Gist options
  • Save iqiancheng/ea374010a474740993d31b18b0a51992 to your computer and use it in GitHub Desktop.
Save iqiancheng/ea374010a474740993d31b18b0a51992 to your computer and use it in GitHub Desktop.
修改知乎专栏文章发表时间的位置
// ==UserScript==
// @name 上移知乎文章发表日期到标题
// @namespace https://github.com/goocheez/GreasyFork/zhihu_timestamp_to_the_top
// @version 0.1
// @description 将知乎专栏的文章发表日期移动到标题下方
// @author Goocheez
// @match https://zhuanlan.zhihu.com/*
// @icon https://static.zhihu.com/heifetz/favicon.ico
// @grant none
// @license MIT
// ==/UserScript==
function move_zhihu_timestamp_to_the_top(){
var title = document.getElementsByClassName('Post-Header');
var time_stamp = document.getElementsByClassName('ContentItem-time');
if(title.length>0 && time_stamp.length>0){ // 添加条件语句,避免 js 出错
title[0].appendChild(time_stamp[0]);
}
}
(function() {
'use strict';
move_zhihu_timestamp_to_the_top();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment