mouse0270 / Beyonds-Toolbox

MIT License
23 stars 6 forks source link

Added the ability to copy async base roll in forum format for quick c… #19

Open kalebhermes opened 6 years ago

kalebhermes commented 6 years ago

…opy pasting.

mouse0270 commented 6 years ago

I actually don't understand the purpose of this... If you type out 1d6 + 3 on the forums the Async Dice roller would pick it up and highlight it.

Am I misunderstanding the purpose of this pull request?

EDIT: I just realized that if you dont use the ascii times character and an X my dice roller wont pick up the XdY x Z... I should update the script to include the "x"

kalebhermes commented 6 years ago

I've just started playing in a Play-by-Post game, where the forum can roll dice for you. For example, if the DM asks for a perception roll, you'd type [roll]1d20+4[/roll] into the forum text field, and after submitting, the forum would roll that for you. I figured rather than typing something like that every time, it would be nice to be able to quickly copy text in that format right from the extensions roller.

mouse0270 commented 6 years ago

Let me think about this. This pull request seems very specific and might be outside of what I want the extension scope to be.

Would you be able to send me the forum site you are using, I would be curious to check it out.

I am not saying I won't include this, I am just not sure if it really fits my personal goal of this extension so I would like to think about it. Also, I would like to improve the code, I am not really a fan of functions inside of functions. lol

kalebhermes commented 6 years ago

The forum is the one built into D&DBeyond. I'll drop a comment in your thread for the extension to see what I'm talking about. I agree that cleaning it up is probably a good idea. I snagged this code pretty much whole cloth from StackOverflow anyway.

If it doesn't fit with your vision, that's totally understandable! I can pull this code out and drop it into a stand along extension!

kalebhermes commented 6 years ago

Just pushed a new patch that stripped all of the extra fallback code. navigator.clipboard is supported by all modern browsers, so if a given browser doesn't support it, we just don't display the button, removing the need for all fallback code.

mouse0270 commented 6 years ago

much nicer code.