|
315 | 315 |
|
316 | 316 | if (!col & !row) {
|
317 | 317 | pos = this.next_position(size_x, size_y);
|
318 |
| - }else{ |
| 318 | + } else { |
319 | 319 | pos = {
|
320 | 320 | col: col,
|
321 | 321 | row: row,
|
|
608 | 608 |
|
609 | 609 | $nexts.not($exclude).each($.proxy(function(i, w) {
|
610 | 610 | var wgd = $(w).coords().grid;
|
611 |
| - if (!(wgd.row <= (row + size_y - 1))) { return; } |
| 611 | + if ( !(wgd.row <= (row + size_y - 1))) { return; } |
612 | 612 | var diff = (row + size_y) - wgd.row;
|
613 | 613 | this.move_widget_down($(w), diff);
|
614 | 614 | }, this));
|
|
769 | 769 | */
|
770 | 770 | fn.serialize = function($widgets) {
|
771 | 771 | $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)); |
777 | 772 |
|
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)); |
779 | 777 | };
|
780 | 778 |
|
781 | 779 |
|
|
1097 | 1095 | }
|
1098 | 1096 | };
|
1099 | 1097 |
|
| 1098 | + |
1100 | 1099 | /**
|
1101 | 1100 | * This function is executed when the player stops being dragged.
|
1102 | 1101 | *
|
|
1164 | 1163 | };
|
1165 | 1164 |
|
1166 | 1165 |
|
1167 |
| - |
1168 | 1166 | /**
|
1169 | 1167 | * This function is executed every time a widget starts to be resized.
|
1170 | 1168 | *
|
|
1267 | 1265 | }
|
1268 | 1266 | };
|
1269 | 1267 |
|
| 1268 | + |
1270 | 1269 | /**
|
1271 | 1270 | * This function is executed when a widget is being resized.
|
1272 | 1271 | *
|
|
1513 | 1512 | if (this.can_go_widget_up(wgd)) {
|
1514 | 1513 | $widgets_can_go_up = $widgets_can_go_up.add($w);
|
1515 | 1514 | wgd_can_go_up.push(wgd);
|
1516 |
| - }else{ |
| 1515 | + } else { |
1517 | 1516 | wgd_can_not_go_up.push(wgd);
|
1518 | 1517 | }
|
1519 | 1518 | }, this));
|
|
1827 | 1826 | ) {
|
1828 | 1827 | upper_rows[tcol].push(r);
|
1829 | 1828 | min_row = r < min_row ? r : min_row;
|
1830 |
| - }else{ |
| 1829 | + } else { |
1831 | 1830 | break;
|
1832 | 1831 | }
|
1833 | 1832 | }
|
|
1946 | 1945 | if (valid_rows[0] !== p_top_row) {
|
1947 | 1946 | new_row = valid_rows[0] || false;
|
1948 | 1947 | }
|
1949 |
| - }else{ |
| 1948 | + } else { |
1950 | 1949 | if (valid_rows[0] !== p_top_row) {
|
1951 | 1950 | new_row = this.get_consecutive_numbers_index(
|
1952 | 1951 | valid_rows, size_y);
|
|
1970 | 1969 | break;
|
1971 | 1970 | }
|
1972 | 1971 | first = false;
|
1973 |
| - }else{ |
| 1972 | + } else { |
1974 | 1973 | result = [];
|
1975 | 1974 | first = true;
|
1976 | 1975 | }
|
|
2248 | 2247 | !this.is_placeholder_in(tcol, r)
|
2249 | 2248 | ) {
|
2250 | 2249 | urc[tcol].push(r);
|
2251 |
| - }else{ |
| 2250 | + } else { |
2252 | 2251 | break;
|
2253 | 2252 | }
|
2254 | 2253 | }
|
|
2391 | 2390 | };
|
2392 | 2391 |
|
2393 | 2392 |
|
2394 |
| - |
2395 | 2393 | /**
|
2396 | 2394 | * Check if it's possible to move a widget to a specific col/row. It takes
|
2397 | 2395 | * into account the dimensions (`size_y` and `size_x` attrs. of the grid
|
|
2815 | 2813 | * @return {Object} Returns the instance of the Gridster class.
|
2816 | 2814 | */
|
2817 | 2815 | 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'); |
2820 | 2818 |
|
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'); |
2823 | 2821 |
|
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 | + } |
2829 | 2827 |
|
2830 |
| - this.$style_tags = this.$style_tags.add(tag); |
| 2828 | + this.$style_tags = this.$style_tags.add(tag); |
2831 | 2829 |
|
2832 |
| - return this; |
| 2830 | + return this; |
2833 | 2831 | };
|
2834 | 2832 |
|
2835 | 2833 |
|
|
2977 | 2975 | left: this.baseX + (coords.data.col -1) * this.min_widget_width,
|
2978 | 2976 | top: this.baseY + (coords.data.row -1) * this.min_widget_height
|
2979 | 2977 | });
|
2980 |
| - |
2981 | 2978 | }, this));
|
2982 | 2979 |
|
2983 | 2980 | return this;
|
|
3072 | 3069 |
|
3073 | 3070 | //jQuery adapter
|
3074 | 3071 | $.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 | + }); |
3080 | 3077 | };
|
3081 | 3078 |
|
3082 | 3079 | $.Gridster = fn;
|
|
0 commit comments