"/index2.html": "<html>\r\n <head>\r\n <title>Excel Navigate Helper</title>\r\n <link href=\"https://cdn.jsdelivr.net/npm/
[email protected]/dist/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH\" crossorigin=\"anonymous\">\r\n <script src=\"https://cdn.datatables.net/2.0.8/js/dataTables.js\"></script>\r\n <link href=\"https://cdn.datatables.net/2.0.8/css/dataTables.dataTables.css\" rel=\"stylesheet\">\r\n \r\n <script type=\"module\"> (function(){const s=document.createElement(\"link\").relList;if(s&&s.supports&&s.supports(\"modulepreload\"))return;for(const e of document.querySelectorAll('link[rel=\"modulepreload\"]'))c(e);new MutationObserver(e=>{for(const t of e)if(t.type===\"childList\")for(const a of t.addedNodes)a.tagName===\"LINK\"&&a.rel===\"modulepreload\"&&c(a)}).observe(document,{childList:!0,subtree:!0});function o(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===\"use-credentials\"?t.credentials=\"include\":e.crossOrigin===\"anonymous\"?t.credentials=\"omit\":t.credentials=\"same-origin\",t}function c(e){if(e.ep)return;e.ep=!0;const t=o(e);fetch(e.href,t)}})();const f={checkResult:async function(n,s,o){return await i(\"checkResult\",arguments)},getWindows:async function(){return await i(\"getWindows\",arguments)},launchExcel:async function(){return await i(\"launchExcel\",arguments)},getActiveExcelRow:async function(){return await i(\"getActiveExcelRow\",arguments)},closeBackend:async function(){return await i(\"closeBackend\",arguments)}};async function i(n,...s){const o=window.location.protocol,c=window.location.hostname;return await(await fetch(`${o}//${c}:8080/api?cmd=${n}&args=${encodeURIComponent(JSON.stringify(s))}`)).json()}let p=null,m=null,h={},g=!0;function w(n,s){h={},s.split(`\n`).forEach(o=>{const c=o.split(\":\");c.length>=2&&(h[c[0].trim()]=c.slice(1).join(\":\").trim())})}async function y(n,s=!1){const o=await f.getActiveExcelRow();if(!s&&m&&JSON.stringify(m)===JSON.stringify(o))return;m=o,p&&p.remove();const c=document.createElement(\"table\");c.classList.add(\"table\",\"table-bordered\"),n.appendChild(c);const e=document.createElement(\"tbody\");c.appendChild(e);for(let t=0;t<o.data.length;t++){const a=document.createElement(\"tr\");e.appendChild(a);const l=document.createElement(\"td\");l.style.fontWeight=\"bold\",a.appendChild(l),l.textContent=o.headings[t]||\"\",g||(l.style.display=\"none\");const r=document.createElement(\"td\");a.appendChild(r);const x=h[o.headings[t]];r.style.cssText=x||\"\";const d=o.data[t];if(d.startsWith(\"http\")){const u=document.createElement(\"a\");u.href=d,u.textContent=d,r.appendChild(u)}else r.textContent=o.data[t]}p=c}async function b(){const n=document.createElement(\"div\");document.body.appendChild(n);const s=document.createElement(\"div\");s.classList.add(\"alert\",\"alert-info\"),s.innerText=`This app keep sync with Excel and show the data in current(active) row so that you can see all columns without scrolling if there are too many columns.\nIt assume there is a heading row in Excel and use the heading as the first column in the table. `,n.appendChild(s);const o=document.createElement(\"button\");o.classList.add(\"btn\",\"btn-primary\"),o.style.marginRight=\"10px\",o.textContent=\"Launch Excel to open file\",o.onclick=async()=>{await f.launchExcel()},n.append(o);const c=document.createElement(\"button\");c.classList.add(\"btn\",\"btn-secondary\"),c.style.marginRight=\"10px\",c.textContent=\"Edit Style\",n.append(c),c.onclick=()=>{const l=document.getElementById(\"styleText\");l&&(l.style.display=l.style.display===\"none\"?\"block\":\"none\")};const e=document.createElement(\"button\");e.classList.add(\"btn\",\"btn-secondary\"),e.style.marginRight=\"10px\",e.textContent=\"Toggle Heading\",n.append(e),e.onclick=()=>{g=!g,y(n,!0)};const t=document.createElement(\"button\");t.classList.add(\"btn\",\"btn-danger\"),t.textContent=\"Close\",t.onclick=async()=>{await f.closeBackend(),window.close()},n.append(t);const a=document.createElement(\"textarea\");a.classList.add(\"form-control\"),a.id=\"styleText\",a.style.width=\"100%\",a.style.height=\"200px\",a.style.display=\"none\",a.style.marginTop=\"10px\",a.style.fontFamily=\"monospace\",a.value=localStorage.getItem(\"styleText\")||\"\",n.appendChild(a),a.onkeydown=()=>{const l=a.value;w(n,l),y(n,!0),localStorage.setItem(\"styleText\",l)},w(n,a.value),n.appendChild(document.createElement(\"p\")),setInterval(y,1e3,n)}document.addEventListener(\"DOMContentLoaded\",function(){b()},!1);\n </script>\n </head>\r\n <body style=\"padding:10px;\">\r\n </body>\r\n</html>\r\n",
0 commit comments