GitHub Repo Creation Date

Display creation date of repositories on GitHub

Version vom 07.07.2025. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         GitHub Repo Creation Date
// @namespace    npm/vite-plugin-monkey
// @version      0.1.0
// @author       pacexy <[email protected]>
// @description  Display creation date of repositories on GitHub
// @license      MIT
// @icon         https://vitejs.dev/logo.svg
// @homepage     https://github.com/pacexy/userscript-github-repo-creation-date#readme
// @homepageURL  https://github.com/pacexy/userscript-github-repo-creation-date#readme
// @source       https://github.com/pacexy/userscript-github-repo-creation-date.git
// @supportURL   https://github.com/pacexy/userscript-github-repo-creation-date/issues
// @match        https://github.com/*/*
// ==/UserScript==

(function () {
  'use strict';

  const name = "userscript-github-repo-creation-date";
  async function fetchRepo(owner, name2) {
    const response = await fetch(`https://ungh.cc/repos/${owner}/${name2}`);
    return response.json();
  }
  function parseCurrentPath() {
    const [, owner, name2] = window.location.pathname.split("/");
    if (!owner || !name2) {
      throw new Error("Invalid URL format");
    }
    return { owner, name: name2 };
  }
  function formatDate(date, format = "short") {
    const d = new Date(date);
    return d.toLocaleDateString("en-US", {
      year: "numeric",
      month: format,
      day: format === "long" ? "numeric" : void 0
    });
  }
  function inject(date) {
    const container = document.createElement("span");
    container.id = name;
    container.title = `Created on ${formatDate(date, "long")}`;
    container.textContent = `(${formatDate(date)})`;
    container.style.color = "var(--fgColor-disabled)";
    container.style.marginLeft = "8px";
    const root = document.querySelector(".Layout-sidebar h2");
    if (!root) {
      throw new Error("Root element not found");
    }
    root.append(container);
  }
  async function run() {
    const { owner, name: name2 } = parseCurrentPath();
    const { repo } = await fetchRepo(owner, name2);
    inject(repo.createdAt);
  }
  run();

})();