-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathminified.js
More file actions
1 lines (1 loc) · 10.5 KB
/
minified.js
File metadata and controls
1 lines (1 loc) · 10.5 KB
1
javascript:(()=>{const N="%F0%9F%9B%B0 JS Endpoints",B=document,O=location,U=O.origin;let stealth=false;const excol={js:"#ffd54f",json:"#81c784",php:"#ce93d8",txt:"#90caf9",css:"#f48fb1",map:"#b39ddb",svg:"#ffab91",dir:"#64b5f6",other:"#e0e0e0"};const%20style=`#nx-wrap{position:fixed;inset:auto%205%%205%%205%;top:5%;z-index:99999999;background:#121212;color:#eee;font:14px/1.4%20system-ui,Segoe%20UI,Roboto,Arial;border:1px%20solid%20#2b2b2b;border-radius:12px;box-shadow:0%2010px%2030px%20rgba(0,0,0,.6);display:flex;flex-direction:column;max-height:90vh}#nx-head{display:flex;gap:10px;align-items:center;justify-content:space-between;padding:10px%2014px;border-bottom:1px%20solid%20#2b2b2b}#nx-title{margin:0;font-size:16px;color:#ffa500}#nx-tools{display:flex;flex-wrap:wrap;gap:8px}.nx-btn{background:#1e1e1e;border:1px%20solid%20#333;border-radius:8px;padding:6px%2010px;color:#eee;cursor:pointer}.nx-btn:hover{background:#2a2a2a}#nx-body{display:grid;grid-template-columns:260px%201fr;gap:10px;padding:12px%2014px;min-height:300px;overflow:hidden;direction:ltr;text-align:left}#nx-left{display:flex;flex-direction:column;gap:10px}#nx-search,#nx-regex{width:100%;padding:8px%2010px;border-radius:8px;border:1px%20solid%20#2d2d2d;background:#0f0f0f;color:#fff;outline:none;direction:auto;text-align:start}#nx-filters{display:flex;flex-wrap:wrap;gap:6px}.nx-chip{padding:4px%2010px;border:1px%20solid%20#333;border-radius:999px;cursor:pointer;background:#181818;color:#bbb;user-select:none}.nx-chip.sel{border-color:#ffa500;background:#2a2209;color:#ffa500;font-weight:600}#nx-right{overflow:auto;border:1px%20solid%20#242424;border-radius:10px}.nx-group{border-bottom:1px%20dashed%20#2a2a2a}.nx-ghead{position:sticky;top:0;background:#151515;padding:6px%2010px;font-weight:700;border-bottom:1px%20solid%20#202020;display:flex;align-items:center;gap:8px;cursor:pointer}.nx-ul{list-style:none;margin:0;padding:0}.nx-li{display:flex;align-items:center;gap:10px;justify-content:space-between;padding:6px%2010px;transition:background%20.15s;border-bottom:1px%20solid%20#1b1b1b}.nx-li:hover{background:#222}.nx-url{flex:1%201%20auto;min-width:0;color:#64b5f6;text-decoration:none;word-break:break-word}.nx-badge{font-size:12px;padding:2px%206px;border-radius:6px;background:#1e1e1e;border:1px%20solid%20#333;min-width:38px;text-align:center}.nx-ext{border-radius:6px;padding:2px%206px;border:1px%20solid%20#333}.nx-hidden{display:none}.nx-flex{display:flex;gap:6px;align-items:center}.nx-head-internal{background:#102d10!important;color:#7ddc7d}.nx-head-external{background:#2d1010!important;color:#ff6e6e;border-top:2px%20solid%20#ff6e6e}`;const%20addCSS=()=>{const%20s=B.createElement("style");s.textContent=style;B.head.appendChild(s)};const%20el=(t,p={},...ch)=>{const%20x=B.createElement(t);for(const%20k%20in%20p){if(k==="style"&&typeof%20p[k]==="object")Object.assign(x.style,p[k]);else%20if(k.startsWith("on"))x.addEventListener(k.slice(2),p[k]);else%20if(p[k]!=null)x.setAttribute(k,p[k])}ch.forEach(c=>x.append(c));return%20x};const%20wrap=el("div",{id:"nx-wrap"}),head=el("div",{id:"nx-head"}),title=el("h3",{id:"nx-title"},N),tools=el("div",{id:"nx-tools"}),close=el("button",{class:"nx-btn",onclick:()=>wrap.remove()},"%E2%9C%96"),body=el("div",{id:"nx-body"}),left=el("div",{id:"nx-left"}),right=el("div",{id:"nx-right"});const%20search=el("input",{id:"nx-search",placeholder:"Search%20paths%E2%80%A6"}),reInput=el("input",{id:"nx-regex",placeholder:"Custom%20regex%20(re-extract)%E2%80%A6"}),chips=el("div",{id:"nx-filters"});const%20chip=(lbl,key,sel=false)=>{const%20c=el("span",{class:"nx-chip"+(sel?"%20sel":""),"data-key":key,"data-label":lbl,onclick:()=>{c.classList.toggle("sel");updChipLabels();applyFilters();}},(sel?"%E2%9C%93%20":"%E2%80%A2%20")+lbl);chips.append(c)};["2xx","3xx","4xx","5xx","ERR"].forEach(k=>chip(k,k,false));const%20updChipLabels=()=>{chips.querySelectorAll(".nx-chip").forEach(ch=>{const%20on=ch.classList.contains("sel");ch.textContent=(on?"%E2%9C%93%20":"%E2%80%A2%20")+ch.getAttribute("data-label")})};const%20stealthBtn=el("button",{class:"nx-btn",onclick:()=>{stealth=!stealth;stealthBtn.textContent=stealth?"%F0%9F%95%B5%EF%B8%8F%20Stealth%20ON":"%F0%9F%9B%A0%20Active";}},"%F0%9F%9B%A0%20Active");const%20expandAllBtn=el("button",{class:"nx-btn",onclick:()=>{const%20groups=right.querySelectorAll(".nx-ul");const%20anyClosed=[...groups].some(g=>g.classList.contains("nx-hidden"));groups.forEach(g=>{g.classList.toggle("nx-hidden",!anyClosed);g.previousSibling.firstChild.textContent=g.classList.contains("nx-hidden")?"%E2%96%B8%20":"%E2%96%BE%20"});applyFilters();expandAllBtn.textContent=anyClosed?"Collapse%20All":"Expand%20All";}},"Expand%20All");const%20exportTXT=el("button",{class:"nx-btn",onclick:()=>download("txt")},"Export%20TXT");const%20exportCSV=el("button",{class:"nx-btn",onclick:()=>download("csv")},"Export%20CSV");const%20exportJSON=el("button",{class:"nx-btn",onclick:()=>download("json")},"Export%20JSON");tools.append(stealthBtn,expandAllBtn,exportTXT,exportCSV,exportJSON,close);head.append(title,tools);left.append(search,reInput,chips);body.append(left,right);addCSS();B.body.appendChild(wrap);wrap.append(head,body);const%20rxDefault=/(?:(?<=["'`])|^)(https?:\/\/[^\s"'`<>]+|\/[A-Za-z0-9_?&=\/\-#\.]+)(?=["'`]|$)/g;let%20RX=rxDefault;const%20unique=new%20Set();const%20push=u=>{if(u)unique.add(u.trim())};const%20ext=p=>{if(p.endsWith("/"))return"dir";const%20m=p.match(/\.([a-z0-9]+)(?:\?|#|$)/i);return%20m?m[1].toLowerCase():"other"};const%20colorFor=e=>excol[e]||excol.other;const%20norm=p=>/^https?:\/\//i.test(p)?p:p.startsWith("/")?U+p:new%20URL(p,O.href).href;const%20short=u=>{try{const%20url=new%20URL(u);return%20url.origin===U?url.pathname+url.search:url.href}catch{return%20u}};const%20collect=async()=>{const%20scripts=[...B.getElementsByTagName("script")];const%20html=B.documentElement.outerHTML||"";for(const%20m%20of%20html.matchAll(RX))push(m[1]||m[0]);for(const%20s%20of%20scripts){const%20src=s.getAttribute("src");if(src){try{const%20r=await%20fetch(src);const%20c=await%20r.text();for(const%20m%20of%20c.matchAll(RX))push(m[1]||m[0])}catch{}}}};const%20statusCache=new%20Map();const%20headCheck=async%20u=>{if(stealth)return%20null;if(statusCache.has(u))return%20statusCache.get(u);try{const%20r=await%20fetch(u,{method:"HEAD"});const%20info={code:r.status,ok:r.status>=200&&r.status<400};statusCache.set(u,info);return%20info}catch{return{code:"ERR",ok:false}}};const%20groupByDir=arr=>{const%20map=new%20Map([["Internal",new%20Map()],["External",new%20Map()]]);for(const%20raw%20of%20arr){const%20abs=norm(raw);let%20url;try{url=new%20URL(abs)}catch{continue}if(url.origin===U){const%20seg="/"+(url.pathname.split("/")[1]||"");const%20sub=map.get("Internal");if(!sub.has(seg))sub.set(seg,[]);sub.get(seg).push({raw,abs})}else{const%20host=url.origin;const%20sub=map.get("External");if(!sub.has(host))sub.set(host,[]);sub.get(host).push({raw,abs})}}return%20map};const%20itemRow=o=>{const%20e=ext(o.raw),u=o.abs,li=el("li",{class:"nx-li"});const%20a=el("a",{href:u,target:"_blank",class:"nx-url"},short(u));const%20ex=el("span",{class:"nx-ext",style:{color:colorFor(e)}},e);const%20st=el("span",{class:"nx-badge%20nx-status"},"%E2%80%A6");const%20copy=el("button",{class:"nx-btn",style:"padding:3px%206px",onclick:()=>navigator.clipboard.writeText(o.raw).then(()=>{copy.textContent="%E2%9C%93";setTimeout(()=>copy.textContent="%F0%9F%93%8B",700)})},"%F0%9F%93%8B");li.append(el("span",{class:"nx-flex"},a),el("span",{class:"nx-flex"},ex,st,copy));headCheck(u).then(info=>{if(info){st.textContent=info.code;st.style.color=info.ok?"#7ddc7d":"#ff6e6e"}});return%20li};const%20render=()=>{right.innerHTML="";const%20groups=groupByDir([...unique]);for(const%20[topName,submap]%20of%20groups){if(!submap.size)continue;const%20cls=topName==="Internal"?"nx-head-internal":"nx-head-external";const%20topWrap=el("div",{class:"nx-group"});const%20collapsed=(topName==="External");const%20topHead=el("div",{class:`nx-ghead%20${cls}`},"%E2%96%BE%20",el("span",{},topName),el("span",{style:{opacity:.7}},`%20(${[...submap.values()].reduce((a,b)=>a+b.length,0)})`));const%20topList=el("div",{class:collapsed?"nx-hidden":""});topHead.firstChild.textContent=collapsed?"%E2%96%B8%20":"%E2%96%BE%20";topHead.onclick=()=>{topList.classList.toggle("nx-hidden");topHead.firstChild.textContent=topList.classList.contains("nx-hidden")?"%E2%96%B8%20":"%E2%96%BE%20"};topWrap.append(topHead,topList);right.append(topWrap);for(const[g,items]of%20submap){const%20gwrap=el("div",{class:"nx-group"});const%20ghead=el("div",{class:"nx-ghead"},"%E2%96%B8%20",el("span",{},g),el("span",{style:{opacity:.7}},`%20(${items.length})`));const%20list=el("ul",{class:"nx-ul%20nx-hidden"});ghead.onclick=()=>{list.classList.toggle("nx-hidden");ghead.firstChild.textContent=list.classList.contains("nx-hidden")?"%E2%96%B8%20":"%E2%96%BE%20";if(!list.classList.contains("nx-hidden"))applyFilters()};items.forEach(o=>list.append(itemRow(o)));gwrap.append(ghead,list);topList.append(gwrap)}}updChipLabels();applyFilters()};const%20codeBucket=txt=>txt==="ERR"?"ERR":/^[2-5]/.test(txt)?`${txt[0]}xx`:"UNK";const%20getWanted=()=>new%20Set([...chips.querySelectorAll(".nx-chip.sel")].map(c=>c.getAttribute("data-key")));const%20applyFilters=()=>{const%20q=(search.value||"").toLowerCase();const%20wanted=getWanted();const%20groups=right.querySelectorAll(".nx-ul");if(q){groups.forEach(g=>{g.classList.remove("nx-hidden");g.previousSibling.firstChild.textContent="%E2%96%BE%20"})}right.querySelectorAll(".nx-li").forEach(li=>{const%20txt=(li.textContent||"").toLowerCase();let%20show=(!q||txt.includes(q));if(show&&wanted.size){const%20code=li.querySelector(".nx-status").textContent||"UNK";const%20buck=codeBucket(code);if(buck!=="UNK")show=wanted.has(buck)}li.style.display=show?"":"none"})};const%20download=fmt=>{const%20rows=[...unique].map(p=>({path:p,absolute:norm(p),ext:ext(p),status:(statusCache.get(norm(p))||{}).code||null}));let%20blob;let%20fn=`endpoints_${O.hostname}.${fmt}`;if(fmt==="txt")blob=new%20Blob([rows.map(r=>r.path).join("\n")],{type:"text/plain"});if(fmt==="csv"){const%20csv=["path,absolute,ext,status"].concat(rows.map(r=>[r.path,r.absolute,r.ext,r.status??""].map(x=>`"${String(x).replace(/"/g,'""')}"`).join(","))).join("\n");blob=new%20Blob([csv],{type:"text/csv"})}if(fmt==="json")blob=new%20Blob([JSON.stringify(rows,null,2)],{type:"application/json"});const%20a=el("a",{href:URL.createObjectURL(blob),download:fn});B.body.appendChild(a);a.click();a.remove()};search.oninput=()=>applyFilters();reInput.oninput=()=>{RX=reInput.value.trim()?new%20RegExp(reInput.value.trim(),"g"):rxDefault;unique.clear();statusCache.clear();(async()=>{await%20collect();render()})()};(async()=>{await%20collect();render()})()})()