Content deleted Content added
Polygnotus (talk | contribs) ←Created page with '(function() { 'use strict'; class WikipediaClaudeProofreader { constructor() { this.apiKey = localStorage.getItem('claude_api_key'); this.sidebarWidth = localStorage.getItem('claude_sidebar_width') || '350px'; this.isVisible = localStorage.getItem('claude_sidebar_visible') !== 'false'; this.currentResults = localStorage.getItem('claude_current_results') || ''; this.init(); }...' |
Polygnotus (talk | contribs) No edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 30:
<button id="claude-proofread-btn" ${!this.apiKey ? 'style="display:none"' : ''}>Proofread Article</button>
<button id="claude-change-key-btn" ${!this.apiKey ? 'style="display:none"' : ''}>Change Key</button>
</div>
<div id="claude-results">
Line 188 ⟶ 187:
#ca-claude a:hover {
text-decoration: underline !important;
}
Line 244 ⟶ 198:
/* Hidden state styles */
body.claude-sidebar-hidden #claude-proofreader-sidebar {
display: none;
}
body.claude-sidebar-hidden #ca-claude {
display: list-item !important;
}
`;
Line 299 ⟶ 217:
}
createClaudeTab() {
// Only create tab if we're in the main article namespace (namespace 0)
if (typeof mw !== 'undefined' && mw.config.get('wgNamespaceNumber')
// Create the Claude tab
const claudeTab = document.createElement('li');
claudeTab.id = 'ca-claude';
claudeTab.className = 'mw-list-item';
const claudeLink = document.createElement('a');
claudeLink.href = '#';
claudeLink.title = 'Proofread with Claude AI';
claudeLink.addEventListener('click', (e) => {
e.preventDefault();
this.showSidebar();
});
const claudeSpan = document.createElement('span');
claudeSpan.textContent = 'Claude';
claudeLink.appendChild(claudeSpan);
claudeTab.appendChild(claudeLink);
Line 378 ⟶ 300:
style.setAttribute('data-claude-proofreader', 'true');
style.textContent = `
body.claude-sidebar-visible .mw-page-container {
margin-right: ${this.sidebarWidth} !important;
}
body.claude-sidebar-visible
body.claude-sidebar-visible .
body.claude-sidebar-visible .
body.claude-sidebar-visible #
margin-right: 0 !important;
max-width: none !important;
}
/* Legacy Vector and other themes */
body.claude-sidebar-visible #globalWrapper {
margin-right: ${this.sidebarWidth} !important;
}
/* Header adjustments */
body.claude-sidebar-visible .vector-header,
body.claude-sidebar-visible .vector-sticky-header,
body.claude-sidebar-visible
right: ${this.sidebarWidth} !important;
width: calc(100% - ${this.sidebarWidth}) !important;
box-sizing: border-box;
}
`;
Line 437 ⟶ 370:
}
adjustMainContent() {
// Only apply layout changes when sidebar is actually visible
if (this.isVisible) {
document.body.classList.add('claude-sidebar-visible');
Line 457 ⟶ 391:
document.getElementById('claude-proofread-btn').addEventListener('click', () => {
this.proofreadArticle();
});
}
Line 480 ⟶ 411:
localStorage.removeItem('claude_current_results');
this.updateOutput('');
this.updateStatus('Results cleared. Ready to proofread.');
}
Line 497 ⟶ 427:
outputEl.textContent = content;
}
// Store results
if (content) {
this.currentResults = content;
localStorage.setItem('claude_current_results', content);
}
}
|