-
Notifications
You must be signed in to change notification settings - Fork 2
/
index_bottom.html
191 lines (165 loc) · 7.22 KB
/
index_bottom.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
</tbody>
</table>
<dialog id="diaDialog">
<form method="dialog">
<div id="diaMapname">🥑</div>
<ul>
<li><a id="diaDownloadBz2" href="https://main.fastdl.me/h2/f698fd3d702567d250af541d81e7488d6abf4de3/bhop_badges.bsp.bz2">Download .bsp.bz2</a></li>
<li><a id="diaDownloadBsp" href="https://main.fastdl.me/h2/f698fd3d702567d250af541d81e7488d6abf4de3/bhop_badges.bsp.bz2">Download .bsp (todo)</a></li>
<br>
<li><a id="diaHotlink" href="https://main.fastdl.me/m2/bhop_badges.bsp.bz2">Short Hotlink</a></li>
<br>
<li><a id="diaFilelist" href="https://github.com/srcwr/maps-cstrike-more/blob/master/filelist/" target="_blank" rel="noopener noreferrer">Packed file list</a></li>
<li><a id="diaEntites" href="https://github.com/srcwr/maps-cstrike-more/blob/master/entitiesgz/" target="_blank" rel="noopener noreferrer">Entities (todo)</a></li>
<li><a id="diaSources" href="https://github.com/srcwr/maps-cstrike/search?q=f698fd3d702567d250af541d81e7488d6abf4de3" target="_blank" rel="noopener noreferrer">Scraped from...</a></li>
<br>
</ul>
<p>Sometimes the `Scraped from` search doesn't show anything.
<br>Try reloading the page if that happens.
<br>Also the Gamebanana scrape csv is too big to be indexed.</p>
<button value="close">Close</button>
</form>
</dialog>
<script>
const diaDialog = document.getElementById("diaDialog");
const diaMapname = document.getElementById("diaMapname");
const diaDownloadBz2 = document.getElementById("diaDownloadBz2");
const diaDownloadBsp = document.getElementById("diaDownloadBsp");
const diaFilelist = document.getElementById("diaFilelist");
const diaEntites = document.getElementById("diaEntites");
const diaSources = document.getElementById("diaSources");
const diaHotlink = document.getElementById("diaHotlink");
if (document.title.includes("hashed"))
diaHotlink.parentNode.style.visibility = "hidden";
var selectedRow = {};
diaDialog.addEventListener("close", () => {
selectedRow.style.outline = "";
});
function download_mapname2(event) {
if (event.target.tagName != "A") return;
if (event.target.getAttribute("href") != "#") return;
console.log(event.target);
var mapname = event.target.innerText;
var hash = event.target.parentNode.parentNode.children[1].innerText;
selectedRow = event.target.parentNode.parentNode;
selectedRow.style.outline = "#ff0 solid 4px";
diaMapname.innerText = mapname;
diaDownloadBz2.href = `https://main.fastdl.me/h2/${hash}/${mapname}.bsp.bz2`;
//diaDownloadBsp.href = `https://main.fastdl.me/h2/${hash}/${mapname}.bsp.bz2`; // javascript to extract bsp...
diaFilelist.href = `https://github.com/srcwr/maps-cstrike-more/blob/master/filelist/${hash}.csv`;
diaEntites.href = `https://github.com/srcwr/maps-cstrike-more/blob/master/entitiesgz/${hash}.cfg.gz`; // navigate to CF Worker's URL that downloads from GH & extracts gz?
diaSources.href = `https://github.com/srcwr/maps-cstrike/search?q=${hash}`;
diaHotlink.href = `https://main.fastdl.me/m2/${mapname}.bsp.bz2`;
diaDialog.showModal();
event.preventDefault();
return false;
}
function download_mapname(event) {
if (event.target.tagName != "A") return;
if (event.target.getAttribute("href") != "#") return;
console.log(event.target);
var mapname = event.target.innerText;
var hash = event.target.parentNode.parentNode.children[1].innerText;
var anchor = document.createElement("a");
//anchor.href = "../hashed/" + hash /*+ "/" + mapname*/ + ".bsp.bz2";
//anchor.href = "/hashed/" + hash + "/" + mapname + ".bsp.bz2";
anchor.href = `https://main.fastdl.me/h2/${hash}/${mapname}.bsp.bz2`;
anchor.download = mapname + ".bsp.bz2";
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
event.preventDefault();
history.replaceState(null, null, ' '); // deletes the '#' from the URL magically somehow idk I didn't read the docs, thanks stackoverflow
return false;
}
window.onclick = download_mapname;
/*
const a = document.getElementById("list").children[1].children;
const b = document.getElementById("recentlyadded").children[1].children;
const rows = [...a, ...b];
for (var i = 0; i < rows.length; i++) {
rows[i].children[0].children[0].addEventListener("click", download_mapname);
}
*/
</script>
<script>
// https://github.com/tofsjonas/sortable/blob/main/sortable.js
// https://github.com/tofsjonas/sortable/blob/main/LICENSE
document.addEventListener('click', function (e) {
try {
// allows for elements inside TH
function findElementRecursive(element, tag) {
return element.nodeName === tag ? element : findElementRecursive(element.parentNode, tag)
}
var descending_th_class = ' dir-d '
var ascending_th_class = ' dir-u '
var ascending_table_sort_class = 'asc'
var regex_dir = / dir-(u|d) /
var regex_table = /\bsortable\b/
var alt_sort = e.shiftKey || e.altKey
var element = findElementRecursive(e.target, 'TH')
var tr = findElementRecursive(element, 'TR')
var table = findElementRecursive(tr, 'TABLE')
function reClassify(element, dir) {
element.className = element.className.replace(regex_dir, '') + dir
}
function getValue(element) {
// If you aren't using data-sort and want to make it just the tiniest bit smaller/faster
// comment this line and uncomment the next one
/*var value =
(alt_sort && element.getAttribute('data-sort-alt')) || element.getAttribute('data-sort') || element.innerText
return value*/
return element.innerText
}
if (regex_table.test(table.className)) {
var column_index
var nodes = tr.cells
// Reset thead cells and get column index
for (var i = 0; i < nodes.length; i++) {
if (nodes[i] === element) {
column_index = element.getAttribute('data-sort-col') || i
} else {
reClassify(nodes[i], '')
}
}
var dir = descending_th_class
// Check if we're sorting ascending or descending
if (
element.className.indexOf(descending_th_class) !== -1 ||
(table.className.indexOf(ascending_table_sort_class) !== -1 &&
element.className.indexOf(ascending_th_class) == -1)
) {
dir = ascending_th_class
}
// Update the `th` class accordingly
reClassify(element, dir)
// Extract all table rows
var org_tbody = table.tBodies[0]
// Get the array rows in an array, so we can sort them...
var rows = [].slice.call(org_tbody.rows, 0)
var reverse = dir === ascending_th_class
// Sort them using Array.prototype.sort()
rows.sort(function (a, b) {
var x = getValue((reverse ? a : b).cells[column_index])
var y = getValue((reverse ? b : a).cells[column_index])
var bool = x.length && y.length && !isNaN(x - y) ? x - y : x.localeCompare(y)
return bool
})
// Make a clone without content
var clone_tbody = org_tbody.cloneNode()
// Fill it with the sorted values
while (rows.length) {
clone_tbody.appendChild(rows.splice(0, 1)[0])
}
// And finally replace the unsorted table with the sorted one
table.replaceChild(clone_tbody, org_tbody)
}
} catch (error) {
//console.log(error)
}
})
</script>
<br>this website's privacy/cookie policies can be viewed at the bottom of the <a href="https://fastdl.me/">homepage</a>
<br>
<br>this webpage (excluding the sortable.js code/css and the favicon.ico) is licensed under the <a href="/WTFPL.txt">DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE</a> (WTFPL)
<br>.txt files & .csv files are also WTFPL