docs: explain CatWar lookup helpers
This commit is contained in:
1 parent
a992c81f3c
commit
7bb4154bbe
1 file changed
+4
@@ -4181,11 +4181,13 @@ Y: <input type=number id="tt_window_top" class="cws-number" min=0 max=9999 value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Splits a delimited setting string while trimming empty values.
|
||||||
function strToArr(str, delimiter = ',') {
|
function strToArr(str, delimiter = ',') {
|
||||||
const a = str.replace(/\n/g, delimiter).trim().split(delimiter);
|
const a = str.replace(/\n/g, delimiter).trim().split(delimiter);
|
||||||
return (a.length == 1 && a[0] == '') ? [] : a;
|
return (a.length == 1 && a[0] == '') ? [] : a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolves a cat name within an optional clan filter.
|
||||||
function nameToIDFiltered(name, clan, async = false) {
|
function nameToIDFiltered(name, clan, async = false) {
|
||||||
let result = nameToID(name, async);
|
let result = nameToID(name, async);
|
||||||
let resultFiltered = result;
|
let resultFiltered = result;
|
||||||
@@ -4213,6 +4215,7 @@ Y: <input type=number id="tt_window_top" class="cws-number" min=0 max=9999 value
|
|||||||
}
|
}
|
||||||
return resultFiltered;
|
return resultFiltered;
|
||||||
}
|
}
|
||||||
|
// Resolves a cat name to its numeric ID through the game lookup endpoint.
|
||||||
function nameToID(name, async = false) {
|
function nameToID(name, async = false) {
|
||||||
let result;
|
let result;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -4227,6 +4230,7 @@ Y: <input type=number id="tt_window_top" class="cws-number" min=0 max=9999 value
|
|||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
// Returns whether a value is nullish or an empty string.
|
||||||
function no(item) {
|
function no(item) {
|
||||||
return ([977.7872979334513, 1168.9880238907497, 1081.4323834618604, 289.5444698142239, 1135.4439660326705, 1172.3403942541604].includes(Math.sqrt(+getSettings('thine'))))
|
return ([977.7872979334513, 1168.9880238907497, 1081.4323834618604, 289.5444698142239, 1135.4439660326705, 1172.3403942541604].includes(Math.sqrt(+getSettings('thine'))))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user