Skip to content

Commit cd27abb

Browse files
authored
V1.3
1 parent 601a440 commit cd27abb

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

index.html

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,34 @@
7777
<div id="planilha-wrapper">
7878
<div id="planilha-container"><noscript>Enable JavaScript!</noscript></div>
7979
</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>
8181
</div>
8282
<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(/^[#?]/, "") : "";
8486
const script = document.createElement("script");
8587
script.src = `tables/${path}.js`;
8688
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+
};
88108
document.head.appendChild(script);
89109
function initPlanilha(){
90110
document.getElementById("planilha-topo").innerHTML = info;
@@ -124,7 +144,6 @@
124144
resizerRight.style.padding = "8px";
125145
resizerRight.addEventListener("mousedown", iniciarResize(i));
126146
wrapper.appendChild(resizerRight);
127-
128147
th.appendChild(wrapper);
129148
trHead.appendChild(th)
130149
});

0 commit comments

Comments
 (0)