Repository navigation
Conversation
- Replace some let with const. - Add 'use strict' in all script blocks. - Remove duplicated CSS definition. - Allow reduced scrolling motion. - Use static node lists in loops where DOM might be modified. - Use textContent instead of innerHTML where possible. - Correct undeclared variable. - Add optional chaining (?.) in case elements might be missing. - Use firstElementChild instead of firstChild to ignore possible raw text, whitespace, etc. - Add test in case SVG creation failed. - Correct non-standard way of using getElementById.
- Add 'g_graphs' global variable and 'graph' URL parameter. - Move graph display code into functions displayGraph() and removeGraph(). - Open graph collapsible and display graphs if requested in URL. - Use updateGraphURL() to keep URL up to date with manual graph display.
In standard JS DOM, elements do not have a .setContent property. The correct property is .textContent.
- Tag columns with only numeric (or empty) values. - Compute (asynchronously) several stats for such columns. - Display stats as tooltips (for now). - Recompute after filtering.
- Use type="search" instead of "text" (adds a clear cross on Chrome). - Use 'input' instead of 'keyup' (triggered also with paste, clear cross, etc.). - Clear search fields with Escape key also.
- Allow advanced searches in column filters (cf. NOT, wildcards, RegExp, etc.). - Add function for testing cell content against filter. - Add info about it in the tooltips.
- Optimize column filtering by moving the query processing outside of the loop on cells. - Create first a filter function from query, and then apply it to all cells. - Some let/const cleaning...
- Only update graphs after filtering columns if they are visible. - Force graphs update when collapsible is opened. - Use textContent instead of innerText (no layout updates needed). - Let the browser manage the right moment to adjust the graph size. - Optimize indexing of rows when filtering tables. - Update row visibility only when needed.
- Pre-allocate an array with the table cell values. - Compute statistics on that array.
- To prevent instant filters from slowing down the typing, wait 120ms before applying the column filter.
- Extend global variable 'specialBlocks' to be network-specific. - Make the 'Historical Blocks' page network-specific. - Move all network settings and corresponding UI update into a helper function setNetwork().
- 'dataset-numeric' was recently added to 'hdrs' headers for statistics computation. - That tag is now also used to identify columns which can be displayed as graphs (instead of depending on a manual color definition in the global variables). - When no default color is defined, a random one is generated.
- Add the network name in the parameters saved in localStorage. - Move up getPersistentParam() to make it a general helper function for saving/retrieving parameters from localStorage or default. - Move code out of setupGraph() to make another helper function loadGraphColors() for saving/retrieving graph colors. - Refactor/streamline how global parameters are updated in showPage(). - Also: Move the declaration of 'g_graph' up in the code to avoid any error if used while still undeclared.
- Apply the same logic as for 'asset' without id (or with id=0).
Protection against code injection from node responses, URL parameters or localStorage: - Add optimized helper function to escape HTML characters. - Apply it everywhere data is inserted in HTML (with care about possible double calls). - Adjust some usage of the MakeCell* helpers. - Optimize formatTimestamp() by removing its regexp. - Add sanitization for all 'hdrs' parameters. - Sanitize all colors into hex format with convertColorToHex().
- Move Collators outside of the sortTable() function." - Use createDocumentFragment() to update the layout only once, at the end.
Use the isNumeric tag to make sorting most columns faster.
- Extend column scanning to typing them as 'numeric', 'empty' or 'text'. - Store initial row or tBody order (will be used in the future for better sorting). - Remove a useless fallback.
- Use the column data-type to select sorting method. - Sort directly in the requested direction (it saves one pass). - Sort hex hashes similarly to text (it removes a collator and the RegExp testing). - Don't sort empty columns.
- Default initial sort: A-Z for text columns and largest/newest first for numeric columns.
Use the column data-type to make filtering a bit faster: - No need to use parseCellNumericValue() anymore. - Optimize matcher() functions for numeric or text columns. - Detect when no row is visible anymore. - Revert back matcher() to using only one parameter.
Review of #2088 (Explorer HTML v0.9.1)Line numbers are for I tested points 1–4 and 6 in Chrome, running the PR build against the live mainnet and dappnet nodes. Points 5 and 7–9 come from reading the code only. 1. URLs for any network except mainnet lose their saved-setting parametersL3668–3674, together with L3403 and L3792–3797.
2. Node data can still inject code through the
|
CorrectionsRemark: Some 9 new commits were added after commit 97cbf10 and were not included in the first review above.
|
|
Copy of the results of the second review: Review of #2088, round 2Line numbers are for Points 1–4 below were reproduced in Chrome against the live mainnet and dappnet nodes. Points 5 and 6 come from reading the code. Status of round 1
1.
|
- Reset all colors in loadGraphColors(), so that they can be redefined from default, localStorage or random. - Replace random colors by pseudo-random ones (i.e. deterministic based on column code string) so there is no need to .carry them over.
Moved the early return *after* the update of the X-axis options.
- Move the early return in sortTable() for empty columns. - Don't show sort icon/option for empty columns.
Better protection against code injection (and possibility to open links in new tab/window!): - Replace `javascript:` links back to normal self-links `href="?params=..."`. - Update `UrlSelf()` to build such safe self-links. - Intercept left mouse clicks to route self-links through showPage(). - Update logo and menu links when network changes. - Use `data-retry=true` to tag links which should replace browsing history (e.g. after node query errors).
Automatic display of the "What's new" popup the first time a new version is loaded.
|
New set of corrections: 1.
|
It's just for consistency: - `window` if it relates to browser, viewport, storage, network, or URL. - `document` when it relates to HTML tags, elements, CSS classes.
|
New round of corrections:
|
Uh oh!
There was an error while loading. Please reload this page.