(url1: string, url2: string, iframeWidth: string, widthKey: string)
| 9 | * @return {string} The generated HTML string. |
| 10 | */ |
| 11 | export function generateHtmlTemplate(url1: string, url2: string, iframeWidth: string, widthKey: string) { |
| 12 | return ` |
| 13 | <html> |
| 14 | <head> |
| 15 | <style> |
| 16 | body { |
| 17 | margin: 0; |
| 18 | background: black; |
| 19 | } |
| 20 | .iframe-container { |
| 21 | position: relative; |
| 22 | width: 100%; |
| 23 | height: 15000px; |
| 24 | overflow-y: scroll; |
| 25 | } |
| 26 | iframe { |
| 27 | position: absolute; |
| 28 | top: 0; |
| 29 | left: 50%; |
| 30 | transform: translateX(-50%); |
| 31 | width: ${iframeWidth}; |
| 32 | height: 100%; |
| 33 | border: none; |
| 34 | pointer-events: none; |
| 35 | overflow: hidden; |
| 36 | } |
| 37 | .overlay { |
| 38 | mix-blend-mode: difference; |
| 39 | } |
| 40 | .width-form { |
| 41 | position: fixed; |
| 42 | top: 10px; |
| 43 | left: 10px; |
| 44 | z-index: 9999; |
| 45 | } |
| 46 | </style> |
| 47 | </head> |
| 48 | <body> |
| 49 | <form action="/_diff" class="width-form"> |
| 50 | <select name="width" onchange="this.form.submit()"> |
| 51 | ${Object.keys(defaultWidths) |
| 52 | .map((key) => `<option value="${key}" ${widthKey === key ? "selected" : ""}>${key}</option>`) |
| 53 | .join("")} |
| 54 | </select> |
| 55 | </form> |
| 56 | <div class="iframe-container"> |
| 57 | <iframe id="frame1" src="${url1}"></iframe> |
| 58 | <iframe id="frame2" src="${url2}" class="overlay"></iframe> |
| 59 | </div> |
| 60 | </body> |
| 61 | </html> |
| 62 | `; |
| 63 | } |
no outgoing calls
no test coverage detected