\n\n

    Hello GameZipper

    \n

    Paste any source code here.

    \n\n'; function esc(s){return String(s).replace(/&/g,'&').replace(//g,'>');} function detect(code){const c=code.trim();if(!c)return '—';if(/^<\?xml|<\w+[\s>]/i.test(c))return 'HTML / XML';if(/^\s*[\[{]/.test(c)){try{JSON.parse(c);return 'JSON';}catch(e){}}if(/\b(function|const|let|var|=>|import|export)\b/.test(c))return 'JavaScript';if(/\b(def|class|import|from|print\()\b/.test(c))return 'Python';if(/[.#][\w-]+\s*\{|@media\b/.test(c))return 'CSS';return 'Text';} function current(){let v=$('#input').value;if($('#trimEmpty').checked)v=v.replace(/^\s*\n/,'').replace(/\n\s*$/,'');return v;} function render(){const code=current();const lines=code.length?code.split('\n'):[''];$('#viewer').style.whiteSpace=$('#wrap').checked?'pre-wrap':'pre';$('#viewer').innerHTML=lines.map((line,i)=>`
    ${i+1}${esc(line)||' '}
    `).join('');const bytes=new Blob([code]).size;$('#stats').innerHTML=`
    ${code?lines.length:0}${t('lines')}
    ${code.length}${t('chars')}
    ${bytes}${t('bytes')}
    ${detect(code)}${t('language')}
    `;} function loadExample(){ $('#input').value=sample; render(); } function clearAll(){ $('#input').value=''; render(); } function download(){const blob=new Blob([current()],{type:'text/plain'});const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='source-code.txt';a.click();setTimeout(()=>URL.revokeObjectURL(a.href),1000);} $('#toolbar').innerHTML=``; $('#input').addEventListener('input',render);$('#wrap').addEventListener('change',render);$('#trimEmpty').addEventListener('change',render);$('#file').addEventListener('change',e=>{const f=e.target.files[0];if(!f)return;const r=new FileReader();r.onload=()=>{$('#input').value=String(r.result||'');render();};r.readAsText(f);}); GZ.renderToolPage({category:'dev',titleKey:'toolTitle',descKey:'toolDesc',howToSteps:['step1','step2','step3','step4'],related:[{icon:'👁️',href:'/dev/html-viewer.html',name:'HTML Viewer'},{icon:'✅',href:'/dev/html-validator.html',name:'HTML Validator'},{icon:'📄',href:'/dev/html-formatter.html',name:'HTML Formatter'},{icon:'🎯',href:'/dev/regex-extractor.html',name:'Regex Extractor'}]}); loadExample();