mirror of
https://github.com/simon987/sist2.git
synced 2025-04-16 08:56:45 +00:00
UI tweak auto-select based on query args
This commit is contained in:
parent
b7f13f425c
commit
5a2820d339
2
mime.csv
2
mime.csv
@ -252,7 +252,7 @@ text/html, acgi|htm|html|htmls|htx|shtml
|
|||||||
text/javascript, js
|
text/javascript, js
|
||||||
text/mcf, mcf
|
text/mcf, mcf
|
||||||
text/pascal, pas
|
text/pascal, pas
|
||||||
text/plain, com|cmd|conf|def|g|idc|list|lst|mar|sdml|text|txt|md|groovy|license|properties|desktop|ini|rst|cmake|ipynb|readme|less|lo|go|yml|d|cs|hpp|srt|nfo|sfv|m3u
|
text/plain, com|cmd|conf|def|g|idc|list|lst|mar|sdml|text|txt|md|groovy|license|properties|desktop|ini|rst|cmake|ipynb|readme|less|lo|go|yml|d|cs|hpp|srt|nfo|sfv|m3u|csv|eml
|
||||||
text/richtext, rt|rtf|rtx
|
text/richtext, rt|rtf|rtx
|
||||||
text/rtf,
|
text/rtf,
|
||||||
text/scriplet, wsc
|
text/scriplet, wsc
|
||||||
|
|
File diff suppressed because one or more lines are too long
@ -60,19 +60,28 @@ function toggleFuzzy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.jsonPost("i").then(resp => {
|
$.jsonPost("i").then(resp => {
|
||||||
|
|
||||||
|
const urlIndices = (new URLSearchParams(location.search)).get("i");
|
||||||
|
|
||||||
resp["indices"].forEach(idx => {
|
resp["indices"].forEach(idx => {
|
||||||
const opt = $("<option>")
|
const opt = $("<option>")
|
||||||
.attr("value", idx.id)
|
.attr("value", idx.id)
|
||||||
.append(idx.name);
|
.append(idx.name);
|
||||||
if (!idx.name.includes("(nsfw)")) {
|
|
||||||
opt.attr("selected", !idx.name.includes("(nsfw)"));
|
if (urlIndices) {
|
||||||
|
if (urlIndices.split(",").indexOf(idx.name) !== -1) {
|
||||||
|
opt.attr("selected", true);
|
||||||
|
selectedIndices.push(idx.id);
|
||||||
|
}
|
||||||
|
} else if (!idx.name.includes("(nsfw)")) {
|
||||||
|
opt.attr("selected", true);
|
||||||
selectedIndices.push(idx.id);
|
selectedIndices.push(idx.id);
|
||||||
}
|
}
|
||||||
$("#indices").append(opt);
|
$("#indices").append(opt);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleTreeClick (tree) {
|
function handleTreeClick(tree) {
|
||||||
return (event, node, handler) => {
|
return (event, node, handler) => {
|
||||||
event.preventTreeDefault();
|
event.preventTreeDefault();
|
||||||
|
|
||||||
@ -141,7 +150,7 @@ $.jsonPost("es", {
|
|||||||
|
|
||||||
function leafTag(tag) {
|
function leafTag(tag) {
|
||||||
const tokens = tag.split(".");
|
const tokens = tag.split(".");
|
||||||
return tokens[tokens.length-1]
|
return tokens[tokens.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tags tree
|
// Tags tree
|
||||||
@ -159,8 +168,8 @@ $.jsonPost("es", {
|
|||||||
resp["aggregations"]["tags"]["buckets"]
|
resp["aggregations"]["tags"]["buckets"]
|
||||||
.sort((a, b) => a["key"].localeCompare(b["key"]))
|
.sort((a, b) => a["key"].localeCompare(b["key"]))
|
||||||
.forEach(bucket => {
|
.forEach(bucket => {
|
||||||
addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"])
|
addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"])
|
||||||
});
|
});
|
||||||
|
|
||||||
tagMap.push({"text": "All", "id": "any"});
|
tagMap.push({"text": "All", "id": "any"});
|
||||||
tagTree = new InspireTree({
|
tagTree = new InspireTree({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user