Skip to content
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

Handle Ctrl/Shift + click on "Random item" button #43

Closed
nmussy opened this issue Jul 14, 2019 · 7 comments
Closed

Handle Ctrl/Shift + click on "Random item" button #43

nmussy opened this issue Jul 14, 2019 · 7 comments
Assignees

Comments

@nmussy
Copy link

nmussy commented Jul 14, 2019

The "Random item" button doesn't act like a regular anchor with an href, and it's a little frustrating to have the current page be forcibly replaced.

You could add to your event listener support for the ctrlKey and shiftKey properties, to open the random item in a new tab, and a new window respectively:

document.querySelector('.de-random-item').addEventListener('click', event => {

Still a pleasure to use your extension, thanks for the continued hard work 👍

@nmussy
Copy link
Author

nmussy commented Jul 14, 2019

Oh, and it's a small nitpick, but I don't think "recycling" Unicode symbol is the clearest representation of a random element. I think either the gamedie (🎲) or twisted rightwards arrows(🔀) character would be easier for new users to understand

@salcido salcido self-assigned this Jul 15, 2019
@salcido
Copy link
Owner

salcido commented Jul 15, 2019

Hey @nmussy,

That's a good call, I can update that to a proper anchor so it can be opened in separate tags.

As for the icon, I initially wanted to use the twisted rightwards arrows but Chrome (or OS X, not sure which) automatically uses the Emoji version which does not match Discogs style guide. Personally, I don't think Emoji should represent UI elements, so I went with the recycling icon since it was a better match with Discogs' style guide aesthetics.

I may be able to use the Dice icon that is currently used in the React version of the Collection. I'll poke around a bit and see what I can come up with.

Thanks for the suggestions!

@nmussy
Copy link
Author

nmussy commented Jul 15, 2019

Hey @salcido,

Yeah, I suggested looking at the event properties because it seemed simpler/more efficient than pre-rendering the anchor with the correct URL. But if you can manage it, it'd also fix the context menu "Open
in a new tab", "new window" etc.

And fair enough for the emoji forms, but you can always force the VS15 text variant by appending ︎ to the unicode character, e.g. 🎲︎

@salcido
Copy link
Owner

salcido commented Jul 16, 2019

And fair enough for the emoji forms, but you can always force the VS15 text variant by appending ︎ to the unicode character, e.g. 🎲︎

TIL. That's pretty cool! I messed around a bit with that but still wasn't able to force the plain text version. Think I'll make an SVG of the twisted rightwards arrow icon as I like that a bit more than the gamedie.

While looking into this I realized Discogs has a specific URL just for random items so I'm able to simplify the script quite a bit and ditch the old async POST method I was using previously.

@nmussy
Copy link
Author

nmussy commented Jul 16, 2019

That's unfortunate about the text varient, it works perfectly well on Chrome/Windows 10 :

image

And glad to hear about the random URL

@salcido
Copy link
Owner

salcido commented Jul 30, 2019

Ok, just published an update to address this! Going to close this ticket ✌️

@salcido salcido closed this as completed Jul 30, 2019
@nmussy
Copy link
Author

nmussy commented Jul 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants