From 28a1e81a6c95fae88450e652ef6007576a140e10 Mon Sep 17 00:00:00 2001 From: b Date: Sun, 17 Oct 2021 18:21:02 -0700 Subject: [PATCH] Move javascript files into their own folder --- atlas.html | 6 +- builder2.html | 30 +- crafter.html | 24 +- customizer.html | 30 +- dps_vis.html | 8 +- index.html | 30 +- item.html | 30 +- items.html | 20 +- items_2.html | 22 +- items_2_help.html | 6 +- atlas.js => js/atlas.js | 0 build.js => js/build.js | 0 build2.js => js/build2.js | 0 build_utils.js => js/build_utils.js | 0 builder.js => js/builder.js | 0 craft.js => js/craft.js | 0 crafter.js => js/crafter.js | 0 custom.js => js/custom.js | 0 customizer.js => js/customizer.js | 0 damage_calc.js => js/damage_calc.js | 0 display.js => js/display.js | 0 .../display_constants.js | 0 dps_vis.js => js/dps_vis.js | 0 expr_parser.js => js/expr_parser.js | 0 icons.js => js/icons.js | 0 item.js => js/item.js | 0 items.js => js/items.js | 71 ++ items_2.js => js/items_2.js | 0 load.js => js/load.js | 0 load_ing.js => js/load_ing.js | 0 load_map.js => js/load_map.js | 0 loadheader.js => js/loadheader.js | 5 +- map.js => js/map.js | 0 powders.js => js/powders.js | 0 query.js => js/query.js | 0 query_2.js => js/query_2.js | 0 skillpoints.js => js/skillpoints.js | 0 utils.js => js/utils.js | 0 map.html | 10 +- test/index.html | 1031 ----------------- 40 files changed, 181 insertions(+), 1142 deletions(-) rename atlas.js => js/atlas.js (100%) rename build.js => js/build.js (100%) rename build2.js => js/build2.js (100%) rename build_utils.js => js/build_utils.js (100%) rename builder.js => js/builder.js (100%) rename craft.js => js/craft.js (100%) rename crafter.js => js/crafter.js (100%) rename custom.js => js/custom.js (100%) rename customizer.js => js/customizer.js (100%) rename damage_calc.js => js/damage_calc.js (100%) rename display.js => js/display.js (100%) rename display_constants.js => js/display_constants.js (100%) rename dps_vis.js => js/dps_vis.js (100%) rename expr_parser.js => js/expr_parser.js (100%) rename icons.js => js/icons.js (100%) rename item.js => js/item.js (100%) rename items.js => js/items.js (65%) rename items_2.js => js/items_2.js (100%) rename load.js => js/load.js (100%) rename load_ing.js => js/load_ing.js (100%) rename load_map.js => js/load_map.js (100%) rename loadheader.js => js/loadheader.js (97%) rename map.js => js/map.js (100%) rename powders.js => js/powders.js (100%) rename query.js => js/query.js (100%) rename query_2.js => js/query_2.js (100%) rename skillpoints.js => js/skillpoints.js (100%) rename utils.js => js/utils.js (100%) delete mode 100644 test/index.html diff --git a/atlas.html b/atlas.html index b320e15..8e7ef6c 100644 --- a/atlas.html +++ b/atlas.html @@ -37,8 +37,8 @@ - - - + + + diff --git a/builder2.html b/builder2.html index f96c562..356f470 100644 --- a/builder2.html +++ b/builder2.html @@ -982,20 +982,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/crafter.html b/crafter.html index 8afa493..029b4c8 100644 --- a/crafter.html +++ b/crafter.html @@ -213,17 +213,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/customizer.html b/customizer.html index ed72a45..cf7e4b8 100644 --- a/customizer.html +++ b/customizer.html @@ -1874,20 +1874,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/dps_vis.html b/dps_vis.html index 6901420..8df124b 100644 --- a/dps_vis.html +++ b/dps_vis.html @@ -64,9 +64,9 @@

- - - - + + + + diff --git a/index.html b/index.html index c907631..fa75fc6 100644 --- a/index.html +++ b/index.html @@ -1012,20 +1012,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/item.html b/item.html index 00ea18f..b9bd8ce 100644 --- a/item.html +++ b/item.html @@ -52,20 +52,20 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/items.html b/items.html index f259b38..e9a519c 100644 --- a/items.html +++ b/items.html @@ -122,15 +122,15 @@
- - - - - - - - - - + + + + + + + + + + diff --git a/items_2.html b/items_2.html index 246836d..7a714f5 100644 --- a/items_2.html +++ b/items_2.html @@ -59,16 +59,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/items_2_help.html b/items_2_help.html index 79a3c72..4b78cbb 100644 --- a/items_2_help.html +++ b/items_2_help.html @@ -72,7 +72,7 @@

Is there a formal specification?

-

You can check out the implementation notes for the expression parser, as well as the parser code itself, over at the WynnBuilder GitHub repository. You can also ask around on the Atlas Inc. Discord server if you want more details.

+

You can check out the implementation notes for the expression parser, as well as the parser code itself, over at the WynnBuilder GitHub repository. You can also ask around on the Atlas Inc. Discord server if you want more details.

@@ -208,7 +208,7 @@ docsFns.append(genDocEntry(entry[0], entry[1], null, entry[2])); } - - + + diff --git a/atlas.js b/js/atlas.js similarity index 100% rename from atlas.js rename to js/atlas.js diff --git a/build.js b/js/build.js similarity index 100% rename from build.js rename to js/build.js diff --git a/build2.js b/js/build2.js similarity index 100% rename from build2.js rename to js/build2.js diff --git a/build_utils.js b/js/build_utils.js similarity index 100% rename from build_utils.js rename to js/build_utils.js diff --git a/builder.js b/js/builder.js similarity index 100% rename from builder.js rename to js/builder.js diff --git a/craft.js b/js/craft.js similarity index 100% rename from craft.js rename to js/craft.js diff --git a/crafter.js b/js/crafter.js similarity index 100% rename from crafter.js rename to js/crafter.js diff --git a/custom.js b/js/custom.js similarity index 100% rename from custom.js rename to js/custom.js diff --git a/customizer.js b/js/customizer.js similarity index 100% rename from customizer.js rename to js/customizer.js diff --git a/damage_calc.js b/js/damage_calc.js similarity index 100% rename from damage_calc.js rename to js/damage_calc.js diff --git a/display.js b/js/display.js similarity index 100% rename from display.js rename to js/display.js diff --git a/display_constants.js b/js/display_constants.js similarity index 100% rename from display_constants.js rename to js/display_constants.js diff --git a/dps_vis.js b/js/dps_vis.js similarity index 100% rename from dps_vis.js rename to js/dps_vis.js diff --git a/expr_parser.js b/js/expr_parser.js similarity index 100% rename from expr_parser.js rename to js/expr_parser.js diff --git a/icons.js b/js/icons.js similarity index 100% rename from icons.js rename to js/icons.js diff --git a/item.js b/js/item.js similarity index 100% rename from item.js rename to js/item.js diff --git a/items.js b/js/items.js similarity index 65% rename from items.js rename to js/items.js index 4a1194e..2ae3293 100644 --- a/items.js +++ b/js/items.js @@ -136,6 +136,77 @@ function displayItems(items_copy) { let items_expanded; + // updates the current search state from the search query input boxes + function updateSearch() { + // compile query expressions, aborting if nothing has changed or either fails to compile + const changed = searchFilterField.compile() | searchSortField.compile(); + if (!changed || searchFilterField.output === null || searchSortField.output === null) return; + + // update url query string + const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}` + + `?f=${encodeURIComponent(searchFilterField.value)}&s=${encodeURIComponent(searchSortField.value)}`; + window.history.pushState({ path: newUrl }, '', newUrl); + + // hide old search results + itemListFooter.innerText = ''; + for (const itemEntry of itemEntries) itemEntry.classList.remove('visible'); + + // index and sort search results + const searchResults = []; + try { + for (let i = 0; i < searchDb.length; i++) { + const item = searchDb[i][0], itemExp = searchDb[i][1]; + if (checkBool(searchFilterField.output.resolve(item, itemExp))) { + searchResults.push({ item, itemExp, sortKeys: searchSortField.output.resolve(item, itemExp) }); + } + } + } catch (e) { + searchFilterField.errorText.innerText = e.message; + return; + } + if (searchResults.length === 0) { + itemListFooter.innerText = 'No results!'; + return; + } + try { + searchResults.sort((a, b) => { + try { + return compareLexico(a.item, a.sortKeys, b.item, b.sortKeys); + } catch (e) { + console.log(a.item, b.item); + throw e; + } + }); + } catch (e) { + searchSortField.errorText.innerText = e.message; + return; + } + + // display search results + const searchMax = Math.min(searchResults.length, ITEM_LIST_SIZE); + for (let i = 0; i < searchMax; i++) { + const result = searchResults[i]; + itemEntries[i].classList.add('visible'); + displayExpandedItem(result.itemExp, `item-entry-${i}`); + if (result.sortKeys.length > 0) { + const sortKeyListContainer = document.createElement('div'); + sortKeyListContainer.classList.add('itemleft'); + const sortKeyList = document.createElement('ul'); + sortKeyList.classList.add('item-entry-sort-key', 'itemp', 'T0'); + sortKeyListContainer.append(sortKeyList); + for (let j = 0; j < result.sortKeys.length; j++) { + const sortKeyElem = document.createElement('li'); + sortKeyElem.innerText = stringify(result.sortKeys[j]); + sortKeyList.append(sortKeyElem); + } + itemEntries[i].append(sortKeyListContainer); + } + } + if (searchMax < searchResults.length) { + itemListFooter.innerText = `${searchResults.length - searchMax} more...`; + } + } + function doItemSearch() { window.scrollTo(0, 0); let queries = []; diff --git a/items_2.js b/js/items_2.js similarity index 100% rename from items_2.js rename to js/items_2.js diff --git a/load.js b/js/load.js similarity index 100% rename from load.js rename to js/load.js diff --git a/load_ing.js b/js/load_ing.js similarity index 100% rename from load_ing.js rename to js/load_ing.js diff --git a/load_map.js b/js/load_map.js similarity index 100% rename from load_map.js rename to js/load_map.js diff --git a/loadheader.js b/js/loadheader.js similarity index 97% rename from loadheader.js rename to js/loadheader.js index 49a4539..3dd83a9 100644 --- a/loadheader.js +++ b/js/loadheader.js @@ -19,8 +19,7 @@
WynnCustom
- - +
WynnGPS
@@ -100,4 +99,4 @@ function setHeaders() { } -setHeaders(); \ No newline at end of file +setHeaders(); diff --git a/map.js b/js/map.js similarity index 100% rename from map.js rename to js/map.js diff --git a/powders.js b/js/powders.js similarity index 100% rename from powders.js rename to js/powders.js diff --git a/query.js b/js/query.js similarity index 100% rename from query.js rename to js/query.js diff --git a/query_2.js b/js/query_2.js similarity index 100% rename from query_2.js rename to js/query_2.js diff --git a/skillpoints.js b/js/skillpoints.js similarity index 100% rename from skillpoints.js rename to js/skillpoints.js diff --git a/utils.js b/js/utils.js similarity index 100% rename from utils.js rename to js/utils.js diff --git a/map.html b/map.html index 369f605..8ecb9c8 100644 --- a/map.html +++ b/map.html @@ -123,10 +123,10 @@
- - - - - + + + + + diff --git a/test/index.html b/test/index.html deleted file mode 100644 index 9871353..0000000 --- a/test/index.html +++ /dev/null @@ -1,1031 +0,0 @@ - - - - - - - - - - - - - - - - - - WynnBuilder - - -
-
-
-
-
-
-
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - - -

-
-
- -

-
-
- - - -

-
-
- - - -

-
-
- -

-
-
- - - -

-
-
- - - -

-
-
- -

-
-
- - - -

-
-
- - - -

-
-
- -

-
-
- - - -

-
-
-
- - - -

-
-
-
- -

-
-
-
- -

-
-
- - - - - -

-
-
- -

-

-
-
- -

-

-
-
-
- - - - - - - -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- -
-
- Manually Assigned: 0 -
-
- Original Value: 0 -
-
-
-
-
-
-
- -
-
- Manually Assigned: 0 -
-
- Original Value: 0 -
-
-
-
-
-
-
- -
-
- Manually Assigned: 0 -
-
- Original Value: 0 -
-
-
-
-
-
-
- -
-
- Manually Assigned: 0 -
-
- Original Value: 0 -
-
-
-
-
-
-
- -
-
- Manually Assigned: 0 -
-
- Original Value: 0 -
-
-
-
-
-
-
-
- - - -
- -
- -
-
-
- - -
- - -
- - -
-
- -
- - - - - - - - - - - - - - - - -