-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
107 lines (100 loc) · 3.44 KB
/
index.html
File metadata and controls
107 lines (100 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Userscripts Dev Server</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background: #f5f5f5;
}
.container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.script-item {
background: #f8f9fa;
padding: 15px;
margin: 10px 0;
border-radius: 5px;
border-left: 4px solid #007bff;
}
.url {
font-family: 'Courier New', monospace;
background: #e9ecef;
padding: 5px 8px;
border-radius: 3px;
color: #495057;
word-break: break-all;
}
h1 {
color: #333;
border-bottom: 2px solid #007bff;
padding-bottom: 10px;
}
.instructions {
background: #e7f3ff;
padding: 15px;
border-radius: 5px;
margin: 20px 0;
}
</style>
</head>
<body>
<div class="container">
<h1>🔧 Userscripts Development Server</h1>
<div class="instructions">
<h3>How to use with Tampermonkey:</h3>
<ol>
<li>Copy the script URL below</li>
<li>In Tampermonkey, create a new script or edit an existing one</li>
<li>Replace the <code>@require</code> or script content with the dev URL</li>
<li>Save and the script will load from this dev server</li>
</ol>
</div>
<h2>📜 Available Scripts</h2>
<div id="scripts-list">Loading scripts...</div>
</div>
<script>
async function loadScripts() {
try {
const response = await fetch('/api/scripts');
const scripts = await response.json();
const container = document.getElementById('scripts-list');
container.innerHTML = '';
scripts.forEach(script => {
const div = document.createElement('div');
div.className = 'script-item';
div.innerHTML = `
<h3>${script.name}</h3>
<p><strong>Dev URL:</strong> <span class="url">${script.url}</span></p>
<button onclick="copyToClipboard('${script.url}')">📋 Copy URL</button>
`;
container.appendChild(div);
});
} catch (error) {
document.getElementById('scripts-list').innerHTML =
'<p style="color: red;">Error loading scripts: ' + error.message + '</p>';
}
}
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
// Simple feedback
const button = event.target;
const originalText = button.textContent;
button.textContent = '✅ Copied!';
setTimeout(() => {
button.textContent = originalText;
}, 2000);
});
}
loadScripts();
</script>
</body>
</html>