Update gitignore
This commit is contained in:
commit
9e0ddb8182
32 changed files with 3863 additions and 0 deletions
73
views/layout_editor.ejs
Normal file
73
views/layout_editor.ejs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<h2>Layout editor</h2>
|
||||
|
||||
<div style="position:relative; width:100%; padding-bottom:56.25%; border:1px solid #333; border-radius:8px; overflow:hidden; margin-bottom:1.5rem;">
|
||||
<iframe
|
||||
id="preview"
|
||||
src="/overlay/<%= settings.overlay_id %>/preview"
|
||||
style="position:absolute; top:0; left:0; width:1920px; height:1080px; border:none; transform-origin:top left;"
|
||||
scrolling="no"
|
||||
></iframe>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/layout">
|
||||
|
||||
<h3>Chat position & size</h3>
|
||||
<div style="display:grid; grid-template-columns:repeat(4,1fr); gap:1rem;">
|
||||
<label>Left (%) <input type="number" name="chat_left" id="chat_left" value="<%= overlayLayout.chat_left %>" min="0" max="95" step="0.5"></label>
|
||||
<label>Top (%) <input type="number" name="chat_top" id="chat_top" value="<%= overlayLayout.chat_top %>" min="0" max="95" step="0.5"></label>
|
||||
<label>Width (%) <input type="number" name="chat_width" value="<%= overlayLayout.chat_width %>" min="1" max="100" step="0.5"></label>
|
||||
<label>Height (%) <input type="number" name="chat_height" value="<%= overlayLayout.chat_height %>" min="1" max="100" step="0.5"></label>
|
||||
</div>
|
||||
|
||||
<h3>Chat style</h3>
|
||||
<div style="display:grid; grid-template-columns:repeat(3,1fr); gap:1rem;">
|
||||
<label>Font size (px) <input type="number" name="chat_font_size" value="<%= overlayLayout.chat_font_size %>" min="8" max="64"></label>
|
||||
<label>Font family <input type="text" name="chat_font_family" value="<%= overlayLayout.chat_font_family %>"></label>
|
||||
<label>Text colour <input type="color" name="chat_text_color" value="<%= overlayLayout.chat_text_color %>"></label>
|
||||
<label>Background opacity (0–1) <input type="number" name="chat_bg_opacity" value="<%= overlayLayout.chat_bg_opacity %>" min="0" max="1" step="0.05"></label>
|
||||
<label>Border radius (px) <input type="number" name="chat_border_radius" value="<%= overlayLayout.chat_border_radius %>" min="0" max="32"></label>
|
||||
</div>
|
||||
|
||||
<h3>Alert position</h3>
|
||||
<div style="display:grid; grid-template-columns:repeat(2,1fr); gap:1rem;">
|
||||
<label>Left (%) <input type="number" name="alert_left" id="alert_left" value="<%= overlayLayout.alert_left %>" min="0" max="100" step="0.5"></label>
|
||||
<label>Top (%) <input type="number" name="alert_top" id="alert_top" value="<%= overlayLayout.alert_top %>" min="0" max="100" step="0.5"></label>
|
||||
</div>
|
||||
|
||||
<h3>Alert style</h3>
|
||||
<div style="display:grid; grid-template-columns:repeat(3,1fr); gap:1rem;">
|
||||
<label>Font size (px) <input type="number" name="alert_font_size" value="<%= overlayLayout.alert_font_size %>" min="12" max="96"></label>
|
||||
<label>Text colour <input type="color" name="alert_text_color" value="<%= overlayLayout.alert_text_color %>"></label>
|
||||
<label>Background opacity (0–1) <input type="number" name="alert_bg_opacity" value="<%= overlayLayout.alert_bg_opacity %>" min="0" max="1" step="0.05"></label>
|
||||
</div>
|
||||
|
||||
<button type="submit" style="margin-top:1rem;">Save layout</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const iframe = document.getElementById('preview');
|
||||
|
||||
function applyScale() {
|
||||
const scale = iframe.parentElement.offsetWidth / 1920;
|
||||
iframe.style.transform = `scale(${scale})`;
|
||||
}
|
||||
applyScale();
|
||||
window.addEventListener('resize', applyScale);
|
||||
|
||||
// Live-update CSS variables in the preview iframe as inputs change
|
||||
const varMap = {
|
||||
chat_left: '--chat-left',
|
||||
chat_top: '--chat-top',
|
||||
alert_left: '--alert-left',
|
||||
alert_top: '--alert-top',
|
||||
};
|
||||
|
||||
Object.entries(varMap).forEach(([id, cssVar]) => {
|
||||
const input = document.getElementById(id);
|
||||
if (!input) return;
|
||||
input.addEventListener('input', () => {
|
||||
if (!iframe.contentDocument) return;
|
||||
iframe.contentDocument.documentElement.style.setProperty(cssVar, `${input.value}%`);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue