new-site/chrome-extension/fcc-access-helper/content-cores.js
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

60 lines
2.7 KiB
JavaScript

/**
* Content script for FCC CORES (apps.fcc.gov/coresWeb/*)
*
* Injects a guidance overlay when on the CORES user management pages
* to help the client add filings@performancewest.net as an authorized user.
*/
(function() {
'use strict';
const PW_EMAIL = 'filings@performancewest.net';
// Only inject on relevant pages
const url = window.location.href.toLowerCase();
if (!url.includes('coresweb') && !url.includes('cores')) return;
// Wait for page to load
setTimeout(injectGuidance, 2000);
function injectGuidance() {
// Look for user management forms or "Add User" buttons
const addUserBtn = document.querySelector('input[value*="Add"], button:contains("Add User"), a[href*="addUser"]');
const emailFields = document.querySelectorAll('input[type="text"][name*="email"], input[type="email"]');
// Inject floating helper banner
const banner = document.createElement('div');
banner.id = 'pw-cores-helper';
banner.innerHTML = `
<div style="position:fixed;bottom:20px;right:20px;z-index:99999;background:#1e3a5f;color:white;padding:16px 20px;border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,0.2);max-width:320px;font-family:-apple-system,sans-serif;">
<div style="display:flex;justify-content:space-between;align-items:start;">
<strong style="font-size:13px;">Performance West Helper</strong>
<button id="pw-close" style="background:none;border:none;color:#94a3b8;cursor:pointer;font-size:18px;line-height:1;">&times;</button>
</div>
<p style="font-size:11px;color:#94a3b8;margin:8px 0;">Add this email as an authorized user on your FRN:</p>
<div style="background:#2d4a73;padding:8px 12px;border-radius:6px;font-family:monospace;font-size:13px;cursor:pointer;user-select:all;" id="pw-email-copy">${PW_EMAIL}</div>
<p style="font-size:10px;color:#64748b;margin-top:8px;">Click the email to copy. Then paste it into the "Add User" form above.</p>
</div>
`;
document.body.appendChild(banner);
// Close button
document.getElementById('pw-close')?.addEventListener('click', () => banner.remove());
// Copy on click
document.getElementById('pw-email-copy')?.addEventListener('click', () => {
navigator.clipboard.writeText(PW_EMAIL).then(() => {
const el = document.getElementById('pw-email-copy');
if (el) { el.textContent = 'Copied!'; setTimeout(() => el.textContent = PW_EMAIL, 1500); }
});
});
// Auto-fill email fields if empty
emailFields.forEach(field => {
if (!field.value) {
field.value = PW_EMAIL;
field.style.backgroundColor = '#eff6ff';
field.style.borderColor = '#93c5fd';
}
});
}
})();