async page => { const pages=[{"id": "home", "path": "/"}, {"id": "privacy", "path": "/privacy/"}, {"id": "sources", "path": "/sources/"}, {"id": "uikit", "path": "/ui-kit/"}, {"id": "tools", "path": "/tools/"}, {"id": "missing", "path": "/does-not-exist-design-system/"}, {"id": "about", "path": "/about/"}, {"id": "resources", "path": "/resources/"}, {"id": "a0", "path": "/articles/использование-jquery-в-webpack/", "slug": "использование-jquery-в-webpack"}, {"id": "a1", "path": "/articles/bitrix-api-add-foto-editor/", "slug": "bitrix-api-add-foto-editor"}, {"id": "a2", "path": "/articles/о-tilix-и-d-интервью-с-геральдом-нанном/", "slug": "о-tilix-и-d-интервью-с-геральдом-нанном"}, {"id": "a3", "path": "/articles/bitrix-api-функция-для-генерации-кода-элемент/", "slug": "bitrix-api-функция-для-генерации-кода-элемент"}, {"id": "a4", "path": "/articles/bitrix-api-создание-добавление-торгового-пре/", "slug": "bitrix-api-создание-добавление-торгового-пре"}, {"id": "a5", "path": "/articles/firefox-увеличение-ожидания-загрузки-timeout-стр/", "slug": "firefox-увеличение-ожидания-загрузки-timeout-стр"}, {"id": "a6", "path": "/articles/ошибка-php-ssl-certificate-error-unable-to-get-local-issuer-certificate/", "slug": "ошибка-php-ssl-certificate-error-unable-to-get-local-issuer-certificate"}, {"id": "a7", "path": "/articles/dconf-2017-под-капотом-мусорщика-ди-дмитрий-ол/", "slug": "dconf-2017-под-капотом-мусорщика-ди-дмитрий-ол"}, {"id": "a8", "path": "/articles/пишем-аналог-функции-php-preg_match_all-на-языке-прог/", "slug": "пишем-аналог-функции-php-preg_match_all-на-языке-прог"}, {"id": "a9", "path": "/articles/новый-движок-ctfe/", "slug": "новый-движок-ctfe"}, {"id": "a10", "path": "/articles/особенности-vibe-d/", "slug": "особенности-vibe-d"}, {"id": "a11", "path": "/articles/вирус-самопроизвольный-запуск-брауз/", "slug": "вирус-самопроизвольный-запуск-брауз"}, {"id": "a12", "path": "/articles/компиляция-64-x-разрядных-программ-на-dmd-по/", "slug": "компиляция-64-x-разрядных-программ-на-dmd-по"}, {"id": "a13", "path": "/articles/привет-мир/", "slug": "привет-мир"}],base='http://127.0.0.1:65019',dir='/tmp/progcode-ds-content/'; const errors=[],external=[],results=[]; page.on('pageerror',e=>errors.push(String(e))); page.on('request',r=>{if(!r.url().startsWith(base)&&!r.url().startsWith('data:'))external.push(r.url());}); await page.addInitScript(()=>{try{localStorage.setItem('progcode-theme','system');}catch{}}); for(const width of [320,390,1440]) for(const theme of ['light','dark']) { await page.setViewportSize({width,height:1000});await page.emulateMedia({colorScheme:theme,reducedMotion:'reduce'}); for(const item of pages){ const res=await page.goto(base+item.path,{waitUntil:'networkidle'}); await page.getByLabel('Тема',{exact:true}).selectOption(theme); const stats=await page.evaluate(()=>{ const body=document.querySelector('main.article-shell .article-content'),h=document.querySelector('h1'); const styles=body?getComputedStyle(body):null; const rect=body?.getBoundingClientRect(); return {title:document.title,h1:h?.textContent,width:innerWidth,scrollWidth:document.documentElement.scrollWidth,theme:document.documentElement.dataset.theme,bodyChars:body?.textContent.length||0,bodyWidth:rect?.width,fontSize:styles?.fontSize,lineHeight:styles?.lineHeight,bodyColor:styles?.color,canvas:getComputedStyle(document.body).backgroundColor,h1Width:h?.clientWidth,h1ScrollWidth:h?.scrollWidth,failedImages:[...document.images].filter(i=>i.getAttribute('src')&&i.complete&&!i.naturalWidth).map(i=>i.getAttribute('src')),figures:body?.querySelectorAll('figure').length||0,tableRows:body?.querySelectorAll('table tbody tr').length||0,tableColumns:body?.querySelectorAll('table thead th').length||0,downloads:document.querySelectorAll('a[download]').length,hasFalseMBHint:/До\s*1\s*МБ/.test(document.querySelector('main')?.textContent||'')}; }); const record={...item,width,theme,status:res.status(),...stats}; const topTake=(width===320&&theme==='light'&&['home','a6','a11','a8','uikit'].includes(item.id))||(width===390&&theme==='dark'&&['home','a1','a2','a7','a9','tools','privacy','sources','missing'].includes(item.id))||(width===1440&&['a2','a7','a10','uikit'].includes(item.id)); if(topTake){record.top=dir+item.id+'-'+width+'-'+theme+'-top.png';await page.screenshot({path:record.top});} if(width===390&&theme==='dark'&&['a1','a7','a9','a10','a11'].includes(item.id)){ const figs=page.locator('main.article-shell .article-content figure');record.figureShots=[]; for(let n=0;n=0){await p.nth(n).scrollIntoViewIfNeeded();record.middle=dir+item.id+'-'+width+'-'+theme+'-middle.png';await page.screenshot({path:record.middle});} record.lineSamples=await page.evaluate(()=>{ const ps=[...document.querySelectorAll('main.article-shell .article-content p')].filter(p=>p.textContent.length>250&&!p.querySelector('pre')).slice(0,4); return ps.map(p=>{const walker=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),lines=new Map();let node; while(node=walker.nextNode()){for(let i=0;is.trim()).filter(Boolean);return{length:p.textContent.length,lineCharacters:strings.map(s=>s.length),lastLineExcludedMedian:(()=>{const x=strings.slice(0,-1).map(s=>s.length).sort((a,b)=>a-b);return x[Math.floor(x.length/2)]||0;})()}; }); }); } results.push(record); } } return {sourceHash:'0340b0d273bedcdca081ed2077bcb6959738fef0275737d4990271a3eddc0e3c',buildHash:'3d288ee728ff650f5bea0682254cfbfd832cf44338100d7e1d018cf757fabb95',base,session:'progcode-ds-cm-0340',results,errors,external}; }