wmod-proxy
Version:
Website Modification Proxy
39 lines (36 loc) • 1.01 kB
text/typescript
import { ResolvedManifest } from './model';
const indicatorStyle = `
a
display: block;
position: fixed;
top: 0;
left: 2%;
background: rgba(255, 255, 255, 0.2);
color:
border-radius: 0 0 4px 4px;
padding: 4px;
font-family: sans-serif;
font-weight: bold;
font-size: 75%;
text-decoration: none;
opacity: 0.6;
}
a
opacity: 1;
}
`;
export function getIndicatorScript(manifest: ResolvedManifest) {
return `
document.addEventListener('DOMContentLoaded', function () {
const a = document.createElement('a');
a.href = '${manifest.homepage}';
a.textContent = 'WM';
a.title = \`${manifest.name} ${manifest.version}\n${manifest.description}\`;
a.setAttribute('id', 'wm-indicator');
document.body.appendChild(a);
const style = document.createElement('style');
style.textContent = \`${indicatorStyle}\`;
document.head.appendChild(style);
})
`;
}