GitHub Repo Creation Date

Display creation date of repositories on GitHub

Stan na 07-07-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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();

})();