*/
_buttonSelector: '',
+ /**
+ * callback function called prior to triggering the delete effect
+ * @var function
+ */
+ _callback: null,
+
/**
* action class name
* @var string
this._containerSelector = containerSelector;
this._className = className;
this._buttonSelector = (buttonSelector) ? buttonSelector : '.jsDeleteButton';
+ this._callback = null;
this.proxy = new WCF.Action.Proxy({
success: $.proxy(this._success, this)
* @param object jqXHR
*/
_success: function(data, textStatus, jqXHR) {
+ if (this._callback) {
+ this._callback(data.objectIDs);
+ }
+
this.triggerEffect(data.objectIDs);
},
+ /**
+ * Sets a callback function called prior to triggering the delete effect.
+ *
+ * @param {function} callback
+ */
+ setCallback: function(callback) {
+ if (typeof callback !== 'function') {
+ throw new TypeError("[WCF.Action.Delete] Expected a valid callback for '" + this._className + "'.");
+ }
+
+ this._callback = callback;
+ },
+
/**
* Triggers the delete effect for the objects with the given ids.
*
EventHandler.add('com.woltlab.wcf.clipboard', 'com.woltlab.wcf.media', this._clipboardAction.bind(this));
- new WCF.Action.Delete('wcf\\data\\media\\MediaAction', '.jsMediaRow');
+ var deleteAction = new WCF.Action.Delete('wcf\\data\\media\\MediaAction', '.jsMediaRow');
+ deleteAction.setCallback(Clipboard.reload.bind(Clipboard));
_mediaEditor = new MediaEditor();