fix: use percentages for chat position so it scales with image
This commit is contained in:
@@ -152,11 +152,14 @@ async function main() {
|
|||||||
|
|
||||||
const pageTitle = (await page.title()).replace(/[<>]/g, '');
|
const pageTitle = (await page.title()).replace(/[<>]/g, '');
|
||||||
|
|
||||||
const chatBlocks = slots.map(s => `
|
const chatBlocks = slots.map(s => {
|
||||||
<div class="q-chat" style="top:${s.top}px" data-cid="${s.id}">
|
const topPct = (s.top / pageHeight * 100).toFixed(4);
|
||||||
|
return `
|
||||||
|
<div class="q-chat" style="top:${topPct}%" data-cid="${s.id}">
|
||||||
<textarea class="c-in" autocomplete="off" spellcheck="false" rows="1" placeholder=""></textarea>
|
<textarea class="c-in" autocomplete="off" spellcheck="false" rows="1" placeholder=""></textarea>
|
||||||
<div class="c-out"></div>
|
<div class="c-out"></div>
|
||||||
</div>`).join('');
|
</div>`;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
const wrapperHtml = `<!DOCTYPE html>
|
const wrapperHtml = `<!DOCTYPE html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
@@ -170,8 +173,8 @@ async function main() {
|
|||||||
.q-wrap img.bg { display:block; width:100%; height:auto; }
|
.q-wrap img.bg { display:block; width:100%; height:auto; }
|
||||||
.q-chat {
|
.q-chat {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 250px;
|
left: 15.6%;
|
||||||
width: 520px;
|
width: 32.5%;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user