-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separator extension improvements #1414
Separator extension improvements #1414
Conversation
// The workaround is to manually trigger a goal post reset (with the separator controls). | ||
// Hints might be missing if we manually browse to a page’s URL. | ||
// They might also _go_ missing should Tumblr change their URL patterns. | ||
// - When the same context is open in multiple tabs, behaviour may seem unpredictable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment should be jsdoc-style
Extensions/separator.js
Outdated
"use strict"; | ||
|
||
// Immutables | ||
const DASHBOARD_PATH_REGEX = /^\/dashboard(?:\/(?:([2-9]|[1-9]\d+)\/(-?[1-9]\d*)\/?)?)?$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a non-trivial functionality we gain by using [2-9]|[1-9]\d+? I understand that it's more correct, but \d+ seems like it would work just fine in the practical case and is much easier to read, leading to a more maintainable regex.
also when do we ever see negative post numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¯\_(ツ)_/¯
I figured it was a common enough construct for matching against positive integers, and have a preference towards failing early. And the pattern is unlikely to change with frequency for maintainability to be an issue. (I mean, I feel the escapes and nested optional groups are what make this regex a pain to read.) But I can change it to \d+
.
Negative post numbers are for backwards paging.
Extensions/separator.js
Outdated
XKit.extensions.separator = (function() { | ||
"use strict"; | ||
|
||
// Immutables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const/let, as well as the naming convention, makes this comment and the below (// Mutables
) unnecessary and overly verbose.
802a1c2
to
2de3a06
Compare
2de3a06
to
0698d3c
Compare
(They can break the expectation that posts must be ordered by strictly decreasing IDs on the dashboard.)
(They also break the expectation that posts must be ordered by strictly decreasing IDs on the dashboard.)
0698d3c
to
cf128e7
Compare
This is a rewrite of the separator extension. It features a more robust algorithm for placing the separator and tracking read posts (at the expense of bookkeeping). It also semi-supports tagged views.
Points of contention
Map
andURLSearchParams
), which'd leave users on older browsers in the lurch.Checklist