PageSourceSearch

https://conversiontab.com/build/assets/compare-text-page-DNP2gjC5.js

js conversiontab.com collected 2026-09-24 10:07:20 UTC 2,853 bytes, 5 lines download raw bytes

1import{s as b}from"./ctToast-C2BAo121.js";import{r as B}from"./runWithButtonBusy-CmZJQ5-c.js";import"./app-gOHIPY12.js";import"./buttonBusy-DoyqFlQ8.js";const C=8e5;function E(o){const e=document.getElementById("ctCmpToast"),t=document.getElementById("ctCmpToastBody");b(e,{bodyEl:t,message:o,delay:9e3})}function x(o){const e=document.getElementById("ctCmpToastOk"),t=document.getElementById("ctCmpToastOkBody");b(e,{bodyEl:t,message:o,delay:5e3})}function h(o){return String(o).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function v(o,e){const t=o.split(`
2`),r=e.split(`
3`),g=Math.max(t.length,r.length),d=[],p=[];for(let l=0;l<g;l+=1){const u=t[l]??"",a=r[l]??"",i=Math.max(u.length,a.length);let n="",s="";for(let c=0;c<i;c+=1){const y=u[c]??"",f=a[c]??"";y===f?(n+=h(y),s+=h(f)):(n+=`<span class="text-danger">${h(y)}</span>`,s+=`<span class="text-danger">${h(f)}</span>`)}const m=l+1;d.push(`<div class="ct-cmp-sbs-line"><span class="ct-cmp-sbs-num">${m}</span> <span class="ct-cmp-sbs-txt">${n}</span></div>`),p.push(`<div class="ct-cmp-sbs-line"><span class="ct-cmp-sbs-num">${m}</span> <span class="ct-cmp-sbs-txt">${s}</span></div>`)}return{html1:d.join(""),html2:p.join("")}}function T(){const o=document.getElementById("ct-compare-text-root");if(!o)return;const e=document.getElementById("ctCmpA"),t=document.getElementById("ctCmpB"),r=document.getElementById("ctCmpRun"),g=document.getElementById("ctCmpReset"),d=document.getElementById("ctCmpOut1"),p=document.getElementById("ctCmpOut2");if(!e||!t||!r||!g||!d||!p)return;const l=document.getElementById("ctCmpALabel"),u=document.getElementById("ctCmpBLabel"),a=()=>{const n=`${e.value.length.toLocaleString()} chars · ${e.value.split(`
4`).length.toLocaleString()} lines`,s=`${t.value.length.toLocaleString()} chars · ${t.value.split(`
5`).length.toLocaleString()} lines`;l&&(l.textContent=n),u&&(u.textContent=s)},i=()=>{const n=e.value,s=t.value;if(n.length+s.length>C){d.innerHTML=`<p class="text-danger small mb-0">Combined text is too large for this page (max ${C.toLocaleString()} characters).</p>`,p.innerHTML="";return}const{html1:m,html2:c}=v(n,s);d.innerHTML=m,p.innerHTML=c};a(),e.addEventListener("input",()=>{a(),i()}),t.addEventListener("input",()=>{a(),i()}),r.addEventListener("click",()=>{var c;(c=window.getSelection())==null||c.removeAllRanges();const n=e.value,s=t.value;if(n===""||s===""){E("Please add text in both text areas to compare.");return}if(n===s){x("Both texts are identical.");return}const m=o.querySelector(".ct-codec-workspace__pane--out .ct-codec-workspace__hint");B(r,"Comparing…",()=>{i()},{minMs:260,hintEl:m instanceof HTMLElement?m:null,busyHint:"Comparing…",getDoneHint:()=>"Side-by-side diff"})}),g.addEventListener("click",()=>{e.value="",t.value="",a(),i()}),i()}export{T as initCompareTextPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.