Lovable.dev Add Download Project Button

Adds a "Download Project" button on the project page of Lovable.dev

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Lovable.dev Add Download Project Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a "Download Project" button on the project page of Lovable.dev
// @author       You
// @match        https://lovable.dev/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Function to create and style the download button
    function addDownloadButton() {
        const projectPage = document.querySelector('.project-page'); // Adjust selector based on the page structure
        if (!projectPage) return;

        // Create the button element
        const button = document.createElement('button');
        button.innerText = 'Download Project';
        button.style.padding = '10px 20px';
        button.style.fontSize = '16px';
        button.style.backgroundColor = '#4CAF50'; // Green
        button.style.color = '#fff';
        button.style.border = 'none';
        button.style.borderRadius = '5px';
        button.style.cursor = 'pointer';
        button.style.marginTop = '20px';

        // Insert the button into the page (e.g., after the project description)
        projectPage.appendChild(button);

        // Add an event listener for when the button is clicked
        button.addEventListener('click', function() {
            // Replace this URL with the actual URL or functionality you need
            const downloadUrl = 'https://lovable.dev/download/project.zip'; // Example URL
            window.location.href = downloadUrl;
        });
    }

    // Wait for the page to load
    window.addEventListener('load', addDownloadButton);
})();