mirror of
https://github.com/uparrows/LANraragi_cn.git
synced 2025-01-09 04:27:28 +08:00
Update index.js
This commit is contained in:
parent
3a1700aacf
commit
643b6fa2f5
@ -231,7 +231,7 @@ function loadCategories() {
|
||||
|
||||
//If more than 10 categories, the rest goes into a dropdown
|
||||
if (data.length > 10) {
|
||||
html += `<select class="favtag-btn">
|
||||
html += `<select id="catdropdown" class="favtag-btn">
|
||||
<option selected disabled>...</option>`;
|
||||
|
||||
for (var i = 10; i < data.length; i++) {
|
||||
@ -239,7 +239,7 @@ function loadCategories() {
|
||||
category = data[i];
|
||||
catName = encode(category.name);
|
||||
|
||||
html += `<option id='${category.id}' onclick='toggleCategory(this)'>
|
||||
html += `<option id='${category.id}'>
|
||||
${catName}
|
||||
</option>`;
|
||||
|
||||
@ -249,6 +249,9 @@ function loadCategories() {
|
||||
|
||||
$("#category-container").html(html);
|
||||
|
||||
// Add a listener on dropdown selection
|
||||
$("#catdropdown").on("change", () => toggleCategory($("#catdropdown")[0].selectedOptions[0]));
|
||||
|
||||
}).fail(data => showErrorToast("Couldn't load categories", data.error));
|
||||
}
|
||||
|
||||
@ -259,4 +262,4 @@ function encode(r) {
|
||||
return r[0].replace(/[\x26\x0A\<>'"]/g, function (r) { return "&#" + r.charCodeAt(0) + ";" });
|
||||
else
|
||||
return r.replace(/[\x26\x0A\<>'"]/g, function (r) { return "&#" + r.charCodeAt(0) + ";" })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user