Skip to content

Commit a6d0340

Browse files
committed
Disable user-level for Cursor (project-only)
1 parent b5894ab commit a6d0340

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

website/worker.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Sitemap: https://opc.dev/sitemap.xml`, { headers: { 'Content-Type': 'text/plain'
153153
.hero-tab { flex: 1; padding: 8px 12px; background: var(--white); border: none; font-family: var(--font); font-size: 11px; cursor: pointer; border-right: 1px solid var(--black); }
154154
.hero-tab:last-child { border-right: none; }
155155
.hero-tab.active { background: var(--black); color: var(--white); }
156+
.hero-tab.disabled { opacity: 0.4; cursor: not-allowed; }
156157
.hero-cmd { display: flex; border: 1px solid var(--black); }
157158
.hero-cmd code { flex: 1; padding: 12px; font-size: 11px; background: var(--gray-100); overflow-x: auto; white-space: nowrap; }
158159
.hero-cmd .copy-btn { padding: 12px 16px; background: var(--black); color: var(--white); border: none; font-family: var(--font); font-size: 11px; cursor: pointer; border-left: 1px solid var(--black); }
@@ -346,9 +347,22 @@ Sitemap: https://opc.dev/sitemap.xml`, { headers: { 'Content-Type': 'text/plain'
346347
});
347348
}
348349
350+
const projectOnlyTools = ['cursor'];
351+
349352
function updateHeroCmd() {
350-
const level = document.querySelector('.hero-level-tabs .hero-tab.active').dataset.level;
351353
const tool = document.querySelector('.hero-tool-tabs .hero-tab.active').dataset.tool;
354+
const userTab = document.querySelector('.hero-level-tabs .hero-tab[data-level="user"]');
355+
const projectTab = document.querySelector('.hero-level-tabs .hero-tab[data-level="project"]');
356+
357+
if (projectOnlyTools.includes(tool)) {
358+
userTab.classList.add('disabled');
359+
userTab.classList.remove('active');
360+
projectTab.classList.add('active');
361+
} else {
362+
userTab.classList.remove('disabled');
363+
}
364+
365+
const level = document.querySelector('.hero-level-tabs .hero-tab.active').dataset.level;
352366
const levelFlag = level === 'project' ? ' -p' : '';
353367
const cmd = 'curl -fsSL https://raw.githubusercontent.com/ReScienceLab/opc-skills/main/install.sh | bash -s -- -t ' + tool + levelFlag + ' all';
354368
const code = document.getElementById('hero-cmd-code');
@@ -358,6 +372,7 @@ Sitemap: https://opc.dev/sitemap.xml`, { headers: { 'Content-Type': 'text/plain'
358372
359373
document.querySelectorAll('.hero-level-tabs .hero-tab').forEach(tab => {
360374
tab.addEventListener('click', () => {
375+
if (tab.classList.contains('disabled')) return;
361376
document.querySelectorAll('.hero-level-tabs .hero-tab').forEach(t => t.classList.remove('active'));
362377
tab.classList.add('active');
363378
updateHeroCmd();

0 commit comments

Comments
 (0)