Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b1c989

Browse files
committed
some code style corrections/improvements
1 parent c4fee63 commit 0b1c989

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/jquery.gridster.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203

204204
if (size_x > this.cols) {
205205
size_x = this.cols;
206-
};
206+
}
207207

208208
var old_cells_occupied = this.get_cells_occupied(wgd);
209209
var old_size_x = wgd.size_x;
@@ -217,7 +217,7 @@
217217
var diff = old_col + (size_x - 1) - this.cols;
218218
var c = old_col - diff;
219219
new_col = Math.max(1, c);
220-
};
220+
}
221221

222222
var new_grid_data = {
223223
col: new_col,
@@ -232,7 +232,7 @@
232232
$.each(old_cells_occupied.cols, function(i, col) {
233233
if ($.inArray(col, new_cells_occupied.cols) === -1) {
234234
empty_cols.push(col);
235-
};
235+
}
236236
});
237237

238238
var occupied_cols = [];
@@ -246,14 +246,14 @@
246246
$.each(old_cells_occupied.rows, function(i, row) {
247247
if ($.inArray(row, new_cells_occupied.rows) === -1) {
248248
empty_rows.push(row);
249-
};
249+
}
250250
});
251251

252252
var occupied_rows = [];
253253
$.each(new_cells_occupied.rows, function(i, row) {
254254
if ($.inArray(row, old_cells_occupied.rows) === -1) {
255255
occupied_rows.push(row);
256-
};
256+
}
257257
});
258258

259259
this.remove_from_gridmap(wgd);
@@ -263,12 +263,12 @@
263263
new_col, wgd.row, size_x, Math.min(old_size_y, size_y), $widget
264264
];
265265
this.empty_cells.apply(this, cols_to_empty);
266-
};
266+
}
267267

268268
if (occupied_rows.length) {
269269
var rows_to_empty = [new_col, wgd.row, size_x, size_y, $widget];
270270
this.empty_cells.apply(this, rows_to_empty);
271-
};
271+
}
272272

273273
wgd.col = new_col;
274274
wgd.size_x = size_x;
@@ -342,7 +342,7 @@
342342

343343
$nexts.not($exclude).each($.proxy(function(i, w) {
344344
var wgd = $(w).coords().grid;
345-
if (!(wgd.row <= (row + size_y - 1))) { return; };
345+
if (!(wgd.row <= (row + size_y - 1))) { return; }
346346
var diff = (row + size_y) - wgd.row;
347347
this.move_widget_down($(w), diff);
348348
}, this));
@@ -382,7 +382,7 @@
382382
this.set_dom_grid_height();
383383

384384
return this;
385-
}
385+
};
386386

387387

388388
/**
@@ -400,9 +400,10 @@
400400
var ga = this.gridmap;
401401
var cols_l = ga.length;
402402
var valid_pos = [];
403+
var rows_l;
403404

404405
for (var c = 1; c < cols_l; c++) {
405-
var rows_l = ga[c].length;
406+
rows_l = ga[c].length;
406407
for (var r = 1; r <= rows_l; r++) {
407408
var can_move_to = this.can_move_to({
408409
size_x: size_x,
@@ -534,7 +535,7 @@
534535
$el.data('coords').grid = wgd;
535536

536537
this.add_to_gridmap(wgd, $el);
537-
this.widgets.push($el);
538+
538539
return this;
539540
};
540541

@@ -695,7 +696,7 @@
695696
//break if dragstop has been fired
696697
if (this.$player === null) {
697698
return false;
698-
};
699+
}
699700

700701
var abs_offset = {
701702
left: ui.position.left + this.baseX,
@@ -878,7 +879,7 @@
878879
var self = this;
879880
if (!no_player) {
880881
this.empty_cells_player_occupies();
881-
};
882+
}
882883
var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
883884
var to_col = cell.col;
884885
var to_row = row || cell.row;
@@ -967,7 +968,7 @@
967968
if (!a.row) {
968969
a = $(a).coords().grid;
969970
b = $(b).coords().grid;
970-
};
971+
}
971972

972973
if (a.row > b.row) {
973974
return 1;
@@ -989,7 +990,7 @@
989990
*/
990991
fn.sort_by_row_and_col_asc = function(widgets) {
991992
widgets = widgets.sort(function(a, b) {
992-
if (a.row > b.row || a.row == b.row && a.col > b.col) {
993+
if (a.row > b.row || a.row === b.row && a.col > b.col) {
993994
return 1;
994995
}
995996
return -1;
@@ -1300,7 +1301,7 @@
13001301
this.move_widget_down(
13011302
$w, row + phgd.size_y - $w.data('coords').grid.row);
13021303
}, this));
1303-
};
1304+
}
13041305

13051306
};
13061307

@@ -1381,14 +1382,14 @@
13811382
if (this.is_widget(tcol, r) && !this.is_player_in(tcol, r)) {
13821383
if (!grid_col[r].is(widget_grid_data.el)) {
13831384
break;
1384-
};
1385+
}
13851386
}
13861387

13871388
if (!this.is_player(tcol, r) &&
13881389
!this.is_placeholder_in(tcol, r) &&
13891390
!this.is_player_in(tcol, r)) {
13901391
upper_rows[tcol].push(r);
1391-
};
1392+
}
13921393

13931394
if (r < min_row) {
13941395
min_row = r;
@@ -2197,7 +2198,7 @@
21972198
}
21982199

21992200
return $widgets;
2200-
}
2201+
};
22012202

22022203

22032204
/**
@@ -2370,8 +2371,8 @@
23702371
for (var r = max_rows; r > actual_rows; r--) {
23712372
for (var c = this.cols; c >= 1; c--) {
23722373
this.add_faux_cell(r, c);
2373-
};
2374-
};
2374+
}
2375+
}
23752376

23762377
this.rows = max_rows;
23772378

@@ -2396,8 +2397,8 @@
23962397
for (var c = actual_cols; c < max_cols; c++) {
23972398
for (var r = this.rows; r >= 1; r--) {
23982399
this.add_faux_cell(r, c);
2399-
};
2400-
};
2400+
}
2401+
}
24012402

24022403
this.cols = max_cols;
24032404

@@ -2472,7 +2473,7 @@
24722473

24732474
// get all rows that could be occupied by the current widgets
24742475
var max_rows = this.options.extra_rows;
2475-
this.$widgets.each(function(i, w){
2476+
this.$widgets.each(function(i, w) {
24762477
max_rows += (+$(w).attr('data-sizey'));
24772478
});
24782479

0 commit comments

Comments
 (0)