diff --git a/tailbone/static/js/tailbone.js b/tailbone/static/js/tailbone.js index 52618f22..4d2a01f1 100644 --- a/tailbone/static/js/tailbone.js +++ b/tailbone/static/js/tailbone.js @@ -68,6 +68,24 @@ function get_uuid(obj) { } +/* + * Return a jQuery object containing a button from a dialog. This is a + * convenience function to help with browser differences. It is assumed + * that it is being called from within the relevant button click handler. + * @param {event} event - Click event object. + */ +function dialog_button(event) { + var button = $(event.target); + + // TODO: not sure why this workaround is needed for Chrome..? + if (! button.hasClass('ui-button')) { + button = button.parents('.ui-button:first'); + } + + return button; +} + + /* * reference to existing timeout warning dialog, if any */