Merge pull request #10 from phantamanta44/master

Adv item search: don't use identifiers with '+'
This commit is contained in:
hppeng-wynn 2021-02-04 01:05:20 -06:00 committed by GitHub
commit 253037d0d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 9 deletions

View file

@ -96,7 +96,7 @@ function init() {
// update url query string
const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}`
+ `?f=${encodeURIComponent(searchFilterField.value)}&s=${encodeURIComponent(searchSortField.value)}`;
+ `?f=${encodeURI(searchFilterField.value)}&s=${encodeURI(searchSortField.value)}`;
window.history.pushState({ path: newUrl }, '', newUrl);
// hide old search results
@ -174,10 +174,10 @@ function init() {
if (ndx !== -1) {
switch (entryStr.substring(0, ndx)) {
case 'f':
searchFilterField.field.value = decodeURIComponent(entryStr.substring(ndx + 1));
searchFilterField.field.value = decodeURI(entryStr.substring(ndx + 1));
break;
case 's':
searchSortField.field.value = decodeURIComponent(entryStr.substring(ndx + 1));
searchSortField.field.value = decodeURI(entryStr.substring(ndx + 1));
break;
}
}

View file

@ -98,7 +98,7 @@ Left of colon is what you type into the search bar (sometimes multiple things ca
['spelldmg', 'spelldam', 'spelldmg%', 'spelldam%', 'sdpct']: Spell Damage (%)
['spellrawdmg', 'spellrawdam', 'spellneutraldmg', 'spellneutraldam', 'sdraw']: Spell Damage (Raw)
['attackspeed', 'atkspd']: Item Attack Speed
['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'attackspeed+', 'atkspd+', 'atktier']: Attack Speed Bonus
['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'atktier']: Attack Speed Bonus
['sumattackspeed', 'totalattackspeed', 'sumatkspd', 'totalatkspd', 'sumatktier', 'totalatktier']: Total Attack Speed (Base speed + bonus)
['earthdef', 'edef']: Earth Defense Raw
@ -116,7 +116,7 @@ Left of colon is what you type into the search bar (sometimes multiple things ca
['sumdef%', 'totaldef%', 'sumdefpct', 'totaldefpct']: Total Defense %
['health', 'hp']: Health
['bonushealth', 'healthid', 'bonushp', 'hpid', 'health+', 'hp+', 'hpbonus']: Health bonus
['bonushealth', 'healthid', 'bonushp', 'hpid', 'hpbonus']: Health bonus
['sumhealth', 'sumhp', 'totalhealth', 'totalhp']: Total Health (health + health bonus)
['hpregen', 'hpr', 'hr', 'hprraw']: Raw Health Regen

View file

@ -156,7 +156,7 @@ const itemQueryProps = (function() {
const atkSpdIndices = { SUPER_SLOW: -3, VERY_SLOW: -2, SLOW: -1, NORMAL: 0, FAST: 1, VERY_FAST: 2, SUPER_FAST: 3 };
prop(['attackspeed', 'atkspd'], (i, ie) => i.atkSpd ? atkSpdIndices[i.atkSpd] : 0);
maxId(['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'attackspeed+', 'atkspd+', 'atktier'], 'atkTier');
maxId(['bonusattackspeed', 'bonusatkspd', 'attackspeedid', 'atkspdid', 'atktier'], 'atkTier');
sum(['sumattackspeed', 'totalattackspeed', 'sumatkspd', 'totalatkspd', 'sumatktier', 'totalatktier'], props.atkspd, props.atktier);
prop(['earthdef', 'edef'], (i, ie) => i.eDef || 0);
@ -174,7 +174,7 @@ const itemQueryProps = (function() {
sum(['sumdef%', 'totaldef%', 'sumdefpct', 'totaldefpct'], props.edefpct, props.tdefpct, props.wdefpct, props.fdefpct, props.adefpct);
prop(['health', 'hp'], (i, ie) => i.hp || 0);
maxId(['bonushealth', 'healthid', 'bonushp', 'hpid', 'health+', 'hp+', 'hpbonus'], 'hpBonus');
maxId(['bonushealth', 'healthid', 'bonushp', 'hpid', 'hpbonus'], 'hpBonus');
sum(['sumhealth', 'sumhp', 'totalhealth', 'totalhp'], props.hp, props.hpid);
maxId(['hpregen', 'hpr', 'hr', 'hprraw'], 'hprRaw');
@ -332,7 +332,7 @@ const compileQueryExpr = (function() {
continue;
}
// parse an identifier or boolean literal
if ((m = /^\w[\w\d+%]*/.exec(exprStr.substring(col))) !== null) {
if ((m = /^\w[\w\d%]*/.exec(exprStr.substring(col))) !== null) {
switch (m[0]) {
case 'true':
tokens.push({ type: 'bool', value: true });
@ -545,7 +545,6 @@ const compileQueryExpr = (function() {
case 'str': {
const lit = tokens.here.value;
tokens.advance();
console.log(lit);
return (i, ie) => lit;
}
case 'id':