Add visible userscript launcher badge
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name ChatGPT to Suno Prompt Copier
|
// @name ChatGPT to Suno Prompt Copier
|
||||||
// @namespace local.suno-helper
|
// @namespace local.suno-helper
|
||||||
// @version 0.1.2
|
// @version 0.1.3
|
||||||
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
// @description Copy structured ChatGPT song prompt versions into Suno fields.
|
||||||
// @author local
|
// @author local
|
||||||
// @match https://chatgpt.com/*
|
// @match https://chatgpt.com/*
|
||||||
@@ -57,6 +57,23 @@
|
|||||||
#cgs-panel.cgs-error {
|
#cgs-panel.cgs-error {
|
||||||
border-color: rgba(255, 84, 84, 0.7);
|
border-color: rgba(255, 84, 84, 0.7);
|
||||||
}
|
}
|
||||||
|
#cgs-launcher {
|
||||||
|
position: fixed;
|
||||||
|
right: 18px;
|
||||||
|
top: 18px;
|
||||||
|
z-index: 2147483647;
|
||||||
|
min-width: 76px;
|
||||||
|
min-height: 34px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #ef4444;
|
||||||
|
border: 2px solid #ffffff;
|
||||||
|
border-radius: 999px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
|
||||||
|
cursor: pointer;
|
||||||
|
font: 700 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||||
|
}
|
||||||
|
#cgs-launcher:hover { background: #dc2626; }
|
||||||
#cgs-panel * { box-sizing: border-box; }
|
#cgs-panel * { box-sizing: border-box; }
|
||||||
#cgs-panel.cgs-minimized .cgs-body { display: none; }
|
#cgs-panel.cgs-minimized .cgs-body { display: none; }
|
||||||
.cgs-head {
|
.cgs-head {
|
||||||
@@ -133,6 +150,18 @@
|
|||||||
return panel.querySelector(".cgs-body");
|
return panel.querySelector(".cgs-body");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureLauncher(label, onClick) {
|
||||||
|
let launcher = document.querySelector("#cgs-launcher");
|
||||||
|
if (!launcher) {
|
||||||
|
launcher = document.createElement("button");
|
||||||
|
launcher.id = "cgs-launcher";
|
||||||
|
launcher.type = "button";
|
||||||
|
document.body.appendChild(launcher);
|
||||||
|
}
|
||||||
|
launcher.textContent = label;
|
||||||
|
launcher.onclick = onClick;
|
||||||
|
}
|
||||||
|
|
||||||
function createErrorPanel(error) {
|
function createErrorPanel(error) {
|
||||||
if (!document.body) return;
|
if (!document.body) return;
|
||||||
const body = createPanel("Suno Helper Error", "cgs-error");
|
const body = createPanel("Suno Helper Error", "cgs-error");
|
||||||
@@ -248,6 +277,7 @@
|
|||||||
|
|
||||||
function bootChatGPT() {
|
function bootChatGPT() {
|
||||||
clearInterval(chatRenderTimer);
|
clearInterval(chatRenderTimer);
|
||||||
|
ensureLauncher("Suno", () => bootChatGPT());
|
||||||
const body = createPanel("ChatGPT -> Suno", "cgs-chatgpt");
|
const body = createPanel("ChatGPT -> Suno", "cgs-chatgpt");
|
||||||
body.innerHTML = `
|
body.innerHTML = `
|
||||||
<div class="cgs-muted">현재 답변에서 Version A/B/C를 찾아서 저장해.</div>
|
<div class="cgs-muted">현재 답변에서 Version A/B/C를 찾아서 저장해.</div>
|
||||||
@@ -406,6 +436,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function bootSuno() {
|
async function bootSuno() {
|
||||||
|
ensureLauncher("Suno", () => bootSuno());
|
||||||
const body = createPanel("Suno Prompt Paste");
|
const body = createPanel("Suno Prompt Paste");
|
||||||
const payload = await readPayload();
|
const payload = await readPayload();
|
||||||
body.innerHTML = `
|
body.innerHTML = `
|
||||||
|
|||||||
Reference in New Issue
Block a user