{"publisher":"WESWOO","measured_on":"2026-11-24","id":"newsletter-trigger","url":"https://www.weswoo.com/guides/modules/delivery/?module=newsletter-trigger#newsletter-trigger","runtime":"Chrome 157.0.8103.79","method":{"zh":"WESWOO 在独立 Chrome 中运行本条目的公开脚本，按下述条件提供最小页面与样例记录。","en":"WESWOO ran this entry’s published script in standalone Chrome with the fixture markup and records described here."},"action":{"zh":"在相同短计时和相同滚动门槛下，一次让页面空闲，一次让外部输入框保持焦点，读取订阅弹窗是否开启。","en":"Use the same short timer and scroll threshold. Compare an idle page with focus held in an external input. Read whether the popup opened."},"source_file":"assets/ww-newsletter-trigger.js","source_sha256":"300bbb5623089f6a4987bf708a6301315f9cedbd838aca1ec81c638d39f2c13c","fixture_html":"<input id=outside><div data-ww-newsletter-inline><input type=email></div><button hidden data-ww-newsletter-open></button><dialog id=news data-ww-newsletter-dialog><button data-ww-dialog-close>Close</button></dialog>","readings":["open","closed"],"replay_function":"async function compare({id,code,dep,fixture,variant}){\n const blob=code=>URL.createObjectURL(new Blob([code],{type:'text/javascript'})),d=blob(dep),url=blob(code.replace(\"'./ww-dialog-controller.js'\",JSON.stringify(d))),m=await import(url);\n const root=document.querySelector('main');root.innerHTML=fixture;\n const el=s=>root.querySelector(s),wait=ms=>new Promise(r=>setTimeout(r,ms));let result;\n switch(id){\n case 'newsletter-trigger':{if(variant)el('#outside').focus();m.bindNewsletter(root,{delayMs:5,threshold:0});await wait(100);result=el('dialog').open?'open':'closed';break;}\n\n }\n URL.revokeObjectURL(url);URL.revokeObjectURL(d);return result;\n}","usage":"Open a fresh page with a main element. Run variant=false, then true in a new page. Width is 1100 px except mobile-filter-drawer with variant=true (390 px). Height 700 px. Use https://example.invalid/collection, adding ?filter.v.option.color=blue&sort_by=price&page=2 for variant=true. Pass code from source_file and dep from assets/ww-dialog-controller.js. No shop endpoint is called."}