edit–
figured this out:
Had to pass the selected value into a stable variable that would exist before the script created the share button.
–end edit
Could you possibly elaborate on the first step listed (“Dynamically generate a Tweet…”)?
I’m trying to do this, using a user selection (cursor highlight) to populate the text parameter:

I’ve also tried the same method, passing the function directly into the param:

In both cases the tweet is created on mouseup, but the selected text isn’t passed.