Refactored dialog JS

I largely refactored this to make a very basic change - to make it so that setting `data-confirm-proceed-class` overrides `btn-primary` as opposed to appending after it, as this doesn't style the element correctly, for example, a button with class `btn-primary btn-danger` can end up primary styled, they're not for use in conjunction.

Other than that, this should work exactly as it did before, just a hell of a lot easier to read (I hope!).