Skip to content

Commit aef185c

Browse files
committed
style: some formatting changes
1 parent b232391 commit aef185c

File tree

1 file changed

+29
-32
lines changed

1 file changed

+29
-32
lines changed

src/jquery.gridster.js

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@
315315

316316
if (!col & !row) {
317317
pos = this.next_position(size_x, size_y);
318-
}else{
318+
} else {
319319
pos = {
320320
col: col,
321321
row: row,
@@ -608,7 +608,7 @@
608608

609609
$nexts.not($exclude).each($.proxy(function(i, w) {
610610
var wgd = $(w).coords().grid;
611-
if (!(wgd.row <= (row + size_y - 1))) { return; }
611+
if ( !(wgd.row <= (row + size_y - 1))) { return; }
612612
var diff = (row + size_y) - wgd.row;
613613
this.move_widget_down($(w), diff);
614614
}, this));
@@ -769,13 +769,11 @@
769769
*/
770770
fn.serialize = function($widgets) {
771771
$widgets || ($widgets = this.$widgets);
772-
var result = [];
773-
$widgets.each($.proxy(function(i, widget) {
774-
result.push(this.options.serialize_params(
775-
$(widget), $(widget).coords().grid ) );
776-
}, this));
777772

778-
return result;
773+
return $widgets.map($.proxy(function(i, widget) {
774+
var $w = $(widget);
775+
return this.options.serialize_params($w, $w.coords().grid);
776+
}, this));
779777
};
780778

781779

@@ -1097,6 +1095,7 @@
10971095
}
10981096
};
10991097

1098+
11001099
/**
11011100
* This function is executed when the player stops being dragged.
11021101
*
@@ -1164,7 +1163,6 @@
11641163
};
11651164

11661165

1167-
11681166
/**
11691167
* This function is executed every time a widget starts to be resized.
11701168
*
@@ -1267,6 +1265,7 @@
12671265
}
12681266
};
12691267

1268+
12701269
/**
12711270
* This function is executed when a widget is being resized.
12721271
*
@@ -1513,7 +1512,7 @@
15131512
if (this.can_go_widget_up(wgd)) {
15141513
$widgets_can_go_up = $widgets_can_go_up.add($w);
15151514
wgd_can_go_up.push(wgd);
1516-
}else{
1515+
} else {
15171516
wgd_can_not_go_up.push(wgd);
15181517
}
15191518
}, this));
@@ -1827,7 +1826,7 @@
18271826
) {
18281827
upper_rows[tcol].push(r);
18291828
min_row = r < min_row ? r : min_row;
1830-
}else{
1829+
} else {
18311830
break;
18321831
}
18331832
}
@@ -1946,7 +1945,7 @@
19461945
if (valid_rows[0] !== p_top_row) {
19471946
new_row = valid_rows[0] || false;
19481947
}
1949-
}else{
1948+
} else {
19501949
if (valid_rows[0] !== p_top_row) {
19511950
new_row = this.get_consecutive_numbers_index(
19521951
valid_rows, size_y);
@@ -1970,7 +1969,7 @@
19701969
break;
19711970
}
19721971
first = false;
1973-
}else{
1972+
} else {
19741973
result = [];
19751974
first = true;
19761975
}
@@ -2248,7 +2247,7 @@
22482247
!this.is_placeholder_in(tcol, r)
22492248
) {
22502249
urc[tcol].push(r);
2251-
}else{
2250+
} else {
22522251
break;
22532252
}
22542253
}
@@ -2391,7 +2390,6 @@
23912390
};
23922391

23932392

2394-
23952393
/**
23962394
* Check if it's possible to move a widget to a specific col/row. It takes
23972395
* into account the dimensions (`size_y` and `size_x` attrs. of the grid
@@ -2815,21 +2813,21 @@
28152813
* @return {Object} Returns the instance of the Gridster class.
28162814
*/
28172815
fn.add_style_tag = function(css) {
2818-
var d = document;
2819-
var tag = d.createElement('style');
2816+
var d = document;
2817+
var tag = d.createElement('style');
28202818

2821-
d.getElementsByTagName('head')[0].appendChild(tag);
2822-
tag.setAttribute('type', 'text/css');
2819+
d.getElementsByTagName('head')[0].appendChild(tag);
2820+
tag.setAttribute('type', 'text/css');
28232821

2824-
if (tag.styleSheet) {
2825-
tag.styleSheet.cssText = css;
2826-
}else{
2827-
tag.appendChild(document.createTextNode(css));
2828-
}
2822+
if (tag.styleSheet) {
2823+
tag.styleSheet.cssText = css;
2824+
} else {
2825+
tag.appendChild(document.createTextNode(css));
2826+
}
28292827

2830-
this.$style_tags = this.$style_tags.add(tag);
2828+
this.$style_tags = this.$style_tags.add(tag);
28312829

2832-
return this;
2830+
return this;
28332831
};
28342832

28352833

@@ -2977,7 +2975,6 @@
29772975
left: this.baseX + (coords.data.col -1) * this.min_widget_width,
29782976
top: this.baseY + (coords.data.row -1) * this.min_widget_height
29792977
});
2980-
29812978
}, this));
29822979

29832980
return this;
@@ -3072,11 +3069,11 @@
30723069

30733070
//jQuery adapter
30743071
$.fn.gridster = function(options) {
3075-
return this.each(function() {
3076-
if (!$(this).data('gridster')) {
3077-
$(this).data('gridster', new Gridster( this, options ));
3078-
}
3079-
});
3072+
return this.each(function() {
3073+
if (! $(this).data('gridster')) {
3074+
$(this).data('gridster', new Gridster( this, options ));
3075+
}
3076+
});
30803077
};
30813078

30823079
$.Gridster = fn;

0 commit comments

Comments
 (0)