Making AlreadyReblogged add a checkmark to reblog icon.#1048
Making AlreadyReblogged add a checkmark to reblog icon.#1048homu merged 5 commits intonew-xkit:masterfrom
Conversation
Extensions/one_click_postage.js
Outdated
| m_button.addClass("reblogged"); | ||
| if (XKit.extensions.one_click_postage.preferences.alreadyreblogged_use_checkmark.value) { | ||
| var checkmark = document.createElement("div"); | ||
| checkmark.innerHTML = "✓"; |
There was a problem hiding this comment.
We should just be able to do with with CSS rather then super-expensive DOM manipulation, right?
|
This should basically be a 3 or 4 line CSS change, using pseudo-elements and content: "", right? |
|
Actually that's what I tried first (planned on using a.reblogged::after) but for some reason I wasn't able to get ::after to work on .reblogged either in user stylesheet or in XKit's (and I tested those on both FF, Chrome and Vivaldi). And since tumblr already uses the ::before for the reblog icon I elected to leave pseudo-elements aside and made it actual DOM. re: default behavior - I was thinking so too. |
.post_controls .post_control.reblog.reblogged:after {
content: '✓';
font-size: 18px;
color: #56bc8a;
opacity: 100;
display: block;
margin-top: 0px;
margin-left: 0px;
background: white;
height: 10px;
line-height: 10px;
}Maybe you were getting bit in the butt by selector specificity? You have to pay real close attention to that stuff when coding for XKit. Anyway, i'll merge if you get the CSS added and take out the option (since alreadyreblogged is a choice to begin with, I'm fine with scrapping customizability here for the sake of simplicity) |
|
wrong button sorry :( |
|
No problem we've all misclicked our way through stuff. I'm tempted to say it was probably due to selector specificity but in User Stylesheet I actually used the same selector as tumblr/XKit for the ::before pseudo-element but eh. If I'm the only one whom for it doesn't work it'll be good enough 👍 |
… default behaviour instead of optional. See PR discussion.
|
Should be as discussed now 👌. Kept the extraction of the m_button.addClass("reblogged"); to a method though, for DRY purposes and in prevision of the day we have to modify that again in the future. |
|
LGTM! @homu r+ Be careful not to over-DRY your code though. The CSS class itself served as the proper abstraction layer here. Try to avoid premature refactoring of code that's already clear and readable. |
|
📌 Commit f68cb20 has been approved by |
|
⚡ Test exempted - status |
Making AlreadyReblogged add a checkmark to reblog icon. Following-up on #980 accessibility issue. Made it possible to check the appropriate setting in One-Click Postage config to make AlreadyReblogged add a checkmark instead of just coloring the reblog button green.
|
I get that, over-dry code ends up very... spaghetti-y but I do feel that line needed to be extracted to a method though. I'm sorry if I'm not really talking straight, it's 4am here and those code-design things are always bit of a subjective field. |


Following-up on #980 accessibility issue.
Made it possible to check the appropriate setting in One-Click Postage config to make AlreadyReblogged add a checkmark instead of just coloring the reblog button green.