Adding buttons to the dialog header

I want to add two buttons to a dialog header in my Oracle APEX application.

  1. One would go just to the left of the button that closes the dialog with a little bit of padding between the two. Extra credit for enlarging the “dialog close” button so that it is the same size as the button added

  2. The second button would go in the top right corner of the dialog page

In other words one button before the ui-dialog-title element and one button after it. I have some javascript code I found that will place a button to the right of the window close:

$('.ui-dialog-titlebar', window.parent.document).append('<button type="button" class="t-Button">Button Name</button>');

$('.someIdentifier', window.parent.document).click(function(){

    console.log('button is clicked');

});

By changing the .ui-dialog-titlebar parameter you can change which element to place the button immediately after but I feel that a function that places html code immediately before an element rather than appending it would help solve my problem.