|
77 | 77 | <div id="planilha-wrapper"> |
78 | 78 | <div id="planilha-container"><noscript>Enable JavaScript!</noscript></div> |
79 | 79 | </div> |
80 | | - <div id="planilha-rodape">v1.2 - by <a target="_blank" href="https://t.me/VD_Priv8">@VD_Priv8</a> - Join <a target="_blank" href="https://t.me/RootDetected">@RootDetected</a></div> |
| 80 | + <div id="planilha-rodape">v1.3 - by <a target="_blank" href="https://t.me/VD_Priv8">@VD_Priv8</a> - Join <a target="_blank" href="https://t.me/RootDetected">@RootDetected</a></div> |
81 | 81 | </div> |
82 | 82 | <script> |
83 | | - const path = (location.hash && location.hash !== "#") ? location.hash.slice(1) : "Empty"; |
| 83 | + const url = new URL(location.href); |
| 84 | + const rawPath = url.hash || url.search; |
| 85 | + const path = rawPath ? rawPath.replace(/^[#?]/, "") : ""; |
84 | 86 | const script = document.createElement("script"); |
85 | 87 | script.src = `tables/${path}.js`; |
86 | 88 | script.onload = () => initPlanilha(); |
87 | | - script.onerror = () => alert("Table not found: " + path + "."); |
| 89 | + script.onerror = () => { |
| 90 | + fetch("https://api_github_com.vd171.ru/repos/RootDetected/RootDetected.github.io/contents/tables") |
| 91 | + .then(r => r.json()) |
| 92 | + .then(files => { |
| 93 | + const lista = files |
| 94 | + .filter(file => file.name.endsWith(".js")) |
| 95 | + .map(file => { |
| 96 | + const nome = file.name.replace(".js", ""); |
| 97 | + return `<li><a href="?${nome}">${nome}</a></li>` |
| 98 | + }) |
| 99 | + .join(""); |
| 100 | + document.getElementById("planilha-container").innerHTML = `<div style="padding:20px"> |
| 101 | + <b style="color:red">Table not found.</b><br><br> |
| 102 | + <b>Tables available:</b> |
| 103 | + <ul>${lista}</ul> |
| 104 | + </div>` |
| 105 | + }) |
| 106 | + .catch(() => { document.getElementById("planilha-wrapper").innerHTML = `<b style="padding:20px;color:red">Fail to fetch tables list.</b>` }) |
| 107 | + }; |
88 | 108 | document.head.appendChild(script); |
89 | 109 | function initPlanilha(){ |
90 | 110 | document.getElementById("planilha-topo").innerHTML = info; |
|
124 | 144 | resizerRight.style.padding = "8px"; |
125 | 145 | resizerRight.addEventListener("mousedown", iniciarResize(i)); |
126 | 146 | wrapper.appendChild(resizerRight); |
127 | | - |
128 | 147 | th.appendChild(wrapper); |
129 | 148 | trHead.appendChild(th) |
130 | 149 | }); |
|
0 commit comments