Greasy Fork is available in English.

知乎右上角显示编辑时间

在内容右上角显示编辑时间

// ==UserScript==
// @name        知乎右上角显示编辑时间
// @name:zh-TW  知乎右上角顯示編輯時間
// @name:en     Show Editing Time at Top-right
// @namespace   https://greasyfork.org/en/users/211578
// @description 在内容右上角显示编辑时间
// @description:zh-TW  在内容右上角顯示編輯時間
// @description:en  Move the editing time of posts to their top right corners.
// @version     1.0
// @match       https://*.zhihu.com/*
// @run-at      document-idle
// @inject-into auto
// @grant       GM_addStyle
// @author      twchen
// ==/UserScript==

if (typeof GM_addStyle == "undefined") {
  this.GM_addStyle = css => {
    const style = document.createElement("style");
    style.textContent = css;
    document.documentElement.appendChild(style);
    return style;
  };
}

const url = window.location.href;
if (url.includes("zhuanlan")) {
  const container = document.querySelector(".Post-RichTextContainer");
  const time = document.querySelector(".ContentItem-time");
  container.appendChild(time);
  GM_addStyle(`
    .Post-RichTextContainer {
      position: relative;
    }
    .ContentItem-time {
      position: absolute;
      top: -1rem;
      right: 0;
      margin: 0;
      padding: 0;
    }
  `);
} else if (url.includes("collection")) {
  GM_addStyle(`
    .answer-date-link {
      position: absolute;
      top: 0;
      right: 0;
    }
  `);
} else {
  GM_addStyle(`
    .RichContent {
      position: relative;
    }
    .ContentItem-time {
      position: absolute;
      top: -1.5rem;
      right: 0;
      margin: 0;
      padding: 0;
    }
  `);
}