Extended default options by two functions for displaying and hiding widgets so the default behavior can be overridden

This commit is contained in:
Christoph Matscheko
2015-06-29 15:33:55 +02:00
parent 2b0f9963ef
commit 5cb5c68480
+22 -14
View File
@@ -41,7 +41,21 @@
scroll_container: window, scroll_container: window,
shift_larger_widgets_down: true, shift_larger_widgets_down: true,
shift_widgets_up: true, shift_widgets_up: true,
serialize_params: function ($w, wgd) { show_element: function($el, callback) {
if (callback) {
$el.fadeIn(callback);
} else {
$el.fadeIn();
}
},
hide_element: function($el, callback) {
if (callback) {
$el.fadeOut(callback);
} else {
$el.fadeOut();
}
},
serialize_params: function($w, wgd) {
return { return {
col: wgd.col, col: wgd.col,
row: wgd.row, row: wgd.row,
@@ -381,9 +395,9 @@
* @param {Number} [row] The row the widget should start in. * @param {Number} [row] The row the widget should start in.
* @param {Array} [max_size] max_size Maximun size (in units) for width and height. * @param {Array} [max_size] max_size Maximun size (in units) for width and height.
* @param {Array} [min_size] min_size Minimum size (in units) for width and height. * @param {Array} [min_size] min_size Minimum size (in units) for width and height.
* @param {Function} [callback]
* @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing. * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
* the widget that was just created. * the widget that was just created.
* @param callback
*/ */
fn.add_widget = function (html, size_x, size_y, col, row, max_size, min_size, callback) { fn.add_widget = function (html, size_x, size_y, col, row, max_size, min_size, callback) {
var pos; var pos;
@@ -440,14 +454,9 @@
}, this), 0); }, this), 0);
} }
return $w.fadeIn({ this.options.show_element.call(this, $w, callback);
complete: function () {
if (callback) {
callback.call(this);
}
}
});
return $w;
}; };
@@ -975,10 +984,9 @@
size_y: size_y size_y: size_y
}); });
$nexts.not(exclude).each($.proxy(function(i, widget) {
$nexts.not(exclude).each($.proxy(function(i, widget) { this.move_widget_up( $(widget), size_y );
this.move_widget_up( $(widget), size_y ); }, this));
}, this));
this.set_dom_grid_height(); this.set_dom_grid_height();
@@ -1071,7 +1079,7 @@
this.remove_from_gridmap(wgd); this.remove_from_gridmap(wgd);
$el.fadeOut($.proxy(function () { this.options.hide_element.call(this, $el, $.proxy(function(){
$el.remove(); $el.remove();
if (!silent) { if (!silent) {