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
Feature: Replace followed threads links with my posts link #12
Feature: Replace followed threads links with my posts link #12
Conversation
The operation fails and an error is logged if user is not logged in. Is it possible to implement |
56c5dcc
to
12152fa
Compare
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.
Nice feature! I would like to request some changes:
- The icon doesn't really fit in to me due to its white part, and it usually means "unread". What do you think about the one with two stacked papers (
-250px -100px
) instead? - I think italics would look nicer than quotation marks in the preference label – i.e.
`Ersätt knappen <em>Följda trådar</em> med <em>Mina inlägg</em>`
. It also lends itself better to styling. - Rename
REPLACE_FOLLOWED_BUTTON
toREPLACE_FOLLOWED_THREADS_LINK
inoperations.ts
. - Rename the operation file correspondingly to
replace-followed-threads-link.ts
. followed threads link
instead offollowed threads button
in the operation description.textContent
instead ofinnerHTML
in the operation.SITE.CLASS.hasUnread
(and create it) instead of"hasUnread"
in the operation.replace_followed_threads_link
instead ofreplace_followed_button
in the preference (and wherever it is used).- Rename the SASS file to
replace-followed-threads-link.scss
.
Also, due to the commit message limit of 50 characters that I use and in accordance with my requested changes of nomenclature, I suggest this message instead:
Replace followed threads link with my posts link
Regarding And I hereby proudly present a solution: export function isLoggedIn(): boolean {
return (document.head.textContent as string).includes(`'visitorType': 'member'`);
} I have pushed the implementation above, so you should be able to use it if you pull that commit (d286580). |
af809ab
to
fc50633
Compare
fc50633
to
5d97f11
Compare
Detectors in the environment module are intended to work at document-start, so they cannot look for anything in <body>. The implementation in this commit relies on this snippet in <head>: // <![CDATA[ dataLayer = [{ // 'userID': comming-soon, 'visitorType': 'member' }]; // ]]> (If the user is not logged in, 'visitorType' is 'guest' instead.)
5d97f11
to
37708da
Compare
I think I've gitted far beyond my proper understanding, but that should be every change you requested and then some. Anything more to do? |
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 found three more things I would like to change. Two of them I should have seen the first time, but here goes:
- The preference label should say länken instead of knappen.
- The preference should be moved up so it sits between
insert_preferences_shortcut
andinsert_web_search_button
. The reason is thatinsert_web_search_button
andsearch_engine
should be adjacent to each other. Note that this needs to be changed in thetext
module as well, for consistency. - In the operation,
HTMLLinkElement
is actually not correct; it should beHTMLAnchorElement
. Classic mistake that I've made a couple of times myself. :)
I think you can simply make these changes in a new commit; I'll squash all the commits in this feature branch into a single one anyway.
Do you like the idea of using |
Yes, I do. I think the best way is to add an internal (non-exported) string
above
rather than
since the names are identical. |
No description provided.