Stats for selection

I want to use the Stats action (https://actions.getdrafts.com/a/1DY) for just a selection of the draft, but don’t really know my way around javascript. Any tips on how to get started with this?

I figure change where it grabs the draft, and change that to grab the selection, but I can’t find where it does that.

Thanks!

Take a look here: