Old School Replit

Add option to create apps with normal code in Replit.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Old School Replit
// @namespace    https://tommustbe12.dev/replit
// @version      1.0
// @description  Add option to create apps with normal code in Replit.
// @match        https://replit.com/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  function modifySidebar() {
    const createBtn = document.querySelector('[data-cy="sidebar-new-repl-btn"]');
    if (!createBtn || createBtn.dataset.tmModified) return;

    createBtn.dataset.tmModified = 'true';

    // Change text
    const textSpan = createBtn.querySelector(
      'span[class*="Text-module__zSV44a__text"]'
    );
    if (textSpan) textSpan.textContent = 'Create App with Agent';

    const li = createBtn.closest('li');
    if (!li) return;

    // Force vertical layout
    li.style.flexDirection = 'column';
    li.style.alignItems = 'stretch';
    li.style.gap = '6px';

    // Clone for Make App
    const makeAppBtn = createBtn.cloneNode(true);
    makeAppBtn.href = 'https://replit.com/developer-frameworks';
    makeAppBtn.rel = 'noopener noreferrer';
    makeAppBtn.removeAttribute('data-cy');

    const makeAppText = makeAppBtn.querySelector(
      'span[class*="Text-module__zSV44a__text"]'
    );
    if (makeAppText) makeAppText.textContent = 'Create App with Code';

    li.appendChild(makeAppBtn);
  }

  modifySidebar();

  const observer = new MutationObserver(modifySidebar);
  observer.observe(document.body, { childList: true, subtree: true });
})();