From 257914ee99521abcd98c97775ff010082b564f0a Mon Sep 17 00:00:00 2001 From: vieron Date: Wed, 18 Jul 2012 18:31:44 +0200 Subject: [PATCH 001/248] initial commit --- .gitignore | 5 + dist/jquery.gridster.css | 48 + dist/jquery.gridster.js | 2237 +++++ dist/jquery.gridster.min.css | 3 + dist/jquery.gridster.min.js | 4 + docs/api.js | 11 + docs/assets/css/external-small.png | Bin 0 -> 491 bytes docs/assets/css/logo.png | Bin 0 -> 6308 bytes docs/assets/css/main.css | 782 ++ docs/assets/favicon.png | Bin 0 -> 740 bytes docs/assets/img/spinner.gif | Bin 0 -> 2685 bytes docs/assets/index.html | 10 + docs/assets/js/api-filter.js | 52 + docs/assets/js/api-list.js | 251 + docs/assets/js/api-search.js | 98 + docs/assets/js/apidocs.js | 351 + docs/assets/js/yui-prettify.js | 17 + docs/assets/vendor/prettify/CHANGES.html | 130 + docs/assets/vendor/prettify/COPYING | 202 + docs/assets/vendor/prettify/README.html | 203 + docs/assets/vendor/prettify/prettify-min.css | 1 + docs/assets/vendor/prettify/prettify-min.js | 35 + docs/classes/Collision.html | 368 + docs/classes/Coords.html | 253 + docs/classes/Gridster.html | 7646 ++++++++++++++ docs/classes/index.html | 10 + docs/data.json | 1475 +++ docs/files/index.html | 10 + docs/files/src_jquery.collision.js.html | 320 + docs/files/src_jquery.coords.js.html | 201 + docs/files/src_jquery.gridster.js.html | 2072 ++++ docs/index.html | 127 + docs/modules/index.html | 10 + grunt.js | 86 + index.html | 391 + libs/jquery-ui/jquery-ui.js | 25 + libs/jquery/jquery.js | 9404 ++++++++++++++++++ libs/qunit/qunit.css | 232 + libs/qunit/qunit.js | 1659 +++ package.json | 32 + src/jquery.collision.js | 207 + src/jquery.coords.js | 88 + src/jquery.gridster.css | 44 + src/jquery.gridster.js | 1959 ++++ test/jquery.gridder.html | 68 + test/jquery.gridder_test.js | 38 + www/css/style.css | 437 + www/css/untitled | 4 + www/img/sprite.png | Bin 0 -> 21203 bytes www/js/libs/jquery-1.7.2.min.js | 4 + www/js/libs/modernizr-2.5.3.min.js | 4 + www/js/script.js | 10 + 52 files changed, 31624 insertions(+) create mode 100644 .gitignore create mode 100644 dist/jquery.gridster.css create mode 100644 dist/jquery.gridster.js create mode 100644 dist/jquery.gridster.min.css create mode 100644 dist/jquery.gridster.min.js create mode 100644 docs/api.js create mode 100644 docs/assets/css/external-small.png create mode 100644 docs/assets/css/logo.png create mode 100644 docs/assets/css/main.css create mode 100644 docs/assets/favicon.png create mode 100644 docs/assets/img/spinner.gif create mode 100644 docs/assets/index.html create mode 100644 docs/assets/js/api-filter.js create mode 100644 docs/assets/js/api-list.js create mode 100644 docs/assets/js/api-search.js create mode 100644 docs/assets/js/apidocs.js create mode 100644 docs/assets/js/yui-prettify.js create mode 100644 docs/assets/vendor/prettify/CHANGES.html create mode 100644 docs/assets/vendor/prettify/COPYING create mode 100644 docs/assets/vendor/prettify/README.html create mode 100644 docs/assets/vendor/prettify/prettify-min.css create mode 100644 docs/assets/vendor/prettify/prettify-min.js create mode 100644 docs/classes/Collision.html create mode 100644 docs/classes/Coords.html create mode 100644 docs/classes/Gridster.html create mode 100644 docs/classes/index.html create mode 100644 docs/data.json create mode 100644 docs/files/index.html create mode 100644 docs/files/src_jquery.collision.js.html create mode 100644 docs/files/src_jquery.coords.js.html create mode 100644 docs/files/src_jquery.gridster.js.html create mode 100644 docs/index.html create mode 100644 docs/modules/index.html create mode 100644 grunt.js create mode 100755 index.html create mode 100644 libs/jquery-ui/jquery-ui.js create mode 100644 libs/jquery/jquery.js create mode 100644 libs/qunit/qunit.css create mode 100644 libs/qunit/qunit.js create mode 100644 package.json create mode 100644 src/jquery.collision.js create mode 100644 src/jquery.coords.js create mode 100644 src/jquery.gridster.css create mode 100644 src/jquery.gridster.js create mode 100644 test/jquery.gridder.html create mode 100644 test/jquery.gridder_test.js create mode 100755 www/css/style.css create mode 100644 www/css/untitled create mode 100644 www/img/sprite.png create mode 100755 www/js/libs/jquery-1.7.2.min.js create mode 100755 www/js/libs/modernizr-2.5.3.min.js create mode 100755 www/js/script.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..51102461ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +demo/ +node_modules/ +LICENSE-GPL +LICENSE-MIT +README.md diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css new file mode 100644 index 0000000000..613fb1df7c --- /dev/null +++ b/dist/jquery.gridster.css @@ -0,0 +1,48 @@ +/*! gridster.js - v0.1.0 - 2012-07-18 +* https://github.com/ducksboard/gridster.js +* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ + +.gridster { + position:relative; +} + +.gridster > * { + margin: 0 auto; + -webkit-transition: height .4s; + -moz-transition: height .4s; + -o-transition: height .4s; + -ms-transition: height .4s; + transition: height .4s; +} + +.gridster .gs_w{ + z-index: 2; + position: absolute; + background: rgba(0,0,0,.23); +} + +.ready .gs_w:not(.player):not(.preview-holder) { + -webkit-transition: left .3s, top .3s; + -moz-transition: left .3s, top .3s; + -o-transition: left .3s, top .3s; +} + +.gridster.dragging .support-grid { + z-index: 5; +} + +.gridster.dragging .ui-sortable-helper{ + z-index: 10; +} + +.gridster .preview-holder { + border: 2px dashed #333 ; + border-radius: 5px; + z-index: 1; + background:#FFF; + position: absolute; +} + +.gridster .player { + z-index: 10!important; +} diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js new file mode 100644 index 0000000000..7f0b89e2ea --- /dev/null +++ b/dist/jquery.gridster.js @@ -0,0 +1,2237 @@ +/*! gridster.js - v0.1.0 - 2012-07-18 +* https://github.com/ducksboard/gridster.js +* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ + +;(function($, window, document, undefined){ + /** + * Coords description + * + * @class Coords + * @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties. + * @constructor + */ + function Coords(obj) { + if (obj[0] && $.isPlainObject(obj[0])) { + this.data = obj[0]; + }else { + this.el = obj; + } + + this.isCoords = true; + this.coords = {}; + this.init(); + return this; + } + + var fn = Coords.prototype; + + fn.init = function(){ + this.set(); + this.original_coords = this.get(); + }; + + fn.set = function(update) { + var el = this.el; + if (el) { + this.data = el.offset(); + this.data.width || (this.data.width = el.width()); + this.data.height || (this.data.height = el.height()); + } + + var d = this.data; + + this.coords.x1 = d.left; + this.coords.y1 = d.top; + this.coords.x2 = d.left + d.width; + this.coords.y2 = d.top + d.height; + this.coords.cx = d.left + (d.width / 2); + this.coords.cy = d.top + (d.height / 2); + this.coords.width = d.width; + this.coords.height = d.height; + this.coords.el = el || false ; + + return this; + }; + + fn.update = function(data){ + if (!data && !this.el) { + return this; + } + + if (data) { + var new_data = $.extend(this.data, data); + this.data = new_data; + } + this.set(true); + return this; + }; + + fn.get = function(){ + return this.coords; + }; + + //jQuery adapter + $.fn.coords = function() { + if (this.data('coords') ) { + return this.data('coords'); + } + + var ins = new Coords(this, arguments[0]); + this.data('coords', ins); + return ins; + }; + +}(jQuery, window, document)); + +;(function($, window, document, undefined){ + + var defaults = { + colliders_context: document.body, + on_overlap: function(collider_data){}, + on_overlap_start : function(collider_data){ + // console.log('the element START being a collider', collider_data); + }, + on_overlap_stop : function(collider_data){ + // console.log('the element STOP being a collider', collider_data); + } + }; + + /** + * Collision + * + * @class Collision + * @uses Coords + * @param {HTMLElement} element An Attribute name or object property path + * @param {String|HTMLElement|Array} colliders An Attribute name or object property path + * @param {Object} [options] An Attribute name or object property path + * @param {Function} [options.on_overlap] An Attribute name or object property path + * @param {Function} [options.on_overlap_start] An Attribute name or object property path + * @param {Function} [options.on_overlap_stop] An Attribute name or object property path + * @return {Object} dasdasdadasd + * @constructor + */ + function Collision(element, colliders, options) { + this.options = $.extend(defaults, options); + this.$element = element; + this.last_colliders = []; + this.last_colliders_coords = []; + if (typeof colliders === 'string' || colliders instanceof jQuery) { + this.$colliders = $(colliders, + this.options.colliders_context).not(this.$element); + }else{ + this.colliders = $(colliders); + } + + this.init(); + } + + var fn = Collision.prototype; + + fn.init = function() { + this.find_collisions(); + }; + + fn.overlaps = function(a, b) { + var x = false; + var y = false; + + if ((b.x1 >= a.x1 && b.x1 <= a.x2) || + (b.x2 >= a.x1 && b.x2 <= a.x2) || + (a.x1 >= b.x1 && a.x2 <= b.x2) + ) { x = true; } + + if ((b.y1 >= a.y1 && b.y1 <= a.y2) || + (b.y2 >= a.y1 && b.y2 <= a.y2) || + (a.y1 >= b.y1 && a.y2 <= b.y2) + ) { y = true; } + + return (x && y); + }; + + fn.detect_overlapping_region = function(a, b){ + var regionX = ''; + var regionY = ''; + + if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } + if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } + if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } + if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } + + return (regionX + regionY) || 'C'; + }; + + fn.calculate_overlapped_area_coords = function(a, b){ + var x1 = Math.max(a.x1, b.x1); + var y1 = Math.max(a.y1, b.y1); + var x2 = Math.min(a.x2, b.x2); + var y2 = Math.min(a.y2, b.y2); + + return $({ + left: x1, + top: y1, + width : (x2 - x1), + height: (y2 - y1) + }).coords().get(); + }; + + fn.calculate_overlapped_area = function(coords){ + return (coords.width * coords.height); + }; + + fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){ + var last = this.last_colliders_coords; + + for (var i = 0, il = last.length; i < il; i++) { + if ($.inArray(last[i], new_colliders_coords) === -1) { + start_callback.call(this, last[i]); + } + } + + for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { + if ($.inArray(new_colliders_coords[j], last) === -1) { + stop_callback.call(this, new_colliders_coords[j]); + } + + } + }; + + fn.find_collisions = function(){ + var self = this; + var colliders_coords = []; + var colliders_data = []; + var $colliders = (this.colliders || this.$colliders); + var count = $colliders.length; + + while(count--){ + var $collider = self.$colliders ? $($colliders[count]) : $colliders[count]; + var player_coords = self.$element.coords().update().get(); + var $collider_coords_ins = ($collider.isCoords) ? + $collider.update() : $collider.coords(); + var collider_coords = $collider_coords_ins.get(); + var overlaps = self.overlaps(player_coords, collider_coords); + + if (!overlaps) { + continue; + } + + var region = self.detect_overlapping_region(player_coords, + collider_coords); + //todo: make this if customizable + if (region === 'C'){ + var area_coords = self.calculate_overlapped_area_coords( + player_coords, collider_coords); + var area = self.calculate_overlapped_area(area_coords); + var collider_data = { + area: area, + area_coords : area_coords, + region: region, + coords: collider_coords, + player_coords: player_coords, + el: $collider + }; + + self.options.on_overlap.call(this, collider_data); + colliders_coords.push($collider_coords_ins); + colliders_data.push(collider_data); + } + + } + + this.manage_colliders_start_stop(colliders_coords, + self.options.on_overlap_stop, self.options.on_overlap_start); + + this.last_colliders_coords = colliders_coords; + + return colliders_data; + }; + + + fn.get_closest_colliders = function(){ + var colliders = this.find_collisions(); + var min_area = 100; + colliders.sort(function(a, b){ + + if (a.area <= min_area) { + return 1; + } + + /* if colliders are being overlapped by the "C" (center) region, + * we have to set a lower index in the array to which they are placed + * above in the grid. */ + if (a.region === 'C' && b.region === 'C') { + if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { + return - 1; + }else{ + return 1; + } + } + + if (a.area < b.area){ + return 1; + } + + return 1; + }); + return colliders; + }; + + //jQuery adapter + $.fn.collision = function(collider, options) { + return new Collision( this, collider, options ); + }; + + +}(jQuery, window, document)); + +;(function($, window, document, undefined) { + + var defaults = { + widget_selector: '> li', + widget_margins: [10, 10], + widget_base_dimensions: [400, 225], + extra_rows: 0, + extra_cols: 0, + min_cols: 1, + min_rows: 10, + autogenerate_stylesheet: true, + serialize_params: function($w, wgd) { + return { + col: wgd.col, + row: wgd.row + }; + }, + collision: { + on_overlap: function(coords) {} + }, + draggable: { + + } + }; + + + /* Debounce and throttle functions taken from underscore.js */ + var debounce = function(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + var later = function() { + timeout = null; + if (!immediate) func.apply(context, args); + }; + if (immediate && !timeout) func.apply(context, args); + clearTimeout(timeout); + timeout = setTimeout(later, wait); + }; + }; + + + var throttle = function(func, wait) { + var context, args, timeout, throttling, more, result; + var whenDone = debounce(function(){ more = throttling = false; }, wait, true); + return function() { + context = this; args = arguments; + var later = function() { + timeout = null; + if (more) func.apply(context, args); + whenDone(); + }; + if (!timeout) timeout = setTimeout(later, wait); + if (throttling) { + more = true; + } else { + result = func.apply(context, args); + } + whenDone(); + throttling = true; + return result; + }; + }; + + + /** + * @class Gridster + * @uses Coords + * @uses Collision + * @param {HTMLElement} el The HTMLelement that contains all the widgets. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {HTMLElement|String} [options.widget_selector] Define who will be the + * draggable widgets. Can be a CSS Selector String or a collection of + * HTMLElements + * @param {Array} [options.widget_margins] Margin between widgets. The first + * index for the horizontal margin (left, right) and the second + * for the vertical margin (top, bottom). + * @param {Array} [options.widget_base_dimensions] Base widget dimensions in + * pixels. The first index for the width and the second for the + * height. + * @param {Number} [options.extra_cols] Add more columns in addition to + * those that have been calculated. + * @param {Number} [options.extra_rows] Add more rows in addition to + * those that have been calculated. + * @param {Number} [options.min_cols] The minimum required columns. + * @param {Number} [options.min_rows] The minimum required rows. + * @param {Boolean} [options.autogenerate_stylesheet] If true, all the + * CSS required to position all widgets in their respective columns + * and rows will be generated automatically and injected to the + * `` of the document. You can set this to false, and write + * your own CSS targeting rows and cols via data-attributes like so: + * `[data-col="1"] { left: 10px; }` + * @param {Function} [options.serialize_params] Return the data you want + * for each widget in the serialization. Two arguments are passed: + * `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid + * coords object (`col`, `row`, `size_x`, `size_y`). + * @param {Object} [options.collision] An Object with all options for + * Collision class you want to overwrite. See Collision docs for + * more info. + * @param {Object} [options.draggable] An Object with all options for + * jQuery UI Draggable you want to overwrite. See + * http://jqueryui.com/demos/draggable/ for more info. + * + * @constructor + */ + function Gridster(el, options) { + this.options = $.extend(true, defaults, options); + this.$el = $(el); + this.$wrapper = this.$el.parent(); + this.$widgets = this.$el.find(this.options.widget_selector).addClass('gs_w'); + this.widgets = []; + this.$changed = $([]); + this.wrapper_width = this.$wrapper.width(); + this.min_widget_width = (this.options.widget_margins[0] * 2) + + this.options.widget_base_dimensions[0]; + this.min_widget_height = (this.options.widget_margins[1] * 2) + + this.options.widget_base_dimensions[1]; + this.init(); + } + + var fn = Gridster.prototype; + + fn.init = function() { + this.generate_grid_and_stylesheet(); + this.get_widgets_from_DOM(); + this.set_dom_grid_height(); + this.$wrapper.addClass('ready'); + this.draggable(); + }; + + + /** + * Add a new widget to the grid. + * + * @method add_widget + * @param {String} html The string representing the HTML of the widget. + * @param {Number} size_x The nº of rows the widget occupies horizontally. + * @param {Number} size_y The nº of columns the widget occupies vertically. + * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing + * the widget that was just created. + */ + fn.add_widget = function(html, size_x, size_y) { + var $w = $(html).attr({ + 'data-col': this.highest_occupied_cell.col, + 'data-row': this.highest_occupied_cell.row + 1, + 'data-sizex' : size_x || 1, + 'data-sizey' : size_y || 1 + }).addClass('gs_w').appendTo(this.$el).hide(); + + this.$widgets = this.$widgets.add($w); + + this.register_widget($w); + + this.$widgets.draggable('destroy'); + this.draggable(); + + this.set_dom_grid_height(); + + $w.fadeIn(); + }; + + + /** + * Remove a widget from the grid. + * + * @method remove_widget + * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.remove_widget = function(el) { + var $el = el instanceof jQuery ? el : $(el); + var wgd = $el.coords().grid; + + this.$widgets = this.$widgets.not($el); + + var $nexts = this.widgets_below($el); + + this.remove_from_gridmap(wgd); + + $el.fadeOut($.proxy(function(){ + $el.remove(); + $nexts.each($.proxy(function(i, widget){ + this.move_widget_up( $(widget), wgd.size_y ); + }, this)); + }, this)); + }; + + + /** + * Returns a serialized array of the widgets in the grid. + * + * @method serialize + * @param {HTMLElement} [$widgets] The collection of jQuery wrapped + * HTMLElements you want to serialize. If no argument is passed all widgets + * will be serialized. + * @return {Array} Returns an Array of Objects with the data specified in + * the serialize_params option. + */ + fn.serialize = function($widgets) { + $widgets || ($widgets = this.$widgets); + var result = []; + $widgets.each($.proxy(function(i, widget){ + result.push( this.options.serialize_params( + $(widget),$(widget).coords().grid ) ); + }, this)); + + return result; + }; + + + /** + * Returns a serialized array of the widgets that have changed their position. + * + * @method serialize_changed + * @return {Array} Returns an Array of Objects with the data specified in + * the serialize_params option. + */ + fn.serialize_changed = function() { + return this.serialize(this.$changed); + }; + + + /** + * Creates the grid coords object representing the widget a add it to the mapped array of positions + * + * @method serialize_changed + * @return {Array} Returns the instance of the Gridster class. + */ + fn.register_widget = function($el) { + var widget_grid_data = { + 'col': parseInt($el.attr('data-col'), 10), + 'row': parseInt($el.attr('data-row'), 10), + 'size_x': parseInt($el.attr('data-sizex'), 10), + 'size_y': parseInt($el.attr('data-sizey'), 10), + 'el': $el + }; + + // attach Coord object to player data-coord attribute + $el.data('coords', $el.coords()); + + // Extend Coord object with grid position info + $el.data('coords').grid = widget_grid_data; + + this.add_to_gridmap(widget_grid_data, $el); + this.widgets.push($el); + return this; + }; + + + /** + * Update in the mapped array of positions the value of cells represented by + * the grid coords object passed in the `grid_data` param. + * + * @param {Object} grid_data The grid coords object representing the cells + * to update in the mapped array. + * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped + * HTMLElement, depends if you want to delete an existing position or add + * a new one. + * @method update_widget_position + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.update_widget_position = function(grid_data, value) { + this.for_each_cell_occupied(grid_data, function(col, row) { + if (!this.gridmap[col]) { return this; } + this.gridmap[col][row] = value; + }); + return this; + }; + + + /** + * Remove a widget from the mapped array of positions. + * + * @method remove_from_gridmap + * @param {Object} grid_data The grid coords object representing the cells + * to update in the mapped array. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.remove_from_gridmap = function(grid_data){ + return this.update_widget_position(grid_data, false); + }; + + + /** + * Add a widget to the mapped array of positions. + * + * @method add_to_gridmap + * @param {Object} grid_data The grid coords object representing the cells + * to update in the mapped array. + * @param {HTMLElement|Boolean} value The value to set in the specified + * position . + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.add_to_gridmap = function(grid_data, value){ + this.update_widget_position(grid_data, value || grid_data.el); + + if (grid_data.el) { + var $widgets = this.widgets_below(grid_data.el); + $widgets.each($.proxy(function(i, widget){ + this.move_widget_up( $(widget)); + }, this)); + } + }; + + + /** + * Make widgets draggable. It Wraps the jQuery UI Draggable Plugin. + * + * @method draggable + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.draggable = function() { + var self = this; + var draggable_options = $.extend(true, {}, this.options.draggable, { + // containment : this.$wrapper, + start: function(event, ui) { + self.$player = $(this); + self.on_start_drag.call(self, event, ui); + }, + stop: function(event, ui) { + self.on_stop_drag.call(self, ui); + }, + drag: throttle(function(event, ui) { + self.on_drag.call(self, event, ui); + }, 100, true) + }); + + this.$widgets.draggable(draggable_options); + + return this; + }; + + + /** + * This function is executed when the player begins to be dragged. + * + * @method on_start_drag + * @param {Event} The original browser event + * @param {Object} A prepared ui object. + * See http://jqueryui.com/demos/draggable/ for more info. + */ + fn.on_start_drag = function(event, ui) { + this.$player.addClass('player'); + this.$wrapper.addClass('dragging'); + this.player_grid_data = this.$player.coords().grid; + this.placeholder_grid_data = $.extend({}, this.player_grid_data); + + + //set new grid height along the dragging period + this.$el.css('height', this.$el.height() + + (this.player_grid_data.size_y * this.min_widget_height)); + + var colliders = this.faux_grid; + var coords = this.$player.data('coords').coords; + + this.cells_occupied_by_player = this.get_cells_occupied(this.player_grid_data); + this.cells_occupied_by_placeholder = this.get_cells_occupied(this.placeholder_grid_data); + + this.last_cols = []; + this.last_rows = []; + + // see jquery.collision.js + this.drag_api = this.$player.collision(colliders, this.options.collision); + + this.$preview_holder = $('
  • ', { + 'class': 'preview-holder', + 'data-row': this.$player.attr('data-row'), + 'data-col': this.$player.attr('data-col'), + css: { + width: coords.width, + height: coords.height + } + }).appendTo(this.$el); + + if (this.options.draggable.start) { + this.options.draggable.start.call(this, event, ui); + } + }; + + + /** + * This function is executed when the player is being dragged. + * + * @method on_drag + * @param {Event} The original browser event + * @param {Object} A prepared ui object. + * See http://jqueryui.com/demos/draggable/ for more info. + */ + fn.on_drag = function(event, ui) { + this.colliders_data = this.drag_api.get_closest_colliders(); + + this.on_overlapped_column_change( + this.on_start_overlapping_column, + this.on_stop_overlapping_column + ); + + this.on_overlapped_row_change( + this.on_start_overlapping_row, + this.on_stop_overlapping_row + ); + + if (this.options.draggable.drag) { + this.options.draggable.drag.call(this, event, ui); + } + }; + + /** + * This function is executed when the player stops being dragged. + * + * @method on_stop_drag + * @param {Event} The original browser event + * @param {Object} A prepared ui object. + * See http://jqueryui.com/demos/draggable/ for more info. + */ + fn.on_stop_drag = function(event, ui) { + this.colliders_data = this.drag_api.get_closest_colliders(); + + this.on_overlapped_column_change( + this.on_start_overlapping_column, + this.on_stop_overlapping_column + ); + + this.on_overlapped_row_change( + this.on_start_overlapping_row, + this.on_stop_overlapping_row + ); + + this.$player.attr({ + 'data-col': this.placeholder_grid_data.col, + 'data-row': this.placeholder_grid_data.row + }).css({ + 'left': '', + 'top': '' + }).removeClass('player'); + + this.$changed = this.$changed.add(this.$player); + + this.cells_occupied_by_player = this.get_cells_occupied( + this.placeholder_grid_data); + this.set_cells_player_occupies( + this.placeholder_grid_data.col, this.placeholder_grid_data.row); + + this.$player.coords().grid.row = this.placeholder_grid_data.row; + this.$player.coords().grid.col = this.placeholder_grid_data.col; + + this.$player = null; + + this.$preview_holder.remove(); + + this.set_dom_grid_height(); + + if (this.options.draggable.stop) { + this.options.draggable.stop.call(this, event, ui); + } + }; + + + /** + * Executes the callbacks passed as arguments when a column begins to be + * overlapped or stops being overlapped. + * + * @param {Function} start_callback Function executed when a new column + * begins to be overlapped. The column is passed as first argument. + * @param {Function} stop_callback Function executed when a column stops + * being overlapped. The column is passed as first argument. + * @method on_overlapped_column_change + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.on_overlapped_column_change = function(start_callback, stop_callback) { + if (!this.colliders_data.length) { + return; + } + var cols = this.get_targeted_columns( + this.colliders_data[0].el.data.col); + + var last_n_cols = this.last_cols.length; + var n_cols = cols.length; + var i; + + for (i = 0; i < n_cols; i++) { + if ($.inArray(cols[i], this.last_cols) === -1) { + (start_callback || $.noop).call(this, cols[i]); + } + } + + for (i = 0; i< last_n_cols; i++) { + if ($.inArray(this.last_cols[i], cols) === -1) { + (stop_callback || $.noop).call(this, this.last_cols[i]); + } + } + + this.last_cols = cols; + + return this; + }; + + + /** + * Executes the callbacks passed as arguments when a row starts to be + * overlapped or stops being overlapped. + * + * @param {Function} start_callback Function executed when a new row begins + * to be overlapped. The row is passed as first argument. + * @param {Function} stop_callback Function executed when a row stops being + * overlapped. The row is passed as first argument. + * @method on_overlapped_row_change + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.on_overlapped_row_change = function(start_callback, end_callback) { + if (!this.colliders_data.length) { + return; + } + var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row); + var last_n_rows = this.last_rows.length; + var n_rows = rows.length; + var i; + + for (i = 0; i < n_rows; i++) { + if ($.inArray(rows[i], this.last_rows) === -1) { + (start_callback || $.noop).call(this, rows[i]); + } + } + + for (i = 0; i < last_n_rows; i++) { + if ($.inArray(this.last_rows[i], rows) === -1) { + (end_callback || $.noop).call(this, this.last_rows[i]); + } + } + + this.last_rows = rows; + }; + + + /** + * Sets the current position of the player + * + * @param {Function} start_callback Function executed when a new row begins + * to be overlapped. The row is passed as first argument. + * @param {Function} stop_callback Function executed when a row stops being + * overlapped. The row is passed as first argument. + * @method set_player + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.set_player = function(col, row) { + this.empty_cells_player_occupies(); + + var self = this; + var cell = self.colliders_data[0].el.data; + var to_col = cell.col; + var to_row = row || cell.row; + + this.player_grid_data = { + col: to_col, + row: to_row, + size_y : this.player_grid_data.size_y, + size_x : this.player_grid_data.size_x + }; + + this.cells_occupied_by_player = this.get_cells_occupied( + this.player_grid_data); + + var $overlapped_widgets = this.get_widgets_overlapped( + this.player_grid_data); + + var constraints = this.widgets_constraints($overlapped_widgets); + + this.manage_movements(constraints.can_go_up, to_col, to_row); + this.manage_movements(constraints.can_not_go_up, to_col, to_row); + + /* if there is not widgets overlapping in the new player position, + * update the new placeholder position. */ + if (!$overlapped_widgets.length) { + var pp = this.can_go_player_up(this.player_grid_data); + if (pp !== false) { + to_row = pp; + } + this.set_placeholder(to_col, to_row); + } + + return { + col: to_col, + row: to_row + }; + }; + + + /** + * See which of the widgets in the $widgets param collection can go to + * a upper row and which not. + * + * @method widgets_contraints + * @param {HTMLElements} $widgets A jQuery wrapped collection of + * HTMLElements. + * @return {Array} Returns a literal Object with two keys: `can_go_up` & + * `can_not_go_up`. Each contains a set of HTMLElements. + */ + fn.widgets_constraints = function($widgets) { + var $widgets_can_go_up = $([]); + var $widgets_can_not_go_up; + var wgd_can_go_up = []; + var wgd_can_not_go_up = []; + + $widgets.each($.proxy(function(i, w){ + var $w = $(w); + var wgd = $w.coords().grid; + if (this.can_go_widget_up(wgd)) { + $widgets_can_go_up = $widgets_can_go_up.add($w); + wgd_can_go_up.push(wgd); + }else{ + wgd_can_not_go_up.push(wgd); + } + }, this)); + + $widgets_can_not_go_up = $widgets.not($widgets_can_go_up); + + return { + can_go_up: this.sort_by_row_asc(wgd_can_go_up), + can_not_go_up: this.sort_by_row_desc(wgd_can_not_go_up) + }; + }; + + + /** + * Sorts an Array of grid coords objects (representing the grid coords of each widget) in ascending way. + * + * @method sort_by_row_asc + * @param {Array} widgets Array of grid coords objects + * @return {Array} Returns the array sorted. + */ + fn.sort_by_row_asc = function(widgets) { + widgets = widgets.sort(function(a, b){ + if (a.row > b.row) { + return 1; + } + return -1; + }); + + return widgets; + }; + + + /** + * Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way. + * + * @method sort_by_row_desc + * @param {Array} widgets Array of grid coords objects + * @return {Array} Returns the array sorted. + */ + fn.sort_by_row_desc = function(widgets) { + widgets = widgets.sort(function(a, b){ + if (a.row + a.size_y < b.row + b.size_y){ + return 1; + } + return -1; + }); + return widgets; + }; + + + /** + * Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way. + * + * @method manage_movements + * @param {HTMLElements} $widgets A jQuery collection of HTMLElements + * representing the widgets you want to move. + * @param {Number} to_col The column to which we want to move the widgets. + * @param {Number} to_row The row to which we want to move the widgets. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.manage_movements = function($widgets, to_col, to_row) { + $.each($widgets, $.proxy(function(i, w){ + var wgd = w; + var $w = wgd.el; + + var can_go_widget_up = this.can_go_widget_up(wgd); + + if (can_go_widget_up) { + //target CAN go up + //so move widget up + this.move_widget_to($w, can_go_widget_up); + this.set_placeholder(to_col, can_go_widget_up + wgd.size_y); + + } else { + //target can't go up + var can_go_player_up = this.can_go_player_up( + this.player_grid_data); + + if (!can_go_player_up) { + // target can't go up + // player cant't go up + // so we need to move widget down to a position that dont + // overlaps player + var y = (to_row + this.player_grid_data.size_y) - wgd.row; + + this.move_widget_down($w, y); + this.set_placeholder(to_col, to_row); + } + } + }, this)); + + return this; + }; + + + /** + * Determines if there is a widget in the row and col given. Or if the + * HTMLElement passed as first argument is the player. + * + * @method is_player + * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of + * HTMLElements. + * @param {Number} [row] The column to which we want to move the widgets. + * @return {Boolean} Returns true or false. + */ + fn.is_player = function(col_or_el, row) { + if (row && !this.gridmap[col_or_el]) { return false; } + var $w = row ? this.gridmap[col_or_el][row] : col_or_el; + return $w && $w.is(this.$player); + }; + + + /** + * Determines if the widget that is being dragged is currently over the row + * and col given. + * + * @method is_player_in + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_player_in = function(col, row) { + var c = this.cells_occupied_by_player; + return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0; + }; + + + /** + * Determines if the placeholder is currently over the row and col given. + * + * @method is_placeholder_in + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_placeholder_in = function(col, row) { + var c = this.cells_occupied_by_placeholder || []; + return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0; + }; + + + fn.is_placeholder_in_col = function(col, row) { + return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0; + }; + + + /** + * Determines if the placeholder is currently over the row and col given. + * + * @method is_placeholder_in + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_placeholder_in = function(col, row) { + var c = this.cells_occupied_by_placeholder || []; + return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0; + }; + + + /** + * Determines if the cell represented by col and row params is empty. + * + * @method is_empty + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_empty = function(col, row) { + if (typeof this.gridmap[col] !== 'undefined' && + typeof this.gridmap[col][row] !== 'undefined' && + this.gridmap[col][row] === false + ) { + return true; + } + return false; + }; + + + /** + * Determines if the cell represented by col and row params is occupied. + * + * @method is_occupied + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_occupied = function(col, row) { + if (!this.gridmap[col]) { + return false; + } + + if (this.gridmap[col][row]) { + return true; + } + return false; + }; + + + /** + * Determines if there is a widget in the cell represented by col/row params. + * + * @method is_widget + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean|HTMLElement} Returns false if there is no widget, + * else returns the jQuery HTMLElement + */ + fn.is_widget = function(col, row) { + var cell = this.gridmap[col]; + if (!cell) { + return false; + } + + cell = cell[row]; + + if (cell) { + return cell; + } + + return false; + }; + + + /** + * Determines if there is a widget in the cell represented by col/row + * params and if this is under the widget that is being dragged. + * + * @method is_widget_under_player + * @param {Number} col The column to check. + * @param {Number} row The row to check. + * @return {Boolean} Returns true or false. + */ + fn.is_widget_under_player = function(col, row) { + if (this.is_widget(col, row)) { + return this.is_player_in(col, row); + } + return false; + }; + + + /** + * Get widgets overlapping with the player. + * + * @method get_widgets_under_player + * @return {HTMLElement} Returns a jQuery collection of HTMLElements + */ + fn.get_widgets_under_player = function() { + var cells = this.cells_occupied_by_player; + var $widgets = $([]); + + $.each(cells.cols, $.proxy(function(i, col){ + $.each(cells.rows, $.proxy(function(i, row){ + if(this.is_widget(col, row)){ + $widgets = $widgets.add(this.gridmap[col][row]); + } + }, this)); + }, this)); + + return $widgets; + }; + + + /** + * Put placeholder at the row and column specified. + * + * @method set_placeholder + * @param {Number} col The column to which we want to move the + * placeholder. + * @param {Number} row The row to which we want to move the + * placeholder. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.set_placeholder = function(col, row) { + var phgd = $.extend({}, this.placeholder_grid_data); + var $nexts = this.widgets_below({ + col: phgd.col, + row: phgd.row, + size_y: phgd.size_y, + size_x: phgd.size_x + }); + var moved_down = this.placeholder_grid_data.row < row; + var changed_column = this.placeholder_grid_data.col !== col; + + this.placeholder_grid_data.col = col; + this.placeholder_grid_data.row = row; + + this.cells_occupied_by_placeholder = this.get_cells_occupied( + this.placeholder_grid_data); + + this.$preview_holder.attr({ + 'data-row' : row, + 'data-col' : col + }); + + if (moved_down || changed_column) { + $nexts.each($.proxy(function(i, widget){ + this.move_widget_up( $(widget) , this.placeholder_grid_data.col - col + phgd.size_y ); + }, this)); + } + + }; + + + /** + * Determines whether the player can move to a position above. + * + * @method can_go_player_up + * @param {Object} widget_grid_data The actual grid coords object of the + * player. + * @return {Number|Boolean} If the player can be moved to an upper row + * returns the row number, else returns false. + */ + fn.can_go_player_up = function(widget_grid_data) { + var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; + var result = true; + var upper_rows = []; + var min_row = 10000; + var $widgets_under_player = this.get_widgets_under_player(); + + /* generate an array with columns as index and array with upper rows + * empty as value */ + this.for_each_column_occupied(widget_grid_data, function(tcol){ + var grid_col = this.gridmap[tcol]; + var r = p_bottom_row + 1; + upper_rows[tcol] = []; + + while (--r > 0){ + if (this.is_empty(tcol, r) || this.is_player(tcol, r) || + this.is_widget(tcol, r) && grid_col[r].is($widgets_under_player) + ) { + upper_rows[tcol].push(r); + min_row = r < min_row ? r : min_row; + }else{ + break; + } + } + + if (upper_rows[tcol].length === 0) { + result = false; + return true; //break + } + + upper_rows[tcol].sort(); + }); + + if (!result) { return false; } + + return this.get_valid_rows(widget_grid_data, upper_rows, min_row); + }; + + + /** + * Determines whether a widget can move to a position above. + * + * @method can_go_widget_up + * @param {Object} widget_grid_data The actual grid coords object of the + * widget we want to check. + * @return {Number|Boolean} If the widget can be moved to an upper row + * returns the row number, else returns false. + */ + fn.can_go_widget_up = function(widget_grid_data) { + var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; + var result = true; + var upper_rows = []; + var min_row = 10000; + + /* generate an array with columns as index and array with upper rows + * empty as value */ + this.for_each_column_occupied(widget_grid_data, function(tcol){ + var grid_col = this.gridmap[tcol]; + upper_rows[tcol] = []; + + var r = p_bottom_row + 1; + + while (--r > 0) { + if (this.is_occupied(tcol, r) && !this.is_player(tcol, r)) { + break; + } + + if (!this.is_player(tcol, r) &&!this.is_placeholder_in(tcol, r)) { + upper_rows[tcol].push(r); + } + + if (r < min_row ) { + min_row = r; + } + } + + if (upper_rows[tcol].length === 0) { + result = false; + return true; //break + } + + upper_rows[tcol].sort(); + }); + + if (!result) { return false; } + + return this.get_valid_rows(widget_grid_data, upper_rows, min_row); + }; + + + /** + * Search a valid row for the widget represented by `widget_grid_data' in + * the `upper_rows` array. Iteration starts from row specified in `min_row`. + * + * @method get_valid_rows + * @param {Object} widget_grid_data The actual grid coords object of the + * player. + * @param {Array} upper_rows An array with columns as index and arrays + * of valid rows as values. + * @param {Number} min_row The upper row from which the iteration will start. + * @return {Number|Boolean} Returns the upper row valid from the `upper_rows` + * for the widget in question. + */ + fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row){ + var p_top_row = widget_grid_data.row; + var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; + var size_y = widget_grid_data.size_y; + var r = min_row - 1; + var valid_rows = []; + + while (++r <= p_bottom_row ) { + var common = true; + $.each(upper_rows, function(col, rows){ + if (rows && $.inArray(r, rows) === -1) { + common = false; + } + }); + + if (common === true) { + valid_rows.push(r); + if (valid_rows.length === size_y) { + break; + } + } + } + + var new_row = false; + if (size_y === 1) { + if (valid_rows[0] !== p_top_row) { + new_row = valid_rows[0] || false; + } + }else{ + if (valid_rows[0] !== p_top_row) { + new_row = this.get_consecutive_numbers_index( + valid_rows, size_y); + } + } + + + return new_row; + }; + + + fn.get_consecutive_numbers_index = function(arr, size_y) { + var max = arr.length; + var result = []; + var first = true; + var prev = -1; // or null? + + for (var i=0; i < max; i++) { + if (first || arr[i] === prev + 1) { + result.push(i); + if (result.length === size_y) { + break; + } + first = false; + }else{ + result = []; + first = true; + } + + prev = arr[i]; + } + + return result.length >= size_y ? arr[result[0]] : false; + }; + + + /** + * Get widgets overlapping with the player. + * + * @method get_widgets_overlapped + * @return {HTMLElements} Returns a jQuery collection of HTMLElements. + */ + fn.get_widgets_overlapped = function() { + var $w; + var $widgets = $([]); + var used = []; + var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0); + rows_from_bottom.reverse(); + + $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col){ + $.each(rows_from_bottom, $.proxy(function(i, row){ + // if there is a widget in the player position + if (!this.gridmap[col]) { return true; } //next iteration + var $w = this.gridmap[col][row]; + + if (this.is_occupied(col, row) && !this.is_player($w) && + $.inArray($w, used) === -1 + ) { + $widgets = $widgets.add($w); + used.push($w); + } + + }, this)); + }, this)); + + return $widgets; + }; + + + /** + * This callback is executed when the player begins to collide with a column. + * + * @method on_start_overlapping_column + * @param {Number} col The collided column. + * @return {HTMLElements} Returns a jQuery collection of HTMLElements. + */ + fn.on_start_overlapping_column = function(col) { + this.set_player(col, false); + }; + + + /** + * A callback executed when the player begins to collide with a row. + * + * @method on_start_overlapping_row + * @param {Number} col The collided row. + * @return {HTMLElements} Returns a jQuery collection of HTMLElements. + */ + fn.on_start_overlapping_row = function(row) { + this.set_player(false, row); + }; + + + /** + * A callback executed when the the player ends to collide with a column. + * + * @method on_stop_overlapping_column + * @param {Number} col The collided row. + * @return {HTMLElements} Returns a jQuery collection of HTMLElements. + */ + fn.on_stop_overlapping_column = function(col) { + this.set_player(); + + var self = this; + this.for_each_widget_below(col, this.cells_occupied_by_player.rows[0], + function(tcol, trow) { + self.move_widget_up(this, self.player_grid_data.size_y); + }); + }; + + + /** + * This callback is executed when the player ends to collide with a row. + * + * @method on_stop_overlapping_row + * @param {Number} row The collided row. + * @return {HTMLElements} Returns a jQuery collection of HTMLElements. + */ + fn.on_stop_overlapping_row = function(row) { + this.set_player(); + + var self = this; + var cols = this.cells_occupied_by_player.cols; + for (var c = 0, cl = cols.length; c < cl; c++) { + this.for_each_widget_below(cols[c], row, function(tcol, trow) { + self.move_widget_up(this, self.player_grid_data.size_y); + }); + } + }; + + + /** + * Move a widget to a specific row. The cell or cells must be empty. + * If the widget has widgets below, all of these widgets will be moved also + * if they can. + * + * @method move_widget_to + * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the widget is going to be moved. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.move_widget_to = function($widget, row) { + var self = this; + var widget_grid_data = $widget.coords().grid; + var diff = row - widget_grid_data.row; + var $next_widgets = this.widgets_below($widget); + + var can_move_to_new_cell = this.can_move_to( + widget_grid_data, widget_grid_data.col, row, $widget); + + if (can_move_to_new_cell === false) { + return false; + } + + this.remove_from_gridmap(widget_grid_data); + widget_grid_data.row = row; + this.add_to_gridmap(widget_grid_data); + $widget.attr('data-row', row); + this.$changed = this.$changed.add($widget); + + + $next_widgets.each(function(i, widget){ + var $w = $(widget); + var wgd = $w.coords().grid; + var can_go_up = self.can_go_widget_up(wgd); + + if (can_go_up && can_go_up !== wgd.row){ + self.move_widget_to($w, can_go_up); + } + }); + + return this; + }; + + + /** + * Move up the specified widget and all below it. + * + * @method move_widget_up + * @param {HTMLElement} $widget The widget you want to move. + * @param {Number} [y_units] The number of cells that the widget has to move. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.move_widget_up = function($widget, y_units) { + var el_grid_data = $widget.coords().grid; + var actual_row = el_grid_data.row; + var moved = []; + var can_go_up = true; + y_units || (y_units = 1); + + if (!this.can_go_up($widget)) { return false; } //break; + + this.for_each_column_occupied(el_grid_data, function(col){ + // can_go_up + if ($.inArray($widget, moved) === -1) { + var widget_grid_data = $widget.coords().grid; + var next_row = actual_row - y_units; + next_row = this.can_go_up_to_row(widget_grid_data, col, next_row); + if (!next_row) { + return true; + } + + var $next_widgets = this.widgets_below($widget); + + this.remove_from_gridmap(widget_grid_data); + widget_grid_data.row = next_row; + this.add_to_gridmap(widget_grid_data); + $widget.attr('data-row', widget_grid_data.row); + this.$changed = this.$changed.add($widget); + + moved.push($widget); + + $next_widgets.each($.proxy(function(i, widget){ + this.move_widget_up($(widget), y_units); + }, this)); + } + }); + + }; + + + /** + * Move down the specified widget and all below it. + * + * @method move_widget_down + * @param {HTMLElement} $widget The jQuery object representing the widget you want to move. + * @param {Number} The number of cells that the widget has to move. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.move_widget_down = function($widget, y_units) { + var el_grid_data = $widget.coords().grid; + var actual_row = el_grid_data.row; + var moved = []; + var y_diff = y_units; + + if (!$widget) { return false; } + + if ($.inArray($widget, moved) === -1) { + + var widget_grid_data = $widget.coords().grid; + var next_row = actual_row + y_units; + var $next_widgets = this.widgets_below($widget); + + this.remove_from_gridmap(widget_grid_data); + + $next_widgets.each($.proxy(function(i, widget){ + var $w = $(widget); + var wd = $w.coords().grid; + var tmp_y = this.displacement_diff( + wd, widget_grid_data, y_diff); + + if (tmp_y > 0) { + this.move_widget_down($w, tmp_y); + } + }, this)); + + widget_grid_data.row = next_row; + this.update_widget_position(widget_grid_data, $widget); + $widget.attr('data-row', widget_grid_data.row); + this.$changed = this.$changed.add($widget); + + moved.push($widget); + } + }; + + + /** + * Check if the widget can move to the specified row, else returns the + * upper row possible. + * + * @method can_go_up_to_row + * @param {Number} widget_grid_data The current grid coords object of the + * widget. + * @param {Number} col The target column. + * @param {Number} row The target row. + * @return {Boolean|Number} Returns the row number if the widget can move + * to the target position, else returns false. + */ + fn.can_go_up_to_row = function(widget_grid_data, col, row) { + var ga = this.gridmap; + var result = true; + var urc = []; // upper_rows_in_columns + var actual_row = widget_grid_data.row; + var r; + + //generate an array with columns as index and array with upper rows empty in the column + this.for_each_column_occupied(widget_grid_data, function(tcol){ + var grid_col = ga[tcol]; + urc[tcol] = []; + + r = actual_row; + while (r--){ + if (this.is_empty(tcol, r) && + !this.is_placeholder_in(tcol, r) + ) { + urc[tcol].push(r); + }else{ + break; + } + } + + if (!urc[tcol].length) { + result = false; + return true; + } + + }); + + if (!result) { return false; } + + //get common rows starting from upper position in all the columns widget occupies + r = row; + for (r = 1; r < actual_row; r++) { + var common = true; + + for (var uc = 0, ucl = urc.length; uc < ucl; uc++) { + if (urc[uc] && $.inArray(r, urc[uc]) === -1) { + common = false; + } + } + + if (common === true) { + result = r; + break; + } + } + + return result; + }; + + + fn.displacement_diff = function(widget_grid_data, parent_bgd, y_units) { + var actual_row = widget_grid_data.row; + var diffs = []; + var parent_max_y = parent_bgd.row + parent_bgd.size_y; + + this.for_each_column_occupied(widget_grid_data, function(col){ + var temp_y_units = 0; + + for (var r = parent_max_y; r < actual_row; r++) { + if (this.is_empty(col, r)) { + temp_y_units = temp_y_units + 1; + } + } + + diffs.push(temp_y_units); + }); + + var max_diff = Math.max.apply(null, diffs); + y_units = (y_units - max_diff); + + return y_units > 0 ? y_units : 0; + }; + + + /** + * Get widgets below a widget. + * + * @method widgets_below + * @param {HTMLElement} $el The jQuery wrapped HTMLElement. + * @return {HTMLElements} A jQuery collection of HTMLElements. + */ + fn.widgets_below = function($el) { + var el_grid_data = $.isPlainObject($el) ? $el : $el.coords().grid; + var self = this; + var ga = this.gridmap; + var next_row = el_grid_data.row + el_grid_data.size_y - 1; + var $nexts = $([]); + + this.for_each_column_occupied(el_grid_data, function(col){ + self.for_each_widget_below(col, next_row, + function(tcol, trow){ + if (!self.is_player(this) && + $.inArray(this, $nexts) === -1) { + $nexts = $nexts.add(this); + return true; // break + } + }); + }); + + return this.sort_by_row_asc($nexts); + }; + + + /** + * Update the array of mapped positions with the new player position. + * + * @method set_cells_player_occupies + * @param {Number} col The new player col. + * @param {Number} col The new player row. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.set_cells_player_occupies = function(col, row) { + this.remove_from_gridmap(this.placeholder_grid_data); + this.placeholder_grid_data.col = col; + this.placeholder_grid_data.row = row; + this.add_to_gridmap(this.placeholder_grid_data, this.$player); + return this; + }; + + + /** + * Remove from the array of mapped positions the reference to the player. + * + * @method empty_cells_player_occupies + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.empty_cells_player_occupies = function() { + this.remove_from_gridmap(this.placeholder_grid_data); + return this; + }; + + + fn.can_go_up = function($el) { + var el_grid_data = $el.coords().grid; + var initial_row = el_grid_data.row; + var prev_row = initial_row - 1; + var ga = this.gridmap; + var upper_rows_by_column = []; + + var result = true; + if (initial_row === 1) { return false; } + + this.for_each_column_occupied(el_grid_data, function(col){ + if (this.is_occupied(col, prev_row) || + this.is_player(col, prev_row) || + this.is_placeholder_in(col, prev_row) + ) { + result = false; + return true; //break + } + }); + + return result; + }; + + + + /** + * Check if it's possible to move a widget to a specific col/row. It takes + * into account the dimensions (`size_y` and `size_x` attrs. of the grid coords + * object) the widget occupies. + * + * @method can_move_to + * @param {Object} widget_grid_data The grid coords object that represents + * the widget. + * @param {Object} The col target col. + * @param {Object} The row target row. + * @return {Boolean} Returns true if all cells are empty, else return false. + */ + fn.can_move_to = function(widget_grid_data, col, row) { + var ga = this.gridmap; + var $w = widget_grid_data.el; + var future_wd = { + size_y: widget_grid_data.size_y, + size_x: widget_grid_data.size_x, + col: col, + row: row + }; + var cells_occupied_by_w = this.get_cells_occupied(widget_grid_data); + var result = true; + + this.for_each_cell_occupied(future_wd, function(tcol, trow){ + var $tw = this.is_widget(tcol, trow); + if ($tw && !$tw.is($w)) { + result = false; + } + }); + + return result; + }; + + + /** + * Given the leftmost column returns all columns that are overlapping with the player. + * + * @method get_targeted_columns + * @param {Number} [from_col] The leftmost column. + * @return {Array} Returns an array with column numbers. + */ + fn.get_targeted_columns = function(from_col) { + var max = (from_col || this.player_grid_data.col) + + (this.player_grid_data.size_x - 1); + var cols = []; + for (var col = from_col; col <= max; col++) { + cols.push(col); + } + return cols; + }; + + + /** + * Given the upper row returns all rows that are overlapping with the player. + * + * @method get_targeted_rows + * @param {Number} [from_row] The upper row. + * @return {Array} Returns an array with row numbers. + */ + fn.get_targeted_rows = function(from_row) { + var max = (from_row || this.player_grid_data.row) + + (this.player_grid_data.size_y - 1); + var rows = []; + for (var row = from_row; row <= max; row++) { + rows.push(row); + } + return rows; + }; + + /** + * Get all columns and rows that a widget occupies. + * + * @method get_cells_occupied + * @param {Object} el_grid_data The grid coords object of the widget. + * @return {Object} Returns an object like `{ cols: [], rows: []}`. + */ + fn.get_cells_occupied = function(el_grid_data) { + var cells = { cols: [], rows: []}; + var i; + if (arguments[1] instanceof jQuery) { + el_grid_data = arguments[1].coords().grid; + } + + for (i = 0; i < el_grid_data.size_x; i++) { + var col = el_grid_data.col + i; + cells.cols.push(col); + } + + for (i = 0; i < el_grid_data.size_y; i++) { + var row = el_grid_data.row + i; + cells.rows.push(row); + } + + return cells; + }; + + + /** + * Iterate over the cells occupied by a widget executing a function for + * each one. + * + * @method for_each_column_occupied + * @param {Object} el_grid_data The grid coords object that represents the + * widget. + * @param {Function} callback The function to execute on each column + * iteration. Column and row are passed as arguments. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.for_each_cell_occupied = function(grid_data, callback) { + this.for_each_column_occupied(grid_data, function(col){ + this.for_each_row_occupied(grid_data, function(row){ + callback.call(this, col, row); + }); + }); + return this; + }; + + + /** + * Iterate over the columns occupied by a widget executing a function for + * each one. + * + * @method for_each_column_occupied + * @param {Object} el_grid_data The grid coords object that represents + * the widget. + * @param {Function} callback The function to execute on each column + * iteration. The column number is passed as first argument. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.for_each_column_occupied = function(el_grid_data, callback) { + for (var i = 0; i < el_grid_data.size_x; i++) { + var col = el_grid_data.col + i; + callback.call(this, col, el_grid_data); + } + }; + + + /** + * Iterate over the rows occupied by a widget executing a function for + * each one. + * + * @method for_each_row_occupied + * @param {Object} el_grid_data The grid coords object that represents + * the widget. + * @param {Function} callback The function to execute on each column iteration. The row number is passed as first argument. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.for_each_row_occupied = function(el_grid_data, callback) { + for (var i = 0; i < el_grid_data.size_y; i++) { + var row = el_grid_data.row + i; + callback.call(this, row, el_grid_data); + } + }; + + + + fn._traversing_widgets = function(type, direction, col, row, callback) { + var ga = this.gridmap; + if (!ga[col]) { return; } + + var cr, max; + var action = type + '/' + direction; + if (arguments[2] instanceof jQuery) { + var el_grid_data = arguments[2].coords().grid; + col = el_grid_data.col; + row = el_grid_data.row; + callback = arguments[3]; + } + var matched = []; + var trow = row; + + + var methods = { + 'for_each/above': function() { + while (trow--) { + if (trow > 0 && this.is_widget(col, trow) && + $.inArray(ga[col][trow], matched) === -1 + ) { + cr = callback.call(ga[col][trow], col, trow); + matched.push(ga[col][trow]); + if (cr) { break; } + } + } + }, + 'for_each/below': function() { + for (trow = row + 1, max = ga[col].length; trow < max; trow++) { + if (this.is_widget(col, trow) && + $.inArray(ga[col][trow], matched) === -1 + ) { + cr = callback.call(ga[col][trow], col, trow); + matched.push(ga[col][trow]); + if (cr) { break; } + } + } + } + }; + + if (methods[action]) { + methods[action].call(this); + } + }; + + + /** + * Iterate over each widget above the column and row specified. + * + * @method for_each_widget_above + * @param {Number} col The column to start iterating. + * @param {Number} row The row to start iterating. + * @param {Function} callback The function to execute on each widget + * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.for_each_widget_above = function(col, row, callback) { + this._traversing_widgets('for_each', 'above', col, row, callback); + return this; + }; + + + /** + * Iterate over each widget below the column and row specified. + * + * @method for_each_widget_below + * @param {Number} col The column to start iterating. + * @param {Number} row The row to start iterating. + * @param {Function} callback The function to execute on each widget + * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * @return {Class} Returns the instance of the Gridster Class. + */ + fn.for_each_widget_below = function(col, row, callback) { + this._traversing_widgets('for_each', 'below', col, row, callback); + return this; + }; + + + /** + * Returns the highest occupied cell in the grid. + * + * @method get_highest_occupied_cell + * @return {Object} Returns an object with `col` and `row` numbers. + */ + fn.get_highest_occupied_cell = function() { + var r; + var gm = this.gridmap; + var rows = []; + var row_in_col = []; + for (var c = gm.length - 1; c >= 1; c--) { + for (r = gm[c].length - 1; r >= 1; r--) { + if (this.is_widget(c, r)) { + rows.push(r); + row_in_col[r] = c; + break; + } + } + } + + var highest_row = Math.max.apply(null, rows); + + this.highest_occupied_cell = { + col: row_in_col[highest_row], + row: highest_row + }; + + return this.highest_occupied_cell; + }; + + + /** + * Set the current height of the parent grid. + * + * @method set_dom_grid_height + * @return {Object} Returns the instance of the Gridster class. + */ + fn.set_dom_grid_height = function() { + var r = this.get_highest_occupied_cell().row; + this.$el.css('height', r * this.min_widget_height); + return this; + }; + + + /** + * It generates the neccessary styles to position the widgets. + * + * @method generate_stylesheet + * @param {Number} rows Number of columns. + * @param {Number} cols Number of rows. + * @return {Object} Returns the instance of the Gridster class. + */ + fn.generate_stylesheet = function(rows, cols) { + var styles = ''; + var extra_cells = 10; + var max_size_y = 6; + var max_size_x = 6; + var i; + var rules; + + /* generate CSS styles for cols */ + for (i = cols + extra_cells; i >= 0; i--) { + styles += '[data-col="'+ (i + 1) +'"] { left: ' + + (i * this.min_widget_width) + + 'px;} '; + } + + /* generate CSS styles for rows */ + for (i = rows + extra_cells; i >= 0; i--) { + styles += '[data-row="' + (i + 1) + '"] { top: ' + + (i * this.min_widget_height) + 'px;} '; + } + + + for (var y = 1; y < max_size_y; y++) { + styles += '[data-sizey="' + (y) + '"] { height: ' + + (y * this.options.widget_base_dimensions[1] + (y-1)*(this.options.widget_margins[1]*2)) + 'px;}'; + } + + for (var x = 1; x < max_size_x; x++) { + styles += '[data-sizex="' + (x) + '"] { width: ' + + (x * this.options.widget_base_dimensions[0] + (x-1)*(this.options.widget_margins[0]*2)) + 'px;}'; + } + + return this.add_style_tag(styles); + }; + + + /** + * Injects the given CSS as string to the head of the document. + * + * @method generate_stylesheet + * @param {String} css The styles to apply. + * @return {Object} Returns the instance of the Gridster class. + */ + fn.add_style_tag = function(css){ + var d = document; + var tag = d.createElement('style'); + + d.getElementsByTagName('head')[0].appendChild(tag); + tag.setAttribute('type', 'text/css'); + + if (tag.styleSheet) { + tag.styleSheet.cssText = css; + }else{ + tag.appendChild(document.createTextNode(css)); + } + return this; + }; + + + /** + * Generates a faux grid to collide with it when a widget is dragged and + * detect row or column that we want to go. + * + * @method generate_faux_grid + * @param {Number} rows Number of columns. + * @param {Number} cols Number of rows. + * @return {Object} Returns the instance of the Gridster class. + */ + fn.generate_faux_grid = function(rows, cols) { + this.faux_grid = []; + this.gridmap = []; + var col; + var row; + + for (col = cols; col > 0; col--) { + this.gridmap[col] = []; + for (row = rows; row > 0; row--) { + var coords = $({ + left: this.baseX + ((col - 1) * this.min_widget_width), + top: this.baseY + (row -1) * this.min_widget_height, + width: this.min_widget_width, + height: this.min_widget_height, + col: col, + row: row, + original_col: col, + original_row: row + }).coords(); + + this.gridmap[col][row] = false; + this.faux_grid.push(coords); + } + } + return this; + }; + + /** + * Get all widgets in the DOM and register them. + * + * @method get_widgets_from_DOM + * @return {Object} Returns the instance of the Gridster class. + */ + fn.get_widgets_from_DOM = function() { + this.$widgets.each($.proxy(function(i, widget){ + this.register_widget($(widget)); + }, this)); + return this; + }; + + + /** + * Calculate columns and rows to be set based on the configuration + * parameters, grid dimensions, etc ... + * + * @method generate_grid_and_stylesheet + * @return {Object} Returns the instance of the Gridster class. + */ + fn.generate_grid_and_stylesheet = function() { + var grid_width; + var aw = this.$wrapper.width(); + var ah = this.$wrapper.height(); + + var cols = Math.floor(aw/this.min_widget_width) + + this.options.extra_cols; + var rows = Math.floor(ah/this.min_widget_height) + + this.options.extra_rows; + + var actual_cols = this.$widgets.map(function() { + return $(this).attr('data-col'); + }); + + var actual_rows = this.$widgets.map(function() { + return $(this).attr('data-row'); + }); + + var min_cols = Math.max.apply(null, actual_cols); + var min_rows = Math.max.apply(null, actual_rows); + + cols = Math.max(min_cols, cols, this.options.min_cols); + rows = Math.max(min_rows, rows, this.options.min_rows); + grid_width = cols * (this.options.widget_base_dimensions[0] + + (this.options.widget_margins[0] * 2)); + + //this.support_grid_width = cols * this.min_widget_width; + this.support_grid_width = this.wrapper_width; + + this.support_grid_height = rows * this.min_widget_height; + this.baseX = ($(window).width() - this.support_grid_width) / 2; + this.baseY = this.$wrapper.offset().top; + + //this.baseX = 0; + if(this.options.autogenerate_stylesheet) { + this.generate_stylesheet(rows, cols); + } + + /* more faux rows that needed are created so that there are cells + * where drag beyond the limits */ + return this.generate_faux_grid(rows, cols); + }; + + + //jQuery adapter + $.fn.gridster = function(options) { + return this.each(function() { + if (!$(this).data('gridster')) { + $(this).data('gridster', new Gridster( this, options )); + } + }); + }; + + +}(jQuery, window, document)); diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css new file mode 100644 index 0000000000..c637b474fc --- /dev/null +++ b/dist/jquery.gridster.min.css @@ -0,0 +1,3 @@ +/*! gridster.js - v0.1.0 - 2012-07-18 +* https://github.com/ducksboard/gridster.js +* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute;background:rgba(0,0,0,.23)}.ready .gs_w:not(.player):not(.preview-holder){-webkit-transition:left .3s,top .3s;-moz-transition:left .3s,top .3s;-o-transition:left .3s,top .3s}.gridster.dragging .support-grid{z-index:5}.gridster.dragging .ui-sortable-helper{z-index:10}.gridster .preview-holder{border:2px dashed #333;border-radius:5px;z-index:1;background:#FFF;position:absolute}.gridster .player{z-index:10!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js new file mode 100644 index 0000000000..cca6f9a70d --- /dev/null +++ b/dist/jquery.gridster.min.js @@ -0,0 +1,4 @@ +/*! gridster.js - v0.1.0 - 2012-07-18 +* https://github.com/ducksboard/gridster.js +* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a){var b=this.el;b&&(this.data=b.offset(),this.data.width||(this.data.width=b.width()),this.data.height||(this.data.height=b.height()));var c=this.data;return this.coords.x1=c.left,this.coords.y1=c.top,this.coords.x2=c.left+c.width,this.coords.y2=c.top+c.height,this.coords.cx=c.left+c.width/2,this.coords.cy=c.top+c.height/2,this.coords.width=c.width,this.coords.height=c.height,this.coords.el=b||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend(this.data,b);this.data=c}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body,on_overlap:function(a){},on_overlap_start:function(a){},on_overlap_stop:function(a){}},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2 li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:10,autogenerate_stylesheet:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{on_overlap:function(a){}},draggable:{}},f=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)};c&&!d&&a.apply(e,f),clearTimeout(d),d=setTimeout(g,b)}},g=function(a,b){var c,d,e,g,h,i,j=f(function(){h=g=!1},b,!0);return function(){c=this,d=arguments;var f=function(){e=null,h&&a.apply(c,d),j()};return e||(e=setTimeout(f,b)),g?h=!0:i=a.apply(c,d),j(),g=!0,i}},i=h.prototype;i.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable()},i.add_widget=function(b,c,d){var e=a(b).attr({"data-col":this.highest_occupied_cell.col,"data-row":this.highest_occupied_cell.row+1,"data-sizex":c||1,"data-sizey":d||1}).addClass("gs_w").appendTo(this.$el).hide();this.$widgets=this.$widgets.add(e),this.register_widget(e),this.$widgets.draggable("destroy"),this.draggable(),this.set_dom_grid_height(),e.fadeIn()},i.remove_widget=function(b){var c=b instanceof jQuery?b:a(b),d=c.coords().grid;this.$widgets=this.$widgets.not(c);var e=this.widgets_below(c);this.remove_from_gridmap(d),c.fadeOut(a.proxy(function(){c.remove(),e.each(a.proxy(function(b,c){this.move_widget_up(a(c),d.size_y)},this))},this))},i.serialize=function(b){b||(b=this.$widgets);var c=[];return b.each(a.proxy(function(b,d){c.push(this.options.serialize_params(a(d),a(d).coords().grid))},this)),c},i.serialize_changed=function(){return this.serialize(this.$changed)},i.register_widget=function(a){var b={col:parseInt(a.attr("data-col"),10),row:parseInt(a.attr("data-row"),10),size_x:parseInt(a.attr("data-sizex"),10),size_y:parseInt(a.attr("data-sizey"),10),el:a};return a.data("coords",a.coords()),a.data("coords").grid=b,this.add_to_gridmap(b,a),this.widgets.push(a),this},i.update_widget_position=function(a,b){return this.for_each_cell_occupied(a,function(a,c){if(!this.gridmap[a])return this;this.gridmap[a][c]=b}),this},i.remove_from_gridmap=function(a){return this.update_widget_position(a,!1)},i.add_to_gridmap=function(b,c){this.update_widget_position(b,c||b.el);if(b.el){var d=this.widgets_below(b.el);d.each(a.proxy(function(b,c){this.move_widget_up(a(c))},this))}},i.draggable=function(){var b=this,c=a.extend(!0,{},this.options.draggable,{start:function(c,d){b.$player=a(this),b.on_start_drag.call(b,c,d)},stop:function(a,c){b.on_stop_drag.call(b,c)},drag:g(function(a,c){b.on_drag.call(b,a,c)},100,!0)});return this.$widgets.draggable(c),this},i.on_start_drag=function(b,c){this.$player.addClass("player"),this.$wrapper.addClass("dragging"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=a.extend({},this.player_grid_data),this.$el.css("height",this.$el.height()+this.player_grid_data.size_y*this.min_widget_height);var d=this.faux_grid,e=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.drag_api=this.$player.collision(d,this.options.collision),this.$preview_holder=a("
  • ",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},i.on_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},i.on_stop_drag=function(a,b){this.colliders_data=this.drag_api.get_closest_colliders(),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}).removeClass("player"),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},i.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},i.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},i.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},i.is_placeholder_in_col=function(b,c){return a.inArray(b,this.cells_occupied_by_placeholder.cols)>=0},i.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return a.inArray(b,d.cols)>=0&&a.inArray(c,d.rows)>=0},i.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},i.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},i.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},i.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},i.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},i.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},i.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},i.on_start_overlapping_column=function(a){this.set_player(a,!1)},i.on_start_overlapping_row=function(a){this.set_player(!1,a)},i.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},i.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},i.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},i.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},i.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},i.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},i.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},i.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=this.get_cells_occupied(a),h=!0;return this.for_each_cell_occupied(f,function(a,b){var c=this.is_widget(a,b);c&&!c.is(e)&&(h=!1)}),h},i.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},i.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},i.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},i.generate_stylesheet=function(a,b){var c="",d=10,e=6,f=6,g,h;for(g=b+d;g>=0;g--)c+='[data-col="'+(g+1)+'"] { left: '+g*this.min_widget_width+"px;} ";for(g=a+d;g>=0;g--)c+='[data-row="'+(g+1)+'"] { top: '+g*this.min_widget_height+"px;} ";for(var i=1;i0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},i.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},i.generate_grid_and_stylesheet=function(){var c,d=this.$wrapper.width(),e=this.$wrapper.height(),f=Math.floor(d/this.min_widget_width)+this.options.extra_cols,g=Math.floor(e/this.min_widget_height)+this.options.extra_rows,h=this.$widgets.map(function(){return a(this).attr("data-col")}),i=this.$widgets.map(function(){return a(this).attr("data-row")}),j=Math.max.apply(null,h),k=Math.max.apply(null,i);return f=Math.max(j,f,this.options.min_cols),g=Math.max(k,g,this.options.min_rows),c=f*(this.options.widget_base_dimensions[0]+this.options.widget_margins[0]*2),this.support_grid_width=this.wrapper_width,this.support_grid_height=g*this.min_widget_height,this.baseX=(a(b).width()-this.support_grid_width)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(g,f),this.generate_faux_grid(g,f)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new h(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/api.js b/docs/api.js new file mode 100644 index 0000000000..80392888e1 --- /dev/null +++ b/docs/api.js @@ -0,0 +1,11 @@ +YUI.add("yuidoc-meta", function(Y) { + Y.YUIDoc = { meta: { + "classes": [ + "Collision", + "Coords", + "Gridster" + ], + "modules": [], + "allModules": [] +} }; +}); \ No newline at end of file diff --git a/docs/assets/css/external-small.png b/docs/assets/css/external-small.png new file mode 100644 index 0000000000000000000000000000000000000000..759a1cdcb5b1697e5be290d98b830e279cd71f3c GIT binary patch literal 491 zcmVDs{zR1^XE?tfB*h@ASKHAa7wwn{MEbP z7_^nS7{V*>+A}bS;P%45fB%Ai|Neasi2rl3{=EO;!w318%8Ovl7jArHc=P5Brfr~D z0AYimtss2w$hlYlfd>7*aO3TNzw875LBK0xAD9Np|A(oEVYnB*eE9~V6wP%78SXuL z&#-X)Er#`zY#Ce)^8hM>B_8 literal 0 HcmV?d00001 diff --git a/docs/assets/css/logo.png b/docs/assets/css/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..609b336c7cc5ef0c787a0068d221d9b8d69b1241 GIT binary patch literal 6308 zcmV;V7+dFwP)EI3}K zJAc0RviDlMYT7$`hje!Kj@LB3B$v~Qd;9X^3|$AqFu>69Z0KMbrezvAWa@n&$tpT| zTCH{cyjdVi(gp+w@V^dOksB0A>WW6xhIlO6Tv?HM0X_i}I#y60{PpGwx9vPMtFtRN zzNw#+=Tj2u`-uL(#+a*U!Mhu zc*G(+@nj+A1708rA$uKO;<-VVr3MVYxhNW0pGl{-r;6j7{t5L6rgfY5PJ8CL9kUwu zbudgU8eg2Ex&np2&cRTd`wY)J^i1Ra5;fuU*mdm4tUfgDMK5-q{|m=*>K zmt0VX&YeBdQ=)fa$R^1smi%+SgBQrVaGN@ES(A;8iY#qZRr%H8m*V6T)hnK*O z|1pC?@pvK+BT#UNUrSjdWbFT{Dzm@;L_uBh$8ED$ zuiJfPTW9`aY$8*RdjnUUrlU^R+`03|hDm_i5Luwnq7j z3E6ba0VDwiwDHfNDd`afqMg z;ri!g_m!HW5oK|Cwq!YmyzwIm^+yk_|MHs+Eq9xyRnxCJok*4f#gVLpK`K!hOA`m7 zrXArDhy&z@@Nn!4VdiZ&EK2} z!>Wpb{OnM$1DNA}{p_I4v2VIXKZ_VEfRJY;Iuu1&R+5T8o=vA-I4+<*_iE$hMa%1N z?C8v0J+L~7s%)S@Ol>?uPErsk33`wuLuSY*+7vE48>%1a67ze?luG!wOC|%)EeI?C zwx8(O`zi;pKd^^yj)74>4y=|X<3)=q%hS&sGpIj(bkp1oZ|%Pi=bIBl)oF$l5s2@M zMR71BQ;7WmRiZH{$yVb?Qlg!quu66K@%K)LY$gGSZT&zB6I6^-H+0k^z+_eD?rXV0 z5L1qV!A8eorwW24lZ?>%SS-4rYDo5p4;AW7cfWM)yL&qBv%JW5V0Dtllaoax+#e8V zB$k8}28x_x5pbFwuF@G(hQL=Zo$NO}umKO_6oH2kR4wxSrWK}m#G&)Saemf6U$B$# zrk6{FSmir^W1qZLRh7qwRhQrMfkT~l``>=_UTe?oZtBgd(=tsiMRB8Ch$x^WV>B2V z2&ft>#tNPJ}C{6fYwxz@4|uh6E0@Tu_z>Hq6&SP$9h8q(!7amKNbU6FeVQ}e16NTW!wW&xj$800_2i8@Oqgl}( zBSw)>zyh$kWustb6XGlYV~&}Q<#hu4I2f+-v+5yb_Z=xziTz{6OS|eQ&>jY;WnVK< zC-H4sK93taZ#RBkqo1YXxB%3K83r_hfuO2dE_W1xNt zM0PXiOoA)J`RvVj-Ko>7p*$P6lX{8PUSW6R0a&^20BmcNVdIuIyv<@%guE030oxG( zo?N~Tw)_KN*^1o|jTX^uTeiLne_Xi>wrta2?JLbpT^KQ7kpLFMd+=F!t3ij~|9Kbg z?DqNBz4A8v^@Y9gWXeu*Dj4zq2_$oi{Sn_&7~dqZ!8iyBqiKY1-HN?Zbxp z%=7P#eQfF0WjMl}6i_FHX+zXqpqdRdnk@lERXCvF0o8ev8*_ky@1qUVbX2O_VCif! zOA{`dJI)8?n7Q8GJgo=&{!!u@9x-4gSFN;#Wx7XCFDZ2R-^B-`>$|$O;BgpV=&2U} z-Q8pFvun>G@B2G;?!_leayJd!-|j}>eA>jQmQBmt-)qs>p$50j1G}3J?B0K%?el|% zx@g(fW!SGx;?$}8e$6$vE>IHb7L}!O&LszcA`fWZ1BxUClIbB{7o-bn0SpGFZEjhm zo_0zNl$XUR7}31)&e3Uf$=!|^VBqa9R+|tCDKB!$WE+_&GKBtskbs5t>4?=n8%zm6 zT_c8sC>^X}`MkEYvAJbUOKbb5`h`00w$<0;#+>ZJ^wb$URR>Z?Vx4f)LgW^bpmC?862+ zeD`4UR^}Rb;~wIXya zx}t0;$f`{JW*AUX!*zWr@rlJ{c42`nT#(?%bnnhM{!~QV~&KNRZ#a{m5J7Kckw5%_+cXV&s z_uio&gqq*8PN}*Irw$#QI-SpXVs7&`+!!{wYCH6phTRT*q+&i zpen_P7awo-tl@TG#Be~I=>}f$d>RxuQqc6W0UN7Y z2%dwDv>`;fo++^0j!d_f;1u&G`}QAv`A}Qe6b|ZjS4`VDW<>GTE>JzsE0w4>l1e}n zr!I(zZbhK>-4+{Y0{c)>G4k?Ua8+t@zLb8}-E}t5Y-tgkb=pWH1T>gdk z4zzuPOKI+#f8NrHZ0ttjKdCwypmI?Z66I+ds8IkYGYmy7NCzAsGDz@>fAhQV0prFVph_Hz=*3y7?lo;8z0y7vcglvC70- z79pQygD(HHCAbZLffYNMD?Tjw`NcmQT9LTPg-K=-g{6j;4+zvAxsa#nL8@Z7N7Em( zXZa8rmHIGEFL*lVj8TsNl5Q-Ld#=|Q#%%}FJ zRJOwbmnK0dM8uU9fv;gBKDQ*^|7Tj zL+oDe0X2g_b=U0bP*OpBp$v$tn}nHN=Wk{`39L?;S_PHmNk3|Jf+JC}T;mBUMj+;^ zq2Z|=fQjqGT-O64g{DA-{49H`&X0T@Ul@Sx`{m&6L&O&-z=4Q`*WH`LId=}bO8wbX zDlv6Oc zF|f-^0Gr;}1G;fCsH$-9l*<-Fz$V5m`SIaEc4OfiB(Ie4sfB*2uYJSgA}MUn0uJF5E5f`SZN`Q@Aca6eYyMD{kC2-IMJ zD$zJZyTd+E%wI!*LgKd5E$g^gQgQu3i20i%lzrX4Azr%{ZY=-)GG_Pp?wJT@gfTbI92Oa;8JDdj#9Gc;WI2NX9I$xmh(wh8>uPK67)(Jw6zcMYm(2a*x1N5aqpkZI8))7Ks`Ef& zC1s$fMgGoQ!M;GmOP411_he#vy^FI=u>Eig_!n*YV9A#*|J*cq@(-I~*MT@a=ihg> z!}cAxg^dQg$77RbNqC#AdI}XMvNjfrz^&i;3_Sju*I~!*JY8SEy#?yG?ZuxMQJ^^W zrSW(KzVd~WVA6y%KCBsDHgwv+4R|c?dVEV^Im3dGW10NIg5`h(VtG~$t<2nr1EKmO zx=GHZHVZDfcHGGHJk!uRIG|ddQLPT?$`PR|^^5d+fpVb1r8Fl@EO&1ASzi0oo@-go zpbN{3q@7_HP(3sY-@Nh+xbVypNW|Qe<46bxP~MEE@nb6B*6YuPx{-1SQv3hm!^+{N z>rRKyoSlKvlBjbm)dA_uPPF@jo6doA&LU&j4Idt!5^=JhDUxM=JM$U*>oJ}6berXk zA8Jg-V_%$9H)8JL0PQzWBGZC9KKrXxFKv6}!AGC_c1ugo)gsVDX*np7B0nb;Ml<+D z1vb(({RodytZjN-^W=PTYuJpRMa)e|qS|OQ3g?|Q5$2qQ;J_gZE3E^%dUSe>qNoIQ zqtZ|_G>*@e!ySg0L)p)>EZ+o@kBMXgzIf?raPj9%IM8aqtFJYY@Qi-FvLXTF#$@m^ zj(@*Kuf>HUIlt}X>Eqz(KWxKkRvbnSE3w@Nt5oN=dlrc`$Bsq98#*G2{Mf|0kw-M@ z;jjjC|JS1D&V1tOHTQINbHOc-B&*w6MTiu`molOp4j)*Q{iGik72{Q6bry!7Iq=Fd89#@Nf_ zMao|#?58}SLgmQ4Ps$b-OrglYsfhqUZ?FFTsznFe`>qTh&7g-A9D>CL+Z1DeI;kQMSlA}X2`)^_Q>|!@#k7am zF$>th3Ouvk+S*AT?r_d!Ispk2j4>k%+4F!CpxH1aH(=$W@nBGA@go`N`TRRS^tVe= zVhj$J+ZnXK6*pY;Nz!2VR4E-ivgI_5N(FkF)X8|G&RN_)V4 z^8;SC9PEJBHiKUA@M>%sOoNFuc_40YuzXX%6a!2re+-FUo#?{itQUI++@fKWgrp{% za{YYL_>p&i5RY9P5!9DAHBZqrV*+2Ww}R=5DXNn#;@bh!n9&(Vp>AI0r#8qjscvIi zZq7Hzw8yf02CRO5Grn5;WgpY0)X-qZZFN6|KwjX($e)3WJd5BxpydTYY~YI6z{mS- zy+bVDweuVGUc&3TN%pbtIi&fOe4g(2(6d5JH*?bg`^pZNrCl)NzP zqd?lzy!RkHvSbY$?2u?(m{ydWi1Xhsp9wRkW$hFT|3LIL$0hB+3% zlAJISiP2|l=xwp1s6vIAV;uN&MpR{4CR4J!Zp`rG?p;d9!FTw&p&s> z6`4$o1K1x}=DlUX*WZX`JA{s+ycjgcc-a|IlvVLWY}H98j(Z4>k}&_nY<%rV8byJt0*nyoo@3wI~{SwW6$a{pgX^&%sA5cF)n9#9&GxwgR z{Zs0xV^FE`UP%o^P=X8QK;aQ!TAjwSMDZdq=Skc3kWr9qOVj$|TMUy@2RjU7Gg zIrtb)=y-bFI+?cA|6}%{w$5tu%FgzVo|%5E5)Kw8`kl#Syxx^LPA%$(R%SQBCwTgQ a0R{k+kX}`<%LV)Z0000
  • ';var F=g[1]&&g[1].length?g[1]-1:0;n.push('
    1. ");s=function(){var D=v[++F%10];return j?""+D+'':D}}else s=h; +for(;;)if(m");j=null}n.push(o[m+1]);m+=2}else if(t");g&&n.push("
    ");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja, +"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=", +"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=//g,X=/\"/g,ea=/</g,fa=/>/g,ga=/'/g,ha=/"/g,ja=/&/g,ia=/ /g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+| +

    + + +
    + API Docs for: +
    + +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    Collision Class

    +
    + +
    + Uses + +
    + + + + + +
    + Defined in: src/jquery.collision.js:22 +
    + + + + + +
    + + + +
    +

    Collision

    +
    + + +
    +

    Constructor

    +
    +

    Collision

    + + +
    + (
      + +
    • + + element + +
    • + +
    • + + colliders + +
    • + +
    • + + [options] + +
    • + +
    ) +
    + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.collision.js:22 + +

    + + + + + +
    + +
    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + element + HTMLElement + + + + +
      +

      An Attribute name or object property path

      +
      + + +
    • + +
    • + + colliders + String | HTMLElement | Array + + + + +
      +

      An Attribute name or object property path

      +
      + + +
    • + +
    • + + [options] + Object + optional + + + + +
      +

      An Attribute name or object property path

      +
      + + +
        + +
      • + + [on_overlap] + Function + optional + + +
        +

        An Attribute name or object property path

        +
        + + +
      • + +
      • + + [on_overlap_start] + Function + optional + + +
        +

        An Attribute name or object property path

        +
        + + +
      • + +
      • + + [on_overlap_stop] + Function + optional + + +
        +

        An Attribute name or object property path

        +
        + + +
      • + +
      + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Object: + + dasdasdadasd + +
    +
    + + + +
    + +
    + + +
    + + +
    +
    +

    Item Index

    + + + + + + + + +
    + + + + + + + + +
    +
    + +
    +
    +
    +
    +
    + + + + + + + + + + + diff --git a/docs/classes/Coords.html b/docs/classes/Coords.html new file mode 100644 index 0000000000..e315cfc5ff --- /dev/null +++ b/docs/classes/Coords.html @@ -0,0 +1,253 @@ + + + + + Coords + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    Coords Class

    +
    + + + + + +
    + Defined in: src/jquery.coords.js:10 +
    + + + + + +
    + + + +
    +

    Coords description

    +
    + + +
    +

    Constructor

    +
    +

    Coords

    + + +
    + (
      + +
    • + + obj + +
    • + +
    ) +
    + + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.coords.js:10 + +

    + + + + + +
    + +
    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + obj + HTMLElement | Object + + + + +
      +

      HTMLElement or a literal Object with the left, top, width and height properties.

      +
      + + +
    • + +
    +
    + + + + + +
    + +
    + + +
    + + +
    +
    +

    Item Index

    + + + + + + + + +
    + + + + + + + + +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/classes/Gridster.html b/docs/classes/Gridster.html new file mode 100644 index 0000000000..78212e2f17 --- /dev/null +++ b/docs/classes/Gridster.html @@ -0,0 +1,7646 @@ + + + + + Gridster + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    Gridster Class

    +
    + +
    + Uses + +
    + + + + + +
    + Defined in: src/jquery.gridster.js:73 +
    + + + + + +
    + + + +
    + +
    + + +
    +

    Constructor

    +
    +

    Gridster

    + + +
    + (
      + +
    • + + el + +
    • + +
    • + + [options] + +
    • + +
    ) +
    + + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:73 + +

    + + + + + +
    + +
    + +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el + HTMLElement + + + + +
      +

      The HTMLelement that contains all the widgets.

      +
      + + +
    • + +
    • + + [options] + Object + optional + + + + +
      +

      An Object with all options you want to + overwrite:

      +
      + + +
        + +
      • + + [widget_selector] + HTMLElement | String + optional + + +
        +

        Define who will be the + draggable widgets. Can be a CSS Selector String or a collection of + HTMLElements

        +
        + + +
      • + +
      • + + [widget_margins] + Array + optional + + +
        +

        Margin between widgets. The first + index for the horizontal margin (left, right) and the second + for the vertical margin (top, bottom).

        +
        + + +
      • + +
      • + + [widget_base_dimensions] + Array + optional + + +
        +

        Base widget dimensions in + pixels. The first index for the width and the second for the + height.

        +
        + + +
      • + +
      • + + [extra_cols] + Number + optional + + +
        +

        Add more columns in addition to + those that have been calculated.

        +
        + + +
      • + +
      • + + [extra_rows] + Number + optional + + +
        +

        Add more rows in addition to + those that have been calculated.

        +
        + + +
      • + +
      • + + [min_cols] + Number + optional + + +
        +

        The minimum required columns.

        +
        + + +
      • + +
      • + + [min_rows] + Number + optional + + +
        +

        The minimum required rows.

        +
        + + +
      • + +
      • + + [autogenerate_stylesheet] + Boolean + optional + + +
        +

        If true, all the + CSS required to position all widgets in their respective columns + and rows will be generated automatically and injected to the + <head> of the document. You can set this to false, and write + your own CSS targeting rows and cols via data-attributes like so: + [data-col="1"] { left: 10px; }

        +
        + + +
      • + +
      • + + [serialize_params] + Function + optional + + +
        +

        Return the data you want + for each widget in the serialization. Two arguments are passed: + $w: the jQuery wrapped HTMLElement, and wgd: the grid + coords object (col, row, size_x, size_y).

        +
        + + +
      • + +
      • + + [collision] + Object + optional + + +
        +

        An Object with all options for + Collision class you want to overwrite. See Collision docs for + more info.

        +
        + + +
      • + +
      • + + [draggable] + Object + optional + + +
        +

        An Object with all options for + jQuery UI Draggable you want to overwrite. See + http://jqueryui.com/demos/draggable/ for more info.

        +
        + + +
      • + +
      + +
    • + +
    +
    + + + + + +
    + +
    + + +
    + + +
    +
    +

    Item Index

    + + +
    +

    Methods

    + + +
    + + + + + + + +
    + + +
    +

    Methods

    + + +
    +

    add_to_gridmap

    + + +
    + (
      + +
    • + + grid_data + +
    • + +
    • + + value + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:292 + +

    + + + + + +
    + +
    +

    Add a widget to the mapped array of positions.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + grid_data + Object + + + + +
      +

      The grid coords object representing the cells + to update in the mapped array.

      +
      + + +
    • + +
    • + + value + HTMLElement | Boolean + + + + +
      +

      The value to set in the specified + position .

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    add_widget

    + + +
    + (
      + +
    • + + html + +
    • + +
    • + + size_x + +
    • + +
    • + + size_y + +
    • + +
    ) +
    + + + + + HTMLElement + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:140 + +

    + + + + + +
    + +
    +

    Add a new widget to the grid.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + html + String + + + + +
      +

      The string representing the HTML of the widget.

      +
      + + +
    • + +
    • + + size_x + Number + + + + +
      +

      The nº of rows the widget occupies horizontally.

      +
      + + +
    • + +
    • + + size_y + Number + + + + +
      +

      The nº of columns the widget occupies vertically.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElement: + + Returns the jQuery wrapped HTMLElement representing + the widget that was just created. + +
    +
    + + + +
    + + +
    +

    can_go_player_up

    + + +
    + (
      + +
    • + + widget_grid_data + +
    • + +
    ) +
    + + + + + Number | Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:922 + +

    + + + + + +
    + +
    +

    Determines whether the player can move to a position above.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widget_grid_data + Object + + + + +
      +

      The actual grid coords object of the + player.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Number | Boolean: + + If the player can be moved to an upper row + returns the row number, else returns false. + +
    +
    + + + +
    + + +
    +

    can_go_up_to_row

    + + +
    + (
      + +
    • + + widget_grid_data + +
    • + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean | Number + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1328 + +

    + + + + + +
    + +
    +

    Check if the widget can move to the specified row, else returns the +upper row possible.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widget_grid_data + Number + + + + +
      +

      The current grid coords object of the + widget.

      +
      + + +
    • + +
    • + + col + Number + + + + +
      +

      The target column.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The target row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean | Number: + + Returns the row number if the widget can move + to the target position, else returns false. + +
    +
    + + + +
    + + +
    +

    can_go_widget_up

    + + +
    + (
      + +
    • + + widget_grid_data + +
    • + +
    ) +
    + + + + + Number | Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:970 + +

    + + + + + +
    + +
    +

    Determines whether a widget can move to a position above.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widget_grid_data + Object + + + + +
      +

      The actual grid coords object of the + widget we want to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Number | Boolean: + + If the widget can be moved to an upper row + returns the row number, else returns false. + +
    +
    + + + +
    + + +
    +

    can_move_to

    + + +
    + (
      + +
    • + + widget_grid_data + +
    • + +
    • + + The + +
    • + +
    • + + The + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1500 + +

    + + + + + +
    + +
    +

    Check if it's possible to move a widget to a specific col/row. It takes +into account the dimensions (size_y and size_x attrs. of the grid coords + object) the widget occupies.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widget_grid_data + Object + + + + +
      +

      The grid coords object that represents + the widget.

      +
      + + +
    • + +
    • + + The + Object + + + + +
      +

      col target col.

      +
      + + +
    • + +
    • + + The + Object + + + + +
      +

      row target row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true if all cells are empty, else return false. + +
    +
    + + + +
    + + +
    +

    draggable

    + + + () + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:314 + +

    + + + + + +
    + +
    +

    Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    empty_cells_player_occupies

    + + + () + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1463 + +

    + + + + + +
    + +
    +

    Remove from the array of mapped positions the reference to the player.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    for_each_column_occupied

    + + +
    + (
      + +
    • + + el_grid_data + +
    • + +
    • + + callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1598 + +

    + + + + + +
    + +
    +

    Iterate over the cells occupied by a widget executing a function for +each one.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el_grid_data + Object + + + + +
      +

      The grid coords object that represents the + widget.

      +
      + + +
    • + +
    • + + callback + Function + + + + +
      +

      The function to execute on each column + iteration. Column and row are passed as arguments.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    for_each_column_occupied

    + + +
    + (
      + +
    • + + el_grid_data + +
    • + +
    • + + callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1619 + +

    + + + + + +
    + +
    +

    Iterate over the columns occupied by a widget executing a function for +each one.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el_grid_data + Object + + + + +
      +

      The grid coords object that represents + the widget.

      +
      + + +
    • + +
    • + + callback + Function + + + + +
      +

      The function to execute on each column + iteration. The column number is passed as first argument.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    for_each_row_occupied

    + + +
    + (
      + +
    • + + el_grid_data + +
    • + +
    • + + callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1638 + +

    + + + + + +
    + +
    +

    Iterate over the rows occupied by a widget executing a function for +each one.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el_grid_data + Object + + + + +
      +

      The grid coords object that represents + the widget.

      +
      + + +
    • + +
    • + + callback + Function + + + + +
      +

      The function to execute on each column iteration. The row number is passed as first argument.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    for_each_widget_above

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    • + + callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1704 + +

    + + + + + +
    + +
    +

    Iterate over each widget above the column and row specified.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to start iterating.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to start iterating.

      +
      + + +
    • + +
    • + + callback + Function + + + + +
      +

      The function to execute on each widget +iteration. The value of this inside the function is the jQuery wrapped HTMLElement.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    for_each_widget_below

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    • + + callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1720 + +

    + + + + + +
    + +
    +

    Iterate over each widget below the column and row specified.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to start iterating.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to start iterating.

      +
      + + +
    • + +
    • + + callback + Function + + + + +
      +

      The function to execute on each widget +iteration. The value of this inside the function is the jQuery wrapped HTMLElement.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    generate_faux_grid

    + + +
    + (
      + +
    • + + rows + +
    • + +
    • + + cols + +
    • + +
    ) +
    + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1848 + +

    + + + + + +
    + +
    +

    Generates a faux grid to collide with it when a widget is dragged and +detect row or column that we want to go.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + rows + Number + + + + +
      +

      Number of columns.

      +
      + + +
    • + +
    • + + cols + Number + + + + +
      +

      Number of rows.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    generate_grid_and_stylesheet

    + + + () + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1898 + +

    + + + + + +
    + +
    +

    Calculate columns and rows to be set based on the configuration + parameters, grid dimensions, etc ...

    +
    + + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    generate_stylesheet

    + + +
    + (
      + +
    • + + rows + +
    • + +
    • + + cols + +
    • + +
    ) +
    + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1781 + +

    + + + + + +
    + +
    +

    It generates the neccessary styles to position the widgets.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + rows + Number + + + + +
      +

      Number of columns.

      +
      + + +
    • + +
    • + + cols + Number + + + + +
      +

      Number of rows.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    generate_stylesheet

    + + +
    + (
      + +
    • + + css + +
    • + +
    ) +
    + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1825 + +

    + + + + + +
    + +
    +

    Injects the given CSS as string to the head of the document.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + css + String + + + + +
      +

      The styles to apply.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    get_cells_occupied

    + + +
    + (
      + +
    • + + el_grid_data + +
    • + +
    ) +
    + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1570 + +

    + + + + + +
    + +
    +

    Get all columns and rows that a widget occupies.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el_grid_data + Object + + + + +
      +

      The grid coords object of the widget.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns an object like { cols: [], rows: []}. + +
    +
    + + + +
    + + +
    +

    get_highest_occupied_cell

    + + + () + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1736 + +

    + + + + + +
    + +
    +

    Returns the highest occupied cell in the grid.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns an object with col and row numbers. + +
    +
    + + + +
    + + +
    +

    get_targeted_columns

    + + +
    + (
      + +
    • + + [from_col] + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1535 + +

    + + + + + +
    + +
    +

    Given the leftmost column returns all columns that are overlapping with the player.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + [from_col] + Number + optional + + + + +
      +

      The leftmost column.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns an array with column numbers. + +
    +
    + + + +
    + + +
    +

    get_targeted_rows

    + + +
    + (
      + +
    • + + [from_row] + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1553 + +

    + + + + + +
    + +
    +

    Given the upper row returns all rows that are overlapping with the player.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + [from_row] + Number + optional + + + + +
      +

      The upper row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns an array with row numbers. + +
    +
    + + + +
    + + +
    +

    get_valid_rows

    + + +
    + (
      + +
    • + + widget_grid_data + +
    • + +
    • + + upper_rows + +
    • + +
    • + + min_row + +
    • + +
    ) +
    + + + + + Number | Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1021 + +

    + + + + + +
    + +
    +

    Search a valid row for the widget represented by widget_grid_data' in +theupperrowsarray. Iteration starts from row specified inminrow`.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widget_grid_data + Object + + + + +
      +

      The actual grid coords object of the + player.

      +
      + + +
    • + +
    • + + upper_rows + Array + + + + +
      +

      An array with columns as index and arrays + of valid rows as values.

      +
      + + +
    • + +
    • + + min_row + Number + + + + +
      +

      The upper row from which the iteration will start.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Number | Boolean: + + Returns the upper row valid from the upper_rows + for the widget in question. + +
    +
    + + + +
    + + +
    +

    get_widgets_from_DOM

    + + + () + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1884 + +

    + + + + + +
    + +
    +

    Get all widgets in the DOM and register them.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    get_widgets_overlapped

    + + + () + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1099 + +

    + + + + + +
    + +
    +

    Get widgets overlapping with the player.

    +
    + + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + Returns a jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    get_widgets_under_player

    + + + () + + + + + HTMLElement + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:859 + +

    + + + + + +
    + +
    +

    Get widgets overlapping with the player.

    +
    + + + + +
    +

    Returns:

    + +
    + + + HTMLElement: + + Returns a jQuery collection of HTMLElements + +
    +
    + + + +
    + + +
    +

    is_empty

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:778 + +

    + + + + + +
    + +
    +

    Determines if the cell represented by col and row params is empty.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_occupied

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:797 + +

    + + + + + +
    + +
    +

    Determines if the cell represented by col and row params is occupied.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_placeholder_in

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:745 + +

    + + + + + +
    + +
    +

    Determines if the placeholder is currently over the row and col given.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_placeholder_in

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:764 + +

    + + + + + +
    + +
    +

    Determines if the placeholder is currently over the row and col given.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_player

    + + +
    + (
      + +
    • + + col_or_el + +
    • + +
    • + + [row] + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:713 + +

    + + + + + +
    + +
    +

    Determines if there is a widget in the row and col given. Or if the +HTMLElement passed as first argument is the player.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col_or_el + Number | HTMLElement + + + + +
      +

      A jQuery wrapped collection of +HTMLElements.

      +
      + + +
    • + +
    • + + [row] + Number + optional + + + + +
      +

      The column to which we want to move the widgets.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_player_in

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:730 + +

    + + + + + +
    + +
    +

    Determines if the widget that is being dragged is currently over the row +and col given.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    is_widget

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean | HTMLElement + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:817 + +

    + + + + + +
    + +
    +

    Determines if there is a widget in the cell represented by col/row params.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean | HTMLElement: + + Returns false if there is no widget, +else returns the jQuery HTMLElement + +
    +
    + + + +
    + + +
    +

    is_widget_under_player

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Boolean + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:842 + +

    + + + + + +
    + +
    +

    Determines if there is a widget in the cell represented by col/row +params and if this is under the widget that is being dragged.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to check.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to check.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Boolean: + + Returns true or false. + +
    +
    + + + +
    + + +
    +

    manage_movements

    + + +
    + (
      + +
    • + + $widgets + +
    • + +
    • + + to_col + +
    • + +
    • + + to_row + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:668 + +

    + + + + + +
    + +
    +

    Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $widgets + HTMLElements + + + + +
      +

      A jQuery collection of HTMLElements + representing the widgets you want to move.

      +
      + + +
    • + +
    • + + to_col + Number + + + + +
      +

      The column to which we want to move the widgets.

      +
      + + +
    • + +
    • + + to_row + Number + + + + +
      +

      The row to which we want to move the widgets.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    move_widget_down

    + + +
    + (
      + +
    • + + $widget + +
    • + +
    • + + The + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1283 + +

    + + + + + +
    + +
    +

    Move down the specified widget and all below it.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $widget + HTMLElement + + + + +
      +

      The jQuery object representing the widget you want to move.

      +
      + + +
    • + +
    • + + The + Number + + + + +
      +

      number of cells that the widget has to move.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    move_widget_to

    + + +
    + (
      + +
    • + + $widget + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1194 + +

    + + + + + +
    + +
    +

    Move a widget to a specific row. The cell or cells must be empty. +If the widget has widgets below, all of these widgets will be moved also +if they can.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $widget + HTMLElement + + + + +
      +

      The jQuery wrapped HTMLElement of the widget is going to be moved.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    move_widget_up

    + + +
    + (
      + +
    • + + $widget + +
    • + +
    • + + [y_units] + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1237 + +

    + + + + + +
    + +
    +

    Move up the specified widget and all below it.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $widget + HTMLElement + + + + +
      +

      The widget you want to move.

      +
      + + +
    • + +
    • + + [y_units] + Number + optional + + + + +
      +

      The number of cells that the widget has to move.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    on_drag

    + + +
    + (
      + +
    • + + The + +
    • + +
    • + + A + +
    • + +
    ) +
    + + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:389 + +

    + + + + + +
    + +
    +

    This function is executed when the player is being dragged.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + The + Event + + + + +
      +

      original browser event

      +
      + + +
    • + +
    • + + A + Object + + + + +
      +

      prepared ui object. + See http://jqueryui.com/demos/draggable/ for more info.

      +
      + + +
    • + +
    +
    + + + + + +
    + + +
    +

    on_overlapped_column_change

    + + +
    + (
      + +
    • + + start_callback + +
    • + +
    • + + stop_callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:466 + +

    + + + + + +
    + +
    +

    Executes the callbacks passed as arguments when a column begins to be +overlapped or stops being overlapped.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + start_callback + Function + + + + +
      +

      Function executed when a new column + begins to be overlapped. The column is passed as first argument.

      +
      + + +
    • + +
    • + + stop_callback + Function + + + + +
      +

      Function executed when a column stops + being overlapped. The column is passed as first argument.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    on_overlapped_row_change

    + + +
    + (
      + +
    • + + start_callback + +
    • + +
    • + + stop_callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:506 + +

    + + + + + +
    + +
    +

    Executes the callbacks passed as arguments when a row starts to be +overlapped or stops being overlapped.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + start_callback + Function + + + + +
      +

      Function executed when a new row begins + to be overlapped. The row is passed as first argument.

      +
      + + +
    • + +
    • + + stop_callback + Function + + + + +
      +

      Function executed when a row stops being + overlapped. The row is passed as first argument.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    on_start_drag

    + + +
    + (
      + +
    • + + The + +
    • + +
    • + + A + +
    • + +
    ) +
    + + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:342 + +

    + + + + + +
    + +
    +

    This function is executed when the player begins to be dragged.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + The + Event + + + + +
      +

      original browser event

      +
      + + +
    • + +
    • + + A + Object + + + + +
      +

      prepared ui object. + See http://jqueryui.com/demos/draggable/ for more info.

      +
      + + +
    • + +
    +
    + + + + + +
    + + +
    +

    on_start_overlapping_column

    + + +
    + (
      + +
    • + + col + +
    • + +
    ) +
    + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1132 + +

    + + + + + +
    + +
    +

    This callback is executed when the player begins to collide with a column.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The collided column.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + Returns a jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    on_start_overlapping_row

    + + +
    + (
      + +
    • + + col + +
    • + +
    ) +
    + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1144 + +

    + + + + + +
    + +
    +

    A callback executed when the player begins to collide with a row.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The collided row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + Returns a jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    on_stop_drag

    + + +
    + (
      + +
    • + + The + +
    • + +
    • + + A + +
    • + +
    ) +
    + + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:415 + +

    + + + + + +
    + +
    +

    This function is executed when the player stops being dragged.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + The + Event + + + + +
      +

      original browser event

      +
      + + +
    • + +
    • + + A + Object + + + + +
      +

      prepared ui object. + See http://jqueryui.com/demos/draggable/ for more info.

      +
      + + +
    • + +
    +
    + + + + + +
    + + +
    +

    on_stop_overlapping_column

    + + +
    + (
      + +
    • + + col + +
    • + +
    ) +
    + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1156 + +

    + + + + + +
    + +
    +

    A callback executed when the the player ends to collide with a column.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The collided row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + Returns a jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    on_stop_overlapping_row

    + + +
    + (
      + +
    • + + row + +
    • + +
    ) +
    + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1174 + +

    + + + + + +
    + +
    +

    This callback is executed when the player ends to collide with a row.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + row + Number + + + + +
      +

      The collided row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + Returns a jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    remove_from_gridmap

    + + +
    + (
      + +
    • + + grid_data + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:279 + +

    + + + + + +
    + +
    +

    Remove a widget from the mapped array of positions.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + grid_data + Object + + + + +
      +

      The grid coords object representing the cells + to update in the mapped array.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    remove_widget

    + + +
    + (
      + +
    • + + el + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:171 + +

    + + + + + +
    + +
    +

    Remove a widget from the grid.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + el + HTMLElement + + + + +
      +

      The jQuery wrapped HTMLElement you want to remove.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    serialize

    + + +
    + (
      + +
    • + + [$widgets] + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:197 + +

    + + + + + +
    + +
    +

    Returns a serialized array of the widgets in the grid.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + [$widgets] + HTMLElement + optional + + + + +
      +

      The collection of jQuery wrapped + HTMLElements you want to serialize. If no argument is passed all widgets + will be serialized.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns an Array of Objects with the data specified in + the serialize_params option. + +
    +
    + + + +
    + + +
    +

    serialize_changed

    + + + () + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:231 + +

    + + + + + +
    + +
    +

    Creates the grid coords object representing the widget a add it to the mapped array of positions

    +
    + + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    serialize_changed

    + + + () + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:219 + +

    + + + + + +
    + +
    +

    Returns a serialized array of the widgets that have changed their position.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns an Array of Objects with the data specified in + the serialize_params option. + +
    +
    + + + +
    + + +
    +

    set_cells_player_occupies

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + col + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1446 + +

    + + + + + +
    + +
    +

    Update the array of mapped positions with the new player position.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The new player col.

      +
      + + +
    • + +
    • + + col + Number + + + + +
      +

      The new player row.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    set_dom_grid_height

    + + + () + + + + + Object + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1768 + +

    + + + + + +
    + +
    +

    Set the current height of the parent grid.

    +
    + + + + +
    +

    Returns:

    + +
    + + + Object: + + Returns the instance of the Gridster class. + +
    +
    + + + +
    + + +
    +

    set_placeholder

    + + +
    + (
      + +
    • + + col + +
    • + +
    • + + row + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:881 + +

    + + + + + +
    + +
    +

    Put placeholder at the row and column specified.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + col + Number + + + + +
      +

      The column to which we want to move the + placeholder.

      +
      + + +
    • + +
    • + + row + Number + + + + +
      +

      The row to which we want to move the + placeholder.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    set_player

    + + +
    + (
      + +
    • + + start_callback + +
    • + +
    • + + stop_callback + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:542 + +

    + + + + + +
    + +
    +

    Sets the current position of the player

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + start_callback + Function + + + + +
      +

      Function executed when a new row begins + to be overlapped. The row is passed as first argument.

      +
      + + +
    • + +
    • + + stop_callback + Function + + + + +
      +

      Function executed when a row stops being + overlapped. The row is passed as first argument.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    sort_by_row_asc

    + + +
    + (
      + +
    • + + widgets + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:631 + +

    + + + + + +
    + +
    +

    Sorts an Array of grid coords objects (representing the grid coords of each widget) in ascending way.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widgets + Array + + + + +
      +

      Array of grid coords objects

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns the array sorted. + +
    +
    + + + +
    + + +
    +

    sort_by_row_desc

    + + +
    + (
      + +
    • + + widgets + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:650 + +

    + + + + + +
    + +
    +

    Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + widgets + Array + + + + +
      +

      Array of grid coords objects

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns the array sorted. + +
    +
    + + + +
    + + +
    +

    update_widget_position

    + + +
    + (
      + +
    • + + grid_data + +
    • + +
    • + + value + +
    • + +
    ) +
    + + + + + Class + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:258 + +

    + + + + + +
    + +
    +

    Update in the mapped array of positions the value of cells represented by +the grid coords object passed in the grid_data param.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + grid_data + Object + + + + +
      +

      The grid coords object representing the cells + to update in the mapped array.

      +
      + + +
    • + +
    • + + value + HTMLElement | Boolean + + + + +
      +

      Pass false or the jQuery wrapped + HTMLElement, depends if you want to delete an existing position or add + a new one.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Class: + + Returns the instance of the Gridster Class. + +
    +
    + + + +
    + + +
    +

    widgets_below

    + + +
    + (
      + +
    • + + $el + +
    • + +
    ) +
    + + + + + HTMLElements + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:1417 + +

    + + + + + +
    + +
    +

    Get widgets below a widget.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $el + HTMLElement + + + + +
      +

      The jQuery wrapped HTMLElement.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + HTMLElements: + + A jQuery collection of HTMLElements. + +
    +
    + + + +
    + + +
    +

    widgets_contraints

    + + +
    + (
      + +
    • + + $widgets + +
    • + +
    ) +
    + + + + + Array + + + + + + + + + + + + + + + +
    + + + +

    + + Defined in + + + + + src/jquery.gridster.js:595 + +

    + + + + + +
    + +
    +

    See which of the widgets in the $widgets param collection can go to +a upper row and which not.

    +
    + + +
    +

    Parameters:

    + +
      + +
    • + + $widgets + HTMLElements + + + + +
      +

      A jQuery wrapped collection of +HTMLElements.

      +
      + + +
    • + +
    +
    + + + +
    +

    Returns:

    + +
    + + + Array: + + Returns a literal Object with two keys: can_go_up & +can_not_go_up. Each contains a set of HTMLElements. + +
    +
    + + + +
    + + +
    + + + + + + + +
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/classes/index.html b/docs/classes/index.html new file mode 100644 index 0000000000..487fe15b2a --- /dev/null +++ b/docs/classes/index.html @@ -0,0 +1,10 @@ + + + + Redirector + + + + Click here to redirect + + diff --git a/docs/data.json b/docs/data.json new file mode 100644 index 0000000000..6bcd647a76 --- /dev/null +++ b/docs/data.json @@ -0,0 +1,1475 @@ +{ + "project": {}, + "files": { + "src/jquery.collision.js": { + "name": "src/jquery.collision.js", + "modules": {}, + "classes": { + "Collision": 1 + }, + "fors": {}, + "namespaces": {} + }, + "src/jquery.coords.js": { + "name": "src/jquery.coords.js", + "modules": {}, + "classes": { + "Coords": 1 + }, + "fors": {}, + "namespaces": {} + }, + "src/jquery.gridster.js": { + "name": "src/jquery.gridster.js", + "modules": {}, + "classes": { + "Gridster": 1 + }, + "fors": {}, + "namespaces": {} + } + }, + "modules": {}, + "classes": { + "Collision": { + "name": "Collision", + "shortname": "Collision", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [ + "Gridster" + ], + "file": "src/jquery.collision.js", + "line": 22, + "description": "Collision", + "uses": [ + "Coords" + ], + "params": [ + { + "name": "element", + "description": "An Attribute name or object property path", + "type": "HTMLElement" + }, + { + "name": "colliders", + "description": "An Attribute name or object property path", + "type": "String|HTMLElement|Array" + }, + { + "name": "options", + "description": "An Attribute name or object property path", + "type": "Object", + "optional": true, + "props": [ + { + "name": "on_overlap", + "description": "An Attribute name or object property path", + "type": "Function", + "optional": true + }, + { + "name": "on_overlap_start", + "description": "An Attribute name or object property path", + "type": "Function", + "optional": true + }, + { + "name": "on_overlap_stop", + "description": "An Attribute name or object property path", + "type": "Function", + "optional": true + } + ] + } + ], + "return": { + "description": "dasdasdadasd", + "type": "Object" + }, + "is_constructor": 1 + }, + "Coords": { + "name": "Coords", + "shortname": "Coords", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [ + "Collision", + "Gridster" + ], + "file": "src/jquery.coords.js", + "line": 10, + "description": "Coords description", + "params": [ + { + "name": "obj", + "description": "HTMLElement or a literal Object with the left, top, width and height properties.", + "type": "HTMLElement|Object" + } + ], + "is_constructor": 1 + }, + "Gridster": { + "name": "Gridster", + "shortname": "Gridster", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "file": "src/jquery.gridster.js", + "line": 73, + "uses": [ + "Coords", + "Collision" + ], + "params": [ + { + "name": "el", + "description": "The HTMLelement that contains all the widgets.", + "type": "HTMLElement" + }, + { + "name": "options", + "description": "An Object with all options you want to\n overwrite:", + "type": "Object", + "optional": true, + "props": [ + { + "name": "widget_selector", + "description": "Define who will be the\n draggable widgets. Can be a CSS Selector String or a collection of\n HTMLElements", + "type": "HTMLElement|String", + "optional": true + }, + { + "name": "widget_margins", + "description": "Margin between widgets. The first\n index for the horizontal margin (left, right) and the second\n for the vertical margin (top, bottom).", + "type": "Array", + "optional": true + }, + { + "name": "widget_base_dimensions", + "description": "Base widget dimensions in\n pixels. The first index for the width and the second for the\n height.", + "type": "Array", + "optional": true + }, + { + "name": "extra_cols", + "description": "Add more columns in addition to\n those that have been calculated.", + "type": "Number", + "optional": true + }, + { + "name": "extra_rows", + "description": "Add more rows in addition to\n those that have been calculated.", + "type": "Number", + "optional": true + }, + { + "name": "min_cols", + "description": "The minimum required columns.", + "type": "Number", + "optional": true + }, + { + "name": "min_rows", + "description": "The minimum required rows.", + "type": "Number", + "optional": true + }, + { + "name": "autogenerate_stylesheet", + "description": "If true, all the\n CSS required to position all widgets in their respective columns\n and rows will be generated automatically and injected to the\n `` of the document. You can set this to false, and write\n your own CSS targeting rows and cols via data-attributes like so:\n `[data-col=\"1\"] { left: 10px; }`", + "type": "Boolean", + "optional": true + }, + { + "name": "serialize_params", + "description": "Return the data you want\n for each widget in the serialization. Two arguments are passed:\n `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid\n coords object (`col`, `row`, `size_x`, `size_y`).", + "type": "Function", + "optional": true + }, + { + "name": "collision", + "description": "An Object with all options for\n Collision class you want to overwrite. See Collision docs for\n more info.", + "type": "Object", + "optional": true + }, + { + "name": "draggable", + "description": "An Object with all options for\n jQuery UI Draggable you want to overwrite. See\n http://jqueryui.com/demos/draggable/ for more info.", + "type": "Object", + "optional": true + } + ] + } + ], + "is_constructor": 1 + } + }, + "classitems": [ + { + "file": "src/jquery.gridster.js", + "line": 140, + "description": "Add a new widget to the grid.", + "itemtype": "method", + "name": "add_widget", + "params": [ + { + "name": "html", + "description": "The string representing the HTML of the widget.", + "type": "String" + }, + { + "name": "size_x", + "description": "The nº of rows the widget occupies horizontally.", + "type": "Number" + }, + { + "name": "size_y", + "description": "The nº of columns the widget occupies vertically.", + "type": "Number" + } + ], + "return": { + "description": "Returns the jQuery wrapped HTMLElement representing\n the widget that was just created.", + "type": "HTMLElement" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 171, + "description": "Remove a widget from the grid.", + "itemtype": "method", + "name": "remove_widget", + "params": [ + { + "name": "el", + "description": "The jQuery wrapped HTMLElement you want to remove.", + "type": "HTMLElement" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 197, + "description": "Returns a serialized array of the widgets in the grid.", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "$widgets", + "description": "The collection of jQuery wrapped\n HTMLElements you want to serialize. If no argument is passed all widgets\n will be serialized.", + "type": "HTMLElement", + "optional": true + } + ], + "return": { + "description": "Returns an Array of Objects with the data specified in\n the serialize_params option.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 219, + "description": "Returns a serialized array of the widgets that have changed their position.", + "itemtype": "method", + "name": "serialize_changed", + "return": { + "description": "Returns an Array of Objects with the data specified in\n the serialize_params option.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 231, + "description": "Creates the grid coords object representing the widget a add it to the mapped array of positions", + "itemtype": "method", + "name": "serialize_changed", + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 258, + "description": "Update in the mapped array of positions the value of cells represented by\nthe grid coords object passed in the `grid_data` param.", + "params": [ + { + "name": "grid_data", + "description": "The grid coords object representing the cells\n to update in the mapped array.", + "type": "Object" + }, + { + "name": "value", + "description": "Pass `false` or the jQuery wrapped\n HTMLElement, depends if you want to delete an existing position or add\n a new one.", + "type": "HTMLElement|Boolean" + } + ], + "itemtype": "method", + "name": "update_widget_position", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 279, + "description": "Remove a widget from the mapped array of positions.", + "itemtype": "method", + "name": "remove_from_gridmap", + "params": [ + { + "name": "grid_data", + "description": "The grid coords object representing the cells\n to update in the mapped array.", + "type": "Object" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 292, + "description": "Add a widget to the mapped array of positions.", + "itemtype": "method", + "name": "add_to_gridmap", + "params": [ + { + "name": "grid_data", + "description": "The grid coords object representing the cells\n to update in the mapped array.", + "type": "Object" + }, + { + "name": "value", + "description": "The value to set in the specified\n position .", + "type": "HTMLElement|Boolean" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 314, + "description": "Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.", + "itemtype": "method", + "name": "draggable", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 342, + "description": "This function is executed when the player begins to be dragged.", + "itemtype": "method", + "name": "on_start_drag", + "params": [ + { + "name": "The", + "description": "original browser event", + "type": "Event" + }, + { + "name": "A", + "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "type": "Object" + } + ], + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 389, + "description": "This function is executed when the player is being dragged.", + "itemtype": "method", + "name": "on_drag", + "params": [ + { + "name": "The", + "description": "original browser event", + "type": "Event" + }, + { + "name": "A", + "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "type": "Object" + } + ], + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 415, + "description": "This function is executed when the player stops being dragged.", + "itemtype": "method", + "name": "on_stop_drag", + "params": [ + { + "name": "The", + "description": "original browser event", + "type": "Event" + }, + { + "name": "A", + "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "type": "Object" + } + ], + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 466, + "description": "Executes the callbacks passed as arguments when a column begins to be\noverlapped or stops being overlapped.", + "params": [ + { + "name": "start_callback", + "description": "Function executed when a new column\n begins to be overlapped. The column is passed as first argument.", + "type": "Function" + }, + { + "name": "stop_callback", + "description": "Function executed when a column stops\n being overlapped. The column is passed as first argument.", + "type": "Function" + } + ], + "itemtype": "method", + "name": "on_overlapped_column_change", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 506, + "description": "Executes the callbacks passed as arguments when a row starts to be\noverlapped or stops being overlapped.", + "params": [ + { + "name": "start_callback", + "description": "Function executed when a new row begins\n to be overlapped. The row is passed as first argument.", + "type": "Function" + }, + { + "name": "stop_callback", + "description": "Function executed when a row stops being\n overlapped. The row is passed as first argument.", + "type": "Function" + } + ], + "itemtype": "method", + "name": "on_overlapped_row_change", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 542, + "description": "Sets the current position of the player", + "params": [ + { + "name": "start_callback", + "description": "Function executed when a new row begins\n to be overlapped. The row is passed as first argument.", + "type": "Function" + }, + { + "name": "stop_callback", + "description": "Function executed when a row stops being\n overlapped. The row is passed as first argument.", + "type": "Function" + } + ], + "itemtype": "method", + "name": "set_player", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 595, + "description": "See which of the widgets in the $widgets param collection can go to\na upper row and which not.", + "itemtype": "method", + "name": "widgets_contraints", + "params": [ + { + "name": "$widgets", + "description": "A jQuery wrapped collection of\nHTMLElements.", + "type": "HTMLElements" + } + ], + "return": { + "description": "Returns a literal Object with two keys: `can_go_up` &\n`can_not_go_up`. Each contains a set of HTMLElements.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 631, + "description": "Sorts an Array of grid coords objects (representing the grid coords of each widget) in ascending way.", + "itemtype": "method", + "name": "sort_by_row_asc", + "params": [ + { + "name": "widgets", + "description": "Array of grid coords objects", + "type": "Array" + } + ], + "return": { + "description": "Returns the array sorted.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 650, + "description": "Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.", + "itemtype": "method", + "name": "sort_by_row_desc", + "params": [ + { + "name": "widgets", + "description": "Array of grid coords objects", + "type": "Array" + } + ], + "return": { + "description": "Returns the array sorted.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 668, + "description": "Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.", + "itemtype": "method", + "name": "manage_movements", + "params": [ + { + "name": "$widgets", + "description": "A jQuery collection of HTMLElements\n representing the widgets you want to move.", + "type": "HTMLElements" + }, + { + "name": "to_col", + "description": "The column to which we want to move the widgets.", + "type": "Number" + }, + { + "name": "to_row", + "description": "The row to which we want to move the widgets.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 713, + "description": "Determines if there is a widget in the row and col given. Or if the\nHTMLElement passed as first argument is the player.", + "itemtype": "method", + "name": "is_player", + "params": [ + { + "name": "col_or_el", + "description": "A jQuery wrapped collection of\nHTMLElements.", + "type": "Number|HTMLElement" + }, + { + "name": "row", + "description": "The column to which we want to move the widgets.", + "type": "Number", + "optional": true + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 730, + "description": "Determines if the widget that is being dragged is currently over the row\nand col given.", + "itemtype": "method", + "name": "is_player_in", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 745, + "description": "Determines if the placeholder is currently over the row and col given.", + "itemtype": "method", + "name": "is_placeholder_in", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 764, + "description": "Determines if the placeholder is currently over the row and col given.", + "itemtype": "method", + "name": "is_placeholder_in", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 778, + "description": "Determines if the cell represented by col and row params is empty.", + "itemtype": "method", + "name": "is_empty", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 797, + "description": "Determines if the cell represented by col and row params is occupied.", + "itemtype": "method", + "name": "is_occupied", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 817, + "description": "Determines if there is a widget in the cell represented by col/row params.", + "itemtype": "method", + "name": "is_widget", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns false if there is no widget,\nelse returns the jQuery HTMLElement", + "type": "Boolean|HTMLElement" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 842, + "description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.", + "itemtype": "method", + "name": "is_widget_under_player", + "params": [ + { + "name": "col", + "description": "The column to check.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to check.", + "type": "Number" + } + ], + "return": { + "description": "Returns true or false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 859, + "description": "Get widgets overlapping with the player.", + "itemtype": "method", + "name": "get_widgets_under_player", + "return": { + "description": "Returns a jQuery collection of HTMLElements", + "type": "HTMLElement" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 881, + "description": "Put placeholder at the row and column specified.", + "itemtype": "method", + "name": "set_placeholder", + "params": [ + { + "name": "col", + "description": "The column to which we want to move the\n placeholder.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to which we want to move the\n placeholder.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 922, + "description": "Determines whether the player can move to a position above.", + "itemtype": "method", + "name": "can_go_player_up", + "params": [ + { + "name": "widget_grid_data", + "description": "The actual grid coords object of the\n player.", + "type": "Object" + } + ], + "return": { + "description": "If the player can be moved to an upper row\n returns the row number, else returns false.", + "type": "Number|Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 970, + "description": "Determines whether a widget can move to a position above.", + "itemtype": "method", + "name": "can_go_widget_up", + "params": [ + { + "name": "widget_grid_data", + "description": "The actual grid coords object of the\n widget we want to check.", + "type": "Object" + } + ], + "return": { + "description": "If the widget can be moved to an upper row\n returns the row number, else returns false.", + "type": "Number|Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1021, + "description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.", + "itemtype": "method", + "name": "get_valid_rows", + "params": [ + { + "name": "widget_grid_data", + "description": "The actual grid coords object of the\n player.", + "type": "Object" + }, + { + "name": "upper_rows", + "description": "An array with columns as index and arrays\n of valid rows as values.", + "type": "Array" + }, + { + "name": "min_row", + "description": "The upper row from which the iteration will start.", + "type": "Number" + } + ], + "return": { + "description": "Returns the upper row valid from the `upper_rows`\n for the widget in question.", + "type": "Number|Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1099, + "description": "Get widgets overlapping with the player.", + "itemtype": "method", + "name": "get_widgets_overlapped", + "return": { + "description": "Returns a jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1132, + "description": "This callback is executed when the player begins to collide with a column.", + "itemtype": "method", + "name": "on_start_overlapping_column", + "params": [ + { + "name": "col", + "description": "The collided column.", + "type": "Number" + } + ], + "return": { + "description": "Returns a jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1144, + "description": "A callback executed when the player begins to collide with a row.", + "itemtype": "method", + "name": "on_start_overlapping_row", + "params": [ + { + "name": "col", + "description": "The collided row.", + "type": "Number" + } + ], + "return": { + "description": "Returns a jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1156, + "description": "A callback executed when the the player ends to collide with a column.", + "itemtype": "method", + "name": "on_stop_overlapping_column", + "params": [ + { + "name": "col", + "description": "The collided row.", + "type": "Number" + } + ], + "return": { + "description": "Returns a jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1174, + "description": "This callback is executed when the player ends to collide with a row.", + "itemtype": "method", + "name": "on_stop_overlapping_row", + "params": [ + { + "name": "row", + "description": "The collided row.", + "type": "Number" + } + ], + "return": { + "description": "Returns a jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1194, + "description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.", + "itemtype": "method", + "name": "move_widget_to", + "params": [ + { + "name": "$widget", + "description": "The jQuery wrapped HTMLElement of the widget is going to be moved.", + "type": "HTMLElement" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1237, + "description": "Move up the specified widget and all below it.", + "itemtype": "method", + "name": "move_widget_up", + "params": [ + { + "name": "$widget", + "description": "The widget you want to move.", + "type": "HTMLElement" + }, + { + "name": "y_units", + "description": "The number of cells that the widget has to move.", + "type": "Number", + "optional": true + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1283, + "description": "Move down the specified widget and all below it.", + "itemtype": "method", + "name": "move_widget_down", + "params": [ + { + "name": "$widget", + "description": "The jQuery object representing the widget you want to move.", + "type": "HTMLElement" + }, + { + "name": "The", + "description": "number of cells that the widget has to move.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1328, + "description": "Check if the widget can move to the specified row, else returns the\nupper row possible.", + "itemtype": "method", + "name": "can_go_up_to_row", + "params": [ + { + "name": "widget_grid_data", + "description": "The current grid coords object of the\n widget.", + "type": "Number" + }, + { + "name": "col", + "description": "The target column.", + "type": "Number" + }, + { + "name": "row", + "description": "The target row.", + "type": "Number" + } + ], + "return": { + "description": "Returns the row number if the widget can move\n to the target position, else returns false.", + "type": "Boolean|Number" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1417, + "description": "Get widgets below a widget.", + "itemtype": "method", + "name": "widgets_below", + "params": [ + { + "name": "$el", + "description": "The jQuery wrapped HTMLElement.", + "type": "HTMLElement" + } + ], + "return": { + "description": "A jQuery collection of HTMLElements.", + "type": "HTMLElements" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1446, + "description": "Update the array of mapped positions with the new player position.", + "itemtype": "method", + "name": "set_cells_player_occupies", + "params": [ + { + "name": "col", + "description": "The new player col.", + "type": "Number" + }, + { + "name": "col", + "description": "The new player row.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1463, + "description": "Remove from the array of mapped positions the reference to the player.", + "itemtype": "method", + "name": "empty_cells_player_occupies", + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1500, + "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid coords\n object) the widget occupies.", + "itemtype": "method", + "name": "can_move_to", + "params": [ + { + "name": "widget_grid_data", + "description": "The grid coords object that represents\n the widget.", + "type": "Object" + }, + { + "name": "The", + "description": "col target col.", + "type": "Object" + }, + { + "name": "The", + "description": "row target row.", + "type": "Object" + } + ], + "return": { + "description": "Returns true if all cells are empty, else return false.", + "type": "Boolean" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1535, + "description": "Given the leftmost column returns all columns that are overlapping with the player.", + "itemtype": "method", + "name": "get_targeted_columns", + "params": [ + { + "name": "from_col", + "description": "The leftmost column.", + "type": "Number", + "optional": true + } + ], + "return": { + "description": "Returns an array with column numbers.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1553, + "description": "Given the upper row returns all rows that are overlapping with the player.", + "itemtype": "method", + "name": "get_targeted_rows", + "params": [ + { + "name": "from_row", + "description": "The upper row.", + "type": "Number", + "optional": true + } + ], + "return": { + "description": "Returns an array with row numbers.", + "type": "Array" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1570, + "description": "Get all columns and rows that a widget occupies.", + "itemtype": "method", + "name": "get_cells_occupied", + "params": [ + { + "name": "el_grid_data", + "description": "The grid coords object of the widget.", + "type": "Object" + } + ], + "return": { + "description": "Returns an object like `{ cols: [], rows: []}`.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1598, + "description": "Iterate over the cells occupied by a widget executing a function for\neach one.", + "itemtype": "method", + "name": "for_each_column_occupied", + "params": [ + { + "name": "el_grid_data", + "description": "The grid coords object that represents the\n widget.", + "type": "Object" + }, + { + "name": "callback", + "description": "The function to execute on each column\n iteration. Column and row are passed as arguments.", + "type": "Function" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1619, + "description": "Iterate over the columns occupied by a widget executing a function for\neach one.", + "itemtype": "method", + "name": "for_each_column_occupied", + "params": [ + { + "name": "el_grid_data", + "description": "The grid coords object that represents\n the widget.", + "type": "Object" + }, + { + "name": "callback", + "description": "The function to execute on each column\n iteration. The column number is passed as first argument.", + "type": "Function" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1638, + "description": "Iterate over the rows occupied by a widget executing a function for\neach one.", + "itemtype": "method", + "name": "for_each_row_occupied", + "params": [ + { + "name": "el_grid_data", + "description": "The grid coords object that represents\n the widget.", + "type": "Object" + }, + { + "name": "callback", + "description": "The function to execute on each column iteration. The row number is passed as first argument.", + "type": "Function" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1704, + "description": "Iterate over each widget above the column and row specified.", + "itemtype": "method", + "name": "for_each_widget_above", + "params": [ + { + "name": "col", + "description": "The column to start iterating.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to start iterating.", + "type": "Number" + }, + { + "name": "callback", + "description": "The function to execute on each widget\niteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.", + "type": "Function" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1720, + "description": "Iterate over each widget below the column and row specified.", + "itemtype": "method", + "name": "for_each_widget_below", + "params": [ + { + "name": "col", + "description": "The column to start iterating.", + "type": "Number" + }, + { + "name": "row", + "description": "The row to start iterating.", + "type": "Number" + }, + { + "name": "callback", + "description": "The function to execute on each widget\niteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.", + "type": "Function" + } + ], + "return": { + "description": "Returns the instance of the Gridster Class.", + "type": "Class" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1736, + "description": "Returns the highest occupied cell in the grid.", + "itemtype": "method", + "name": "get_highest_occupied_cell", + "return": { + "description": "Returns an object with `col` and `row` numbers.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1768, + "description": "Set the current height of the parent grid.", + "itemtype": "method", + "name": "set_dom_grid_height", + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1781, + "description": "It generates the neccessary styles to position the widgets.", + "itemtype": "method", + "name": "generate_stylesheet", + "params": [ + { + "name": "rows", + "description": "Number of columns.", + "type": "Number" + }, + { + "name": "cols", + "description": "Number of rows.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1825, + "description": "Injects the given CSS as string to the head of the document.", + "itemtype": "method", + "name": "generate_stylesheet", + "params": [ + { + "name": "css", + "description": "The styles to apply.", + "type": "String" + } + ], + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1848, + "description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.", + "itemtype": "method", + "name": "generate_faux_grid", + "params": [ + { + "name": "rows", + "description": "Number of columns.", + "type": "Number" + }, + { + "name": "cols", + "description": "Number of rows.", + "type": "Number" + } + ], + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1884, + "description": "Get all widgets in the DOM and register them.", + "itemtype": "method", + "name": "get_widgets_from_DOM", + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + }, + { + "file": "src/jquery.gridster.js", + "line": 1898, + "description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...", + "itemtype": "method", + "name": "generate_grid_and_stylesheet", + "return": { + "description": "Returns the instance of the Gridster class.", + "type": "Object" + }, + "class": "Gridster" + } + ] +} \ No newline at end of file diff --git a/docs/files/index.html b/docs/files/index.html new file mode 100644 index 0000000000..487fe15b2a --- /dev/null +++ b/docs/files/index.html @@ -0,0 +1,10 @@ + + + + Redirector + + + + Click here to redirect + + diff --git a/docs/files/src_jquery.collision.js.html b/docs/files/src_jquery.collision.js.html new file mode 100644 index 0000000000..18bf3441af --- /dev/null +++ b/docs/files/src_jquery.collision.js.html @@ -0,0 +1,320 @@ + + + + + src/jquery.collision.js + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    File: src/jquery.collision.js

    + +
    +
    +/*
    + * jquery.collision
    + * https://github.com/ducksboard/gridster.js
    + *
    + * Copyright (c) 2012 ducksboard
    + * Licensed under the MIT, GPL licenses.
    + */
    +
    +;(function($, window, document, undefined){
    +
    +    var defaults = {
    +      colliders_context: document.body,
    +      on_overlap: function(collider_data){},
    +      on_overlap_start : function(collider_data){
    +          // console.log('the element START being a collider', collider_data);
    +      },
    +      on_overlap_stop : function(collider_data){
    +          // console.log('the element STOP being a collider', collider_data);
    +      }
    +    };
    +
    +    /**
    +    * Collision
    +    *
    +    * @class Collision
    +    * @uses Coords
    +    * @param {HTMLElement} element An Attribute name or object property path
    +    * @param {String|HTMLElement|Array} colliders An Attribute name or object property path
    +    * @param {Object} [options] An Attribute name or object property path
    +    *   @param {Function} [options.on_overlap] An Attribute name or object property path
    +    *   @param {Function} [options.on_overlap_start] An Attribute name or object property path
    +    *   @param {Function} [options.on_overlap_stop] An Attribute name or object property path
    +    * @return {Object} dasdasdadasd
    +    * @constructor
    +    */
    +    function Collision(element, colliders, options) {
    +      this.options = $.extend(defaults, options);
    +      this.$element = element;
    +      this.last_colliders = [];
    +      this.last_colliders_coords = [];
    +      if (typeof colliders === 'string' || colliders instanceof jQuery) {
    +          this.$colliders = $(colliders,
    +               this.options.colliders_context).not(this.$element);
    +      }else{
    +          this.colliders = $(colliders);
    +      }
    +
    +      this.init();
    +    }
    +
    +    var fn = Collision.prototype;
    +
    +    fn.init = function() {
    +      this.find_collisions();
    +    };
    +
    +    fn.overlaps = function(a, b) {
    +      var x = false;
    +      var y = false;
    +
    +      if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
    +          (b.x2 >= a.x1 && b.x2 <= a.x2) ||
    +          (a.x1 >= b.x1 && a.x2 <= b.x2)
    +      ) { x = true; }
    +
    +      if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
    +          (b.y2 >= a.y1 && b.y2 <= a.y2) ||
    +          (a.y1 >= b.y1 && a.y2 <= b.y2)
    +      ) { y = true; }
    +
    +      return (x && y);
    +    };
    +
    +    fn.detect_overlapping_region = function(a, b){
    +      var regionX = '';
    +      var regionY = '';
    +
    +      if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
    +      if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
    +      if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
    +      if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
    +
    +      return (regionX + regionY) || 'C';
    +    };
    +
    +    fn.calculate_overlapped_area_coords = function(a, b){
    +      var x1 = Math.max(a.x1, b.x1);
    +      var y1 = Math.max(a.y1, b.y1);
    +      var x2 = Math.min(a.x2, b.x2);
    +      var y2 = Math.min(a.y2, b.y2);
    +
    +      return $({
    +          left: x1,
    +          top: y1,
    +          width : (x2 - x1),
    +          height: (y2 - y1)
    +        }).coords().get();
    +    };
    +
    +    fn.calculate_overlapped_area = function(coords){
    +      return (coords.width * coords.height);
    +    };
    +
    +    fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
    +      var last = this.last_colliders_coords;
    +
    +      for (var i = 0, il = last.length; i < il; i++) {
    +          if ($.inArray(last[i], new_colliders_coords) === -1) {
    +              start_callback.call(this, last[i]);
    +          }
    +      }
    +
    +      for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
    +          if ($.inArray(new_colliders_coords[j], last) === -1) {
    +              stop_callback.call(this, new_colliders_coords[j]);
    +          }
    +
    +      }
    +    };
    +
    +    fn.find_collisions = function(){
    +      var self = this;
    +      var colliders_coords = [];
    +      var colliders_data = [];
    +      var $colliders = (this.colliders || this.$colliders);
    +      var count = $colliders.length;
    +
    +      while(count--){
    +        var $collider = self.$colliders ? $($colliders[count]) : $colliders[count];
    +        var player_coords = self.$element.coords().update().get();
    +        var $collider_coords_ins = ($collider.isCoords) ?
    +                $collider.update() : $collider.coords();
    +        var collider_coords = $collider_coords_ins.get();
    +        var overlaps = self.overlaps(player_coords, collider_coords);
    +
    +        if (!overlaps) {
    +          continue;
    +        }
    +
    +        var region = self.detect_overlapping_region(player_coords,
    +             collider_coords);
    +        //todo: make this if customizable
    +        if (region === 'C'){
    +            var area_coords = self.calculate_overlapped_area_coords(
    +                 player_coords, collider_coords);
    +            var area = self.calculate_overlapped_area(area_coords);
    +            var collider_data = {
    +                area: area,
    +                area_coords : area_coords,
    +                region: region,
    +                coords: collider_coords,
    +                player_coords: player_coords,
    +                el: $collider
    +            };
    +
    +            self.options.on_overlap.call(this, collider_data);
    +            colliders_coords.push($collider_coords_ins);
    +            colliders_data.push(collider_data);
    +        }
    +
    +      }
    +
    +      this.manage_colliders_start_stop(colliders_coords,
    +          self.options.on_overlap_stop, self.options.on_overlap_start);
    +
    +      this.last_colliders_coords = colliders_coords;
    +
    +      return colliders_data;
    +    };
    +
    +
    +    fn.get_closest_colliders = function(){
    +      var colliders = this.find_collisions();
    +      var min_area = 100;
    +      colliders.sort(function(a, b){
    +
    +          if (a.area <= min_area) {
    +            return 1;
    +          }
    +
    +          /* if colliders are being overlapped by the "C" (center) region,
    +           * we have to set a lower index in the array to which they are placed
    +           * above in the grid. */
    +          if (a.region === 'C' && b.region === 'C') {
    +            if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
    +                return - 1;
    +            }else{
    +                return 1;
    +            }
    +          }
    +
    +          if (a.area < b.area){
    +             return 1;
    +          }
    +
    +          return 1;
    +      });
    +      return colliders;
    +    };
    +
    +    //jQuery adapter
    +    $.fn.collision = function(collider, options) {
    +      return new Collision( this, collider, options );
    +    };
    +
    +
    +}(jQuery, window, document));
    +
    +    
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/files/src_jquery.coords.js.html b/docs/files/src_jquery.coords.js.html new file mode 100644 index 0000000000..c393a1c25c --- /dev/null +++ b/docs/files/src_jquery.coords.js.html @@ -0,0 +1,201 @@ + + + + + src/jquery.coords.js + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    File: src/jquery.coords.js

    + +
    +
    +/*
    + * jquery.coords
    + * https://github.com/ducksboard/gridster.js
    + *
    + * Copyright (c) 2012 ducksboard
    + * Licensed under the MIT, GPL licenses.
    + */
    +
    +;(function($, window, document, undefined){
    +    /**
    +    * Coords description
    +    *
    +    * @class Coords
    +    * @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties.
    +    * @constructor
    +    */
    +    function Coords(obj) {
    +        if (obj[0] && $.isPlainObject(obj[0])) {
    +            this.data = obj[0];
    +        }else {
    +            this.el = obj;
    +        }
    +
    +        this.isCoords = true;
    +        this.coords = {};
    +        this.init();
    +        return this;
    +    }
    +
    +    var fn = Coords.prototype;
    +
    +    fn.init = function(){
    +        this.set();
    +        this.original_coords = this.get();
    +    };
    +
    +    fn.set = function(update) {
    +        var el = this.el;
    +        if (el) {
    +            this.data = el.offset();
    +            this.data.width || (this.data.width = el.width());
    +            this.data.height || (this.data.height = el.height());
    +        }
    +
    +        var d = this.data;
    +
    +        this.coords.x1 = d.left;
    +        this.coords.y1 = d.top;
    +        this.coords.x2 = d.left + d.width;
    +        this.coords.y2 = d.top + d.height;
    +        this.coords.cx = d.left + (d.width / 2);
    +        this.coords.cy = d.top + (d.height / 2);
    +        this.coords.width  = d.width;
    +        this.coords.height = d.height;
    +        this.coords.el  = el || false ;
    +
    +        return this;
    +    };
    +
    +    fn.update = function(data){
    +        if (!data && !this.el) {
    +            return this;
    +        }
    +
    +        if (data) {
    +            var new_data = $.extend(this.data, data);
    +            this.data = new_data;
    +        }
    +        this.set(true);
    +        return this;
    +    };
    +
    +    fn.get = function(){
    +        return this.coords;
    +    };
    +
    +    //jQuery adapter
    +    $.fn.coords = function() {
    +        if (this.data('coords') ) {
    +            return this.data('coords');
    +        }
    +
    +        var ins = new Coords(this, arguments[0]);
    +        this.data('coords', ins);
    +        return ins;
    +    };
    +
    +}(jQuery, window, document));
    +
    +    
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html new file mode 100644 index 0000000000..14814b862c --- /dev/null +++ b/docs/files/src_jquery.gridster.js.html @@ -0,0 +1,2072 @@ + + + + + src/jquery.gridster.js + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +

    File: src/jquery.gridster.js

    + +
    +
    +/*
    + * jquery.gridster
    + * https://github.com/ducksboard/gridster.js
    + *
    + * Copyright (c) 2012 ducksboard
    + * Licensed under the MIT, GPL licenses.
    + */
    +;(function($, window, document, undefined) {
    +
    +    var defaults = {
    +        widget_selector: '> li',
    +        widget_margins: [10, 10],
    +        widget_base_dimensions: [400, 225],
    +        extra_rows: 0,
    +        extra_cols: 0,
    +        min_cols: 1,
    +        min_rows: 10,
    +        autogenerate_stylesheet: true,
    +        serialize_params: function($w, wgd) {
    +            return {
    +                col: wgd.col,
    +                row: wgd.row
    +            };
    +        },
    +        collision: {
    +            on_overlap: function(coords) {}
    +        },
    +        draggable: {
    +
    +        }
    +    };
    +
    +
    +    /* Debounce and throttle functions taken from underscore.js */
    +    var debounce = function(func, wait, immediate) {
    +        var timeout;
    +        return function() {
    +          var context = this, args = arguments;
    +          var later = function() {
    +            timeout = null;
    +            if (!immediate) func.apply(context, args);
    +          };
    +          if (immediate && !timeout) func.apply(context, args);
    +          clearTimeout(timeout);
    +          timeout = setTimeout(later, wait);
    +        };
    +    };
    +
    +
    +    var throttle = function(func, wait) {
    +        var context, args, timeout, throttling, more, result;
    +        var whenDone = debounce(function(){ more = throttling = false; }, wait, true);
    +        return function() {
    +          context = this; args = arguments;
    +          var later = function() {
    +            timeout = null;
    +            if (more) func.apply(context, args);
    +            whenDone();
    +          };
    +          if (!timeout) timeout = setTimeout(later, wait);
    +          if (throttling) {
    +            more = true;
    +          } else {
    +            result = func.apply(context, args);
    +          }
    +          whenDone();
    +          throttling = true;
    +          return result;
    +        };
    +    };
    +
    +
    +    /**
    +    * @class Gridster
    +    * @uses Coords
    +    * @uses Collision
    +    * @param {HTMLElement} el The HTMLelement that contains all the widgets.
    +    * @param {Object} [options] An Object with all options you want to
    +    *        overwrite:
    +    *    @param {HTMLElement|String} [options.widget_selector] Define who will be the
    +    *     draggable widgets. Can be a CSS Selector String or a collection of
    +    *     HTMLElements
    +    *    @param {Array} [options.widget_margins] Margin between widgets. The first
    +    *     index for the horizontal margin (left, right) and the second
    +    *     for the vertical margin (top, bottom).
    +    *    @param {Array} [options.widget_base_dimensions] Base widget dimensions in
    +    *     pixels. The first index for the width and the second for the
    +    *     height.
    +    *    @param {Number} [options.extra_cols] Add more columns in addition to
    +    *     those that have been calculated.
    +    *    @param {Number} [options.extra_rows] Add more rows in addition to
    +    *     those that have been calculated.
    +    *    @param {Number} [options.min_cols] The minimum required columns.
    +    *    @param {Number} [options.min_rows] The minimum required rows.
    +    *    @param {Boolean} [options.autogenerate_stylesheet] If true, all the
    +    *     CSS required to position all widgets in their respective columns
    +    *     and rows will be generated automatically and injected to the
    +    *     `<head>` of the document. You can set this to false, and write
    +    *     your own CSS targeting rows and cols via data-attributes like so:
    +    *     `[data-col="1"] { left: 10px; }`
    +    *    @param {Function} [options.serialize_params] Return the data you want
    +    *     for each widget in the serialization. Two arguments are passed:
    +    *     `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
    +    *     coords object (`col`, `row`, `size_x`, `size_y`).
    +    *    @param {Object} [options.collision] An Object with all options for
    +    *     Collision class you want to overwrite. See Collision docs for
    +    *     more info.
    +    *    @param {Object} [options.draggable] An Object with all options for
    +    *     jQuery UI Draggable you want to overwrite. See
    +    *     http://jqueryui.com/demos/draggable/ for more info.
    +    *
    +    * @constructor
    +    */
    +    function Gridster(el, options) {
    +      this.options = $.extend(true, defaults, options);
    +      this.$el = $(el);
    +      this.$wrapper = this.$el.parent();
    +      this.$widgets = this.$el.find(this.options.widget_selector).addClass('gs_w');
    +      this.widgets = [];
    +      this.$changed = $([]);
    +      this.wrapper_width = this.$wrapper.width();
    +      this.min_widget_width = (this.options.widget_margins[0] * 2) +
    +        this.options.widget_base_dimensions[0];
    +      this.min_widget_height = (this.options.widget_margins[1] * 2) +
    +        this.options.widget_base_dimensions[1];
    +      this.init();
    +    }
    +
    +    var fn = Gridster.prototype;
    +
    +    fn.init = function() {
    +      this.generate_grid_and_stylesheet();
    +      this.get_widgets_from_DOM();
    +      this.set_dom_grid_height();
    +      this.$wrapper.addClass('ready');
    +      this.draggable();
    +    };
    +
    +
    +    /**
    +    * Add a new widget to the grid.
    +    *
    +    * @method add_widget
    +    * @param {String} html The string representing the HTML of the widget.
    +    * @param {Number} size_x The nº of rows the widget occupies horizontally.
    +    * @param {Number} size_y The nº of columns the widget occupies vertically.
    +    * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing
    +    *  the widget that was just created.
    +    */
    +    fn.add_widget = function(html, size_x, size_y) {
    +        var $w = $(html).attr({
    +                'data-col': this.highest_occupied_cell.col,
    +                'data-row': this.highest_occupied_cell.row + 1,
    +                'data-sizex' : size_x || 1,
    +                'data-sizey' : size_y || 1
    +            }).addClass('gs_w').appendTo(this.$el).hide();
    +
    +        this.$widgets = this.$widgets.add($w);
    +
    +        this.register_widget($w);
    +
    +        this.$widgets.draggable('destroy');
    +        this.draggable();
    +
    +        this.set_dom_grid_height();
    +
    +        $w.fadeIn();
    +    };
    +
    +
    +    /**
    +    * Remove a widget from the grid.
    +    *
    +    * @method remove_widget
    +    * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.remove_widget = function(el) {
    +        var $el = el instanceof jQuery ? el : $(el);
    +        var wgd = $el.coords().grid;
    +
    +        this.$widgets = this.$widgets.not($el);
    +
    +        var $nexts = this.widgets_below($el);
    +
    +        this.remove_from_gridmap(wgd);
    +
    +        $el.fadeOut($.proxy(function(){
    +            $el.remove();
    +            $nexts.each($.proxy(function(i, widget){
    +                this.move_widget_up( $(widget), wgd.size_y );
    +            }, this));
    +        }, this));
    +    };
    +
    +
    +    /**
    +    * Returns a serialized array of the widgets in the grid.
    +    *
    +    * @method serialize
    +    * @param {HTMLElement} [$widgets] The collection of jQuery wrapped
    +    *  HTMLElements you want to serialize. If no argument is passed all widgets
    +    *  will be serialized.
    +    * @return {Array} Returns an Array of Objects with the data specified in
    +    *  the serialize_params option.
    +    */
    +    fn.serialize = function($widgets) {
    +        $widgets || ($widgets = this.$widgets);
    +        var result = [];
    +        $widgets.each($.proxy(function(i, widget){
    +            result.push( this.options.serialize_params(
    +                $(widget),$(widget).coords().grid ) );
    +        }, this));
    +
    +        return result;
    +    };
    +
    +
    +    /**
    +    * Returns a serialized array of the widgets that have changed their position.
    +    *
    +    * @method serialize_changed
    +    * @return {Array} Returns an Array of Objects with the data specified in
    +    *  the serialize_params option.
    +    */
    +    fn.serialize_changed = function() {
    +        return this.serialize(this.$changed);
    +    };
    +
    +
    +    /**
    +    * Creates the grid coords object representing the widget a add it to the mapped array of positions
    +    *
    +    * @method serialize_changed
    +    * @return {Array} Returns the instance of the Gridster class.
    +    */
    +    fn.register_widget = function($el) {
    +        var widget_grid_data = {
    +            'col': parseInt($el.attr('data-col'), 10),
    +            'row': parseInt($el.attr('data-row'), 10),
    +            'size_x': parseInt($el.attr('data-sizex'), 10),
    +            'size_y': parseInt($el.attr('data-sizey'), 10),
    +            'el': $el
    +        };
    +
    +        // attach Coord object to player data-coord attribute
    +        $el.data('coords', $el.coords());
    +
    +        // Extend Coord object with grid position info
    +        $el.data('coords').grid = widget_grid_data;
    +
    +        this.add_to_gridmap(widget_grid_data, $el);
    +        this.widgets.push($el);
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Update in the mapped array of positions the value of cells represented by
    +    * the grid coords object passed in the `grid_data` param.
    +    *
    +    * @param {Object} grid_data The grid coords object representing the cells
    +    *  to update in the mapped array.
    +    * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped
    +    *  HTMLElement, depends if you want to delete an existing position or add
    +    *  a new one.
    +    * @method update_widget_position
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.update_widget_position = function(grid_data, value) {
    +        this.for_each_cell_occupied(grid_data, function(col, row) {
    +            if (!this.gridmap[col]) { return this; }
    +            this.gridmap[col][row] = value;
    +        });
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Remove a widget from the mapped array of positions.
    +    *
    +    * @method remove_from_gridmap
    +    * @param {Object} grid_data The grid coords object representing the cells
    +    *  to update in the mapped array.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.remove_from_gridmap = function(grid_data){
    +        return this.update_widget_position(grid_data, false);
    +    };
    +
    +
    +    /**
    +    * Add a widget to the mapped array of positions.
    +    *
    +    * @method add_to_gridmap
    +    * @param {Object} grid_data The grid coords object representing the cells
    +    *  to update in the mapped array.
    +    * @param {HTMLElement|Boolean} value The value to set in the specified
    +    *  position .
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.add_to_gridmap = function(grid_data, value){
    +        this.update_widget_position(grid_data, value || grid_data.el);
    +
    +        if (grid_data.el) {
    +            var $widgets = this.widgets_below(grid_data.el);
    +            $widgets.each($.proxy(function(i, widget){
    +                this.move_widget_up( $(widget));
    +            }, this));
    +        }
    +    };
    +
    +
    +    /**
    +    * Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.
    +    *
    +    * @method draggable
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.draggable = function() {
    +        var self = this;
    +        var draggable_options = $.extend(true, {}, this.options.draggable, {
    +            // containment : this.$wrapper,
    +            start: function(event, ui) {
    +                self.$player = $(this);
    +                self.on_start_drag.call(self, event, ui);
    +            },
    +            stop: function(event, ui) {
    +                self.on_stop_drag.call(self, ui);
    +            },
    +            drag: throttle(function(event, ui) {
    +                self.on_drag.call(self, event, ui);
    +            }, 100, true)
    +          });
    +
    +      this.$widgets.draggable(draggable_options);
    +
    +      return this;
    +    };
    +
    +
    +    /**
    +    * This function is executed when the player begins to be dragged.
    +    *
    +    * @method on_start_drag
    +    * @param {Event} The original browser event
    +    * @param {Object} A prepared ui object.
    +    *  See http://jqueryui.com/demos/draggable/ for more info.
    +    */
    +    fn.on_start_drag = function(event, ui) {
    +        this.$player.addClass('player');
    +        this.$wrapper.addClass('dragging');
    +        this.player_grid_data = this.$player.coords().grid;
    +        this.placeholder_grid_data = $.extend({}, this.player_grid_data);
    +
    +
    +        //set new grid height along the dragging period
    +        this.$el.css('height', this.$el.height() +
    +          (this.player_grid_data.size_y * this.min_widget_height));
    +
    +        var colliders = this.faux_grid;
    +        var coords = this.$player.data('coords').coords;
    +
    +        this.cells_occupied_by_player = this.get_cells_occupied(this.player_grid_data);
    +        this.cells_occupied_by_placeholder = this.get_cells_occupied(this.placeholder_grid_data);
    +
    +        this.last_cols = [];
    +        this.last_rows = [];
    +
    +        // see jquery.collision.js
    +        this.drag_api = this.$player.collision(colliders, this.options.collision);
    +
    +        this.$preview_holder = $('<li />', {
    +              'class': 'preview-holder',
    +              'data-row': this.$player.attr('data-row'),
    +              'data-col': this.$player.attr('data-col'),
    +              css: {
    +                  width: coords.width,
    +                  height: coords.height
    +              }
    +        }).appendTo(this.$el);
    +
    +        if (this.options.draggable.start) {
    +          this.options.draggable.start.call(this, event, ui);
    +        }
    +    };
    +
    +
    +    /**
    +    * This function is executed when the player is being dragged.
    +    *
    +    * @method on_drag
    +    * @param {Event} The original browser event
    +    * @param {Object} A prepared ui object.
    +    *  See http://jqueryui.com/demos/draggable/ for more info.
    +    */
    +    fn.on_drag = function(event, ui) {
    +        this.colliders_data = this.drag_api.get_closest_colliders();
    +
    +        this.on_overlapped_column_change(
    +            this.on_start_overlapping_column,
    +            this.on_stop_overlapping_column
    +        );
    +
    +        this.on_overlapped_row_change(
    +            this.on_start_overlapping_row,
    +            this.on_stop_overlapping_row
    +        );
    +
    +        if (this.options.draggable.drag) {
    +            this.options.draggable.drag.call(this, event, ui);
    +        }
    +    };
    +
    +    /**
    +    * This function is executed when the player stops being dragged.
    +    *
    +    * @method on_stop_drag
    +    * @param {Event} The original browser event
    +    * @param {Object} A prepared ui object.
    +    *  See http://jqueryui.com/demos/draggable/ for more info.
    +    */
    +    fn.on_stop_drag = function(event, ui) {
    +        this.colliders_data = this.drag_api.get_closest_colliders();
    +
    +        this.on_overlapped_column_change(
    +            this.on_start_overlapping_column,
    +            this.on_stop_overlapping_column
    +        );
    +
    +        this.on_overlapped_row_change(
    +            this.on_start_overlapping_row,
    +            this.on_stop_overlapping_row
    +        );
    +
    +        this.$player.attr({
    +            'data-col': this.placeholder_grid_data.col,
    +            'data-row': this.placeholder_grid_data.row
    +        }).css({
    +            'left': '',
    +            'top': ''
    +        }).removeClass('player');
    +
    +        this.$changed = this.$changed.add(this.$player);
    +
    +        this.cells_occupied_by_player = this.get_cells_occupied(
    +            this.placeholder_grid_data);
    +        this.set_cells_player_occupies(
    +            this.placeholder_grid_data.col, this.placeholder_grid_data.row);
    +
    +        this.$player.coords().grid.row = this.placeholder_grid_data.row;
    +        this.$player.coords().grid.col = this.placeholder_grid_data.col;
    +
    +        this.$player = null;
    +
    +        this.$preview_holder.remove();
    +
    +        this.set_dom_grid_height();
    +
    +        if (this.options.draggable.stop) {
    +          this.options.draggable.stop.call(this, event, ui);
    +        }
    +    };
    +
    +
    +    /**
    +    * Executes the callbacks passed as arguments when a column begins to be
    +    * overlapped or stops being overlapped.
    +    *
    +    * @param {Function} start_callback Function executed when a new column
    +    *  begins to be overlapped. The column is passed as first argument.
    +    * @param {Function} stop_callback Function executed when a column stops
    +    *  being overlapped. The column is passed as first argument.
    +    * @method on_overlapped_column_change
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.on_overlapped_column_change = function(start_callback, stop_callback) {
    +        if (!this.colliders_data.length) {
    +            return;
    +        }
    +        var cols = this.get_targeted_columns(
    +            this.colliders_data[0].el.data.col);
    +
    +        var last_n_cols = this.last_cols.length;
    +        var n_cols = cols.length;
    +        var i;
    +
    +        for (i = 0; i < n_cols; i++) {
    +            if ($.inArray(cols[i], this.last_cols) === -1) {
    +                (start_callback || $.noop).call(this, cols[i]);
    +            }
    +        }
    +
    +        for (i = 0; i< last_n_cols; i++) {
    +            if ($.inArray(this.last_cols[i], cols) === -1) {
    +                (stop_callback || $.noop).call(this, this.last_cols[i]);
    +            }
    +        }
    +
    +        this.last_cols = cols;
    +
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Executes the callbacks passed as arguments when a row starts to be
    +    * overlapped or stops being overlapped.
    +    *
    +    * @param {Function} start_callback Function executed when a new row begins
    +    *  to be overlapped. The row is passed as first argument.
    +    * @param {Function} stop_callback Function executed when a row stops being
    +    *  overlapped. The row is passed as first argument.
    +    * @method on_overlapped_row_change
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.on_overlapped_row_change = function(start_callback, end_callback) {
    +        if (!this.colliders_data.length) {
    +            return;
    +        }
    +        var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row);
    +        var last_n_rows = this.last_rows.length;
    +        var n_rows = rows.length;
    +        var i;
    +
    +        for (i = 0; i < n_rows; i++) {
    +            if ($.inArray(rows[i], this.last_rows) === -1) {
    +                (start_callback || $.noop).call(this, rows[i]);
    +            }
    +        }
    +
    +        for (i = 0; i < last_n_rows; i++) {
    +            if ($.inArray(this.last_rows[i], rows) === -1) {
    +                (end_callback || $.noop).call(this, this.last_rows[i]);
    +            }
    +        }
    +
    +        this.last_rows = rows;
    +    };
    +
    +
    +    /**
    +    * Sets the current position of the player
    +    *
    +    * @param {Function} start_callback Function executed when a new row begins
    +    *  to be overlapped. The row is passed as first argument.
    +    * @param {Function} stop_callback Function executed when a row stops being
    +    *  overlapped. The row is passed as first argument.
    +    * @method set_player
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.set_player = function(col, row) {
    +        this.empty_cells_player_occupies();
    +
    +        var self = this;
    +        var cell = self.colliders_data[0].el.data;
    +        var to_col = cell.col;
    +        var to_row = row || cell.row;
    +
    +        this.player_grid_data = {
    +            col: to_col,
    +            row: to_row,
    +            size_y : this.player_grid_data.size_y,
    +            size_x : this.player_grid_data.size_x
    +        };
    +
    +        this.cells_occupied_by_player = this.get_cells_occupied(
    +            this.player_grid_data);
    +
    +        var $overlapped_widgets = this.get_widgets_overlapped(
    +            this.player_grid_data);
    +
    +        var constraints = this.widgets_constraints($overlapped_widgets);
    +
    +        this.manage_movements(constraints.can_go_up, to_col, to_row);
    +        this.manage_movements(constraints.can_not_go_up, to_col, to_row);
    +
    +        /* if there is not widgets overlapping in the new player position,
    +         * update the new placeholder position. */
    +        if (!$overlapped_widgets.length) {
    +            var pp = this.can_go_player_up(this.player_grid_data);
    +            if (pp !== false) {
    +                to_row = pp;
    +            }
    +            this.set_placeholder(to_col, to_row);
    +        }
    +
    +        return {
    +            col: to_col,
    +            row: to_row
    +        };
    +    };
    +
    +
    +    /**
    +    * See which of the widgets in the $widgets param collection can go to
    +    * a upper row and which not.
    +    *
    +    * @method widgets_contraints
    +    * @param {HTMLElements} $widgets A jQuery wrapped collection of
    +    * HTMLElements.
    +    * @return {Array} Returns a literal Object with two keys: `can_go_up` &
    +    * `can_not_go_up`. Each contains a set of HTMLElements.
    +    */
    +    fn.widgets_constraints = function($widgets) {
    +        var $widgets_can_go_up = $([]);
    +        var $widgets_can_not_go_up;
    +        var wgd_can_go_up = [];
    +        var wgd_can_not_go_up = [];
    +
    +        $widgets.each($.proxy(function(i, w){
    +            var $w = $(w);
    +            var wgd = $w.coords().grid;
    +            if (this.can_go_widget_up(wgd)) {
    +                $widgets_can_go_up = $widgets_can_go_up.add($w);
    +                wgd_can_go_up.push(wgd);
    +            }else{
    +                wgd_can_not_go_up.push(wgd);
    +            }
    +        }, this));
    +
    +        $widgets_can_not_go_up = $widgets.not($widgets_can_go_up);
    +
    +        return {
    +            can_go_up: this.sort_by_row_asc(wgd_can_go_up),
    +            can_not_go_up: this.sort_by_row_desc(wgd_can_not_go_up)
    +        };
    +    };
    +
    +
    +    /**
    +    * Sorts an Array of grid coords objects (representing the grid coords of each widget) in ascending way.
    +    *
    +    * @method sort_by_row_asc
    +    * @param {Array} widgets Array of grid coords objects
    +    * @return {Array} Returns the array sorted.
    +    */
    +    fn.sort_by_row_asc = function(widgets) {
    +        widgets = widgets.sort(function(a, b){
    +           if (a.row > b.row) {
    +               return 1;
    +           }
    +           return -1;
    +        });
    +
    +        return widgets;
    +    };
    +
    +
    +    /**
    +    * Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.
    +    *
    +    * @method sort_by_row_desc
    +    * @param {Array} widgets Array of grid coords objects
    +    * @return {Array} Returns the array sorted.
    +    */
    +    fn.sort_by_row_desc = function(widgets) {
    +        widgets = widgets.sort(function(a, b){
    +            if (a.row + a.size_y < b.row + b.size_y){
    +                return 1;
    +            }
    +           return -1;
    +        });
    +        return widgets;
    +    };
    +
    +
    +    /**
    +    * Sorts an Array of grid coords objects (representing the grid coords of each widget) in descending way.
    +    *
    +    * @method manage_movements
    +    * @param {HTMLElements} $widgets A jQuery collection of HTMLElements
    +    *  representing the widgets you want to move.
    +    * @param {Number} to_col The column to which we want to move the widgets.
    +    * @param {Number} to_row The row to which we want to move the widgets.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.manage_movements = function($widgets, to_col, to_row) {
    +        $.each($widgets, $.proxy(function(i, w){
    +            var wgd = w;
    +            var $w = wgd.el;
    +
    +            var can_go_widget_up = this.can_go_widget_up(wgd);
    +
    +            if (can_go_widget_up) {
    +                //target CAN go up
    +                //so move widget up
    +                this.move_widget_to($w, can_go_widget_up);
    +                this.set_placeholder(to_col, can_go_widget_up + wgd.size_y);
    +
    +            } else {
    +                //target can't go up
    +                var can_go_player_up = this.can_go_player_up(
    +                    this.player_grid_data);
    +
    +                if (!can_go_player_up) {
    +                    // target can't go up
    +                    // player cant't go up
    +                    // so we need to move widget down to a position that dont
    +                    // overlaps player
    +                    var y = (to_row + this.player_grid_data.size_y) - wgd.row;
    +
    +                    this.move_widget_down($w, y);
    +                    this.set_placeholder(to_col, to_row);
    +                }
    +            }
    +        }, this));
    +
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Determines if there is a widget in the row and col given. Or if the
    +    * HTMLElement passed as first argument is the player.
    +    *
    +    * @method is_player
    +    * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of
    +    * HTMLElements.
    +    * @param {Number} [row] The column to which we want to move the widgets.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_player = function(col_or_el, row) {
    +        if (row && !this.gridmap[col_or_el]) { return false; }
    +        var $w = row ? this.gridmap[col_or_el][row] : col_or_el;
    +        return $w && $w.is(this.$player);
    +    };
    +
    +
    +    /**
    +    * Determines if the widget that is being dragged is currently over the row
    +    * and col given.
    +    *
    +    * @method is_player_in
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_player_in = function(col, row) {
    +        var c = this.cells_occupied_by_player;
    +        return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
    +    };
    +
    +
    +    /**
    +    * Determines if the placeholder is currently over the row and col given.
    +    *
    +    * @method is_placeholder_in
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_placeholder_in = function(col, row) {
    +        var c = this.cells_occupied_by_placeholder || [];
    +        return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0;
    +    };
    +
    +
    +    fn.is_placeholder_in_col = function(col, row) {
    +        return $.inArray(col, this.cells_occupied_by_placeholder.cols) >= 0;
    +    };
    +
    +
    +    /**
    +    * Determines if the placeholder is currently over the row and col given.
    +    *
    +    * @method is_placeholder_in
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_placeholder_in = function(col, row) {
    +        var c = this.cells_occupied_by_placeholder || [];
    +        return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
    +    };
    +
    +
    +    /**
    +    * Determines if the cell represented by col and row params is empty.
    +    *
    +    * @method is_empty
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_empty = function(col, row) {
    +        if (typeof this.gridmap[col] !== 'undefined' &&
    +            typeof this.gridmap[col][row] !== 'undefined' &&
    +            this.gridmap[col][row] === false
    +        ) {
    +            return true;
    +        }
    +        return false;
    +    };
    +
    +
    +    /**
    +    * Determines if the cell represented by col and row params is occupied.
    +    *
    +    * @method is_occupied
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_occupied = function(col, row) {
    +        if (!this.gridmap[col]) {
    +            return false;
    +        }
    +
    +        if (this.gridmap[col][row]) {
    +            return true;
    +        }
    +        return false;
    +    };
    +
    +
    +    /**
    +    * Determines if there is a widget in the cell represented by col/row params.
    +    *
    +    * @method is_widget
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean|HTMLElement} Returns false if there is no widget,
    +    * else returns the jQuery HTMLElement
    +    */
    +    fn.is_widget = function(col, row) {
    +        var cell = this.gridmap[col];
    +        if (!cell) {
    +            return false;
    +        }
    +
    +        cell = cell[row];
    +
    +        if (cell) {
    +            return cell;
    +        }
    +
    +        return false;
    +    };
    +
    +
    +    /**
    +    * Determines if there is a widget in the cell represented by col/row
    +    * params and if this is under the widget that is being dragged.
    +    *
    +    * @method is_widget_under_player
    +    * @param {Number} col The column to check.
    +    * @param {Number} row The row to check.
    +    * @return {Boolean} Returns true or false.
    +    */
    +    fn.is_widget_under_player = function(col, row) {
    +        if (this.is_widget(col, row)) {
    +            return this.is_player_in(col, row);
    +        }
    +        return false;
    +    };
    +
    +
    +    /**
    +    * Get widgets overlapping with the player.
    +    *
    +    * @method get_widgets_under_player
    +    * @return {HTMLElement} Returns a jQuery collection of HTMLElements
    +    */
    +    fn.get_widgets_under_player = function() {
    +        var cells = this.cells_occupied_by_player;
    +        var $widgets = $([]);
    +
    +        $.each(cells.cols, $.proxy(function(i, col){
    +            $.each(cells.rows, $.proxy(function(i, row){
    +                if(this.is_widget(col, row)){
    +                    $widgets = $widgets.add(this.gridmap[col][row]);
    +                }
    +            }, this));
    +        }, this));
    +
    +        return $widgets;
    +    };
    +
    +
    +    /**
    +    * Put placeholder at the row and column specified.
    +    *
    +    * @method set_placeholder
    +    * @param {Number} col The column to which we want to move the
    +    *  placeholder.
    +    * @param {Number} row The row to which we want to move the
    +    *  placeholder.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.set_placeholder = function(col, row) {
    +        var phgd = $.extend({}, this.placeholder_grid_data);
    +        var $nexts = this.widgets_below({
    +                col: phgd.col,
    +                row: phgd.row,
    +                size_y: phgd.size_y,
    +                size_x: phgd.size_x
    +            });
    +        var moved_down = this.placeholder_grid_data.row < row;
    +        var changed_column = this.placeholder_grid_data.col !== col;
    +
    +        this.placeholder_grid_data.col = col;
    +        this.placeholder_grid_data.row = row;
    +
    +        this.cells_occupied_by_placeholder = this.get_cells_occupied(
    +            this.placeholder_grid_data);
    +
    +        this.$preview_holder.attr({
    +            'data-row' : row,
    +            'data-col' : col
    +        });
    +
    +        if (moved_down || changed_column) {
    +            $nexts.each($.proxy(function(i, widget){
    +                this.move_widget_up( $(widget) , this.placeholder_grid_data.col - col + phgd.size_y );
    +            }, this));
    +        }
    +
    +    };
    +
    +
    +    /**
    +    * Determines whether the player can move to a position above.
    +    *
    +    * @method can_go_player_up
    +    * @param {Object} widget_grid_data The actual grid coords object of the
    +    *  player.
    +    * @return {Number|Boolean} If the player can be moved to an upper row
    +    *  returns the row number, else returns false.
    +    */
    +    fn.can_go_player_up = function(widget_grid_data) {
    +        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
    +        var result = true;
    +        var upper_rows = [];
    +        var min_row = 10000;
    +        var $widgets_under_player = this.get_widgets_under_player();
    +
    +        /* generate an array with columns as index and array with upper rows
    +         * empty as value */
    +        this.for_each_column_occupied(widget_grid_data, function(tcol){
    +            var grid_col = this.gridmap[tcol];
    +            var r = p_bottom_row + 1;
    +            upper_rows[tcol] = [];
    +
    +            while (--r > 0){
    +                if (this.is_empty(tcol, r) || this.is_player(tcol, r) ||
    +                    this.is_widget(tcol, r) && grid_col[r].is($widgets_under_player)
    +                ) {
    +                    upper_rows[tcol].push(r);
    +                    min_row = r < min_row ? r : min_row;
    +                }else{
    +                    break;
    +                }
    +            }
    +
    +            if (upper_rows[tcol].length === 0) {
    +                result = false;
    +                return true; //break
    +            }
    +
    +            upper_rows[tcol].sort();
    +        });
    +
    +        if (!result) { return false; }
    +
    +        return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
    +    };
    +
    +
    +    /**
    +    * Determines whether a widget can move to a position above.
    +    *
    +    * @method can_go_widget_up
    +    * @param {Object} widget_grid_data The actual grid coords object of the
    +    *  widget we want to check.
    +    * @return {Number|Boolean} If the widget can be moved to an upper row
    +    *  returns the row number, else returns false.
    +    */
    +    fn.can_go_widget_up = function(widget_grid_data) {
    +        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
    +        var result = true;
    +        var upper_rows = [];
    +        var min_row = 10000;
    +
    +        /* generate an array with columns as index and array with upper rows
    +         * empty as value */
    +        this.for_each_column_occupied(widget_grid_data, function(tcol){
    +            var grid_col = this.gridmap[tcol];
    +            upper_rows[tcol] = [];
    +
    +            var r = p_bottom_row + 1;
    +
    +            while (--r > 0) {
    +                if (this.is_occupied(tcol, r) && !this.is_player(tcol, r)) {
    +                    break;
    +                }
    +
    +                if (!this.is_player(tcol, r) &&!this.is_placeholder_in(tcol, r)) {
    +                    upper_rows[tcol].push(r);
    +                }
    +
    +                if (r < min_row ) {
    +                    min_row = r;
    +                }
    +            }
    +
    +            if (upper_rows[tcol].length === 0) {
    +                result = false;
    +                return true; //break
    +            }
    +
    +            upper_rows[tcol].sort();
    +        });
    +
    +        if (!result) { return false; }
    +
    +        return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
    +    };
    +
    +
    +    /**
    +    * Search a valid row for the widget represented by `widget_grid_data' in
    +    * the `upper_rows` array. Iteration starts from row specified in `min_row`.
    +    *
    +    * @method get_valid_rows
    +    * @param {Object} widget_grid_data The actual grid coords object of the
    +    *  player.
    +    * @param {Array} upper_rows An array with columns as index and arrays
    +    *  of valid rows as values.
    +    * @param {Number} min_row The upper row from which the iteration will start.
    +    * @return {Number|Boolean} Returns the upper row valid from the `upper_rows`
    +    *  for the widget in question.
    +    */
    +    fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row){
    +        var p_top_row = widget_grid_data.row;
    +        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
    +        var size_y = widget_grid_data.size_y;
    +        var r = min_row - 1;
    +        var valid_rows = [];
    +
    +        while (++r <= p_bottom_row ) {
    +            var common = true;
    +            $.each(upper_rows, function(col, rows){
    +                if (rows && $.inArray(r, rows) === -1) {
    +                    common = false;
    +                }
    +            });
    +
    +            if (common === true) {
    +                valid_rows.push(r);
    +                if (valid_rows.length === size_y) {
    +                    break;
    +                }
    +            }
    +        }
    +
    +        var new_row = false;
    +        if (size_y === 1) {
    +            if (valid_rows[0] !== p_top_row) {
    +                new_row = valid_rows[0] || false;
    +            }
    +        }else{
    +            if (valid_rows[0] !== p_top_row) {
    +                new_row = this.get_consecutive_numbers_index(
    +                    valid_rows, size_y);
    +            }
    +        }
    +
    +
    +        return new_row;
    +    };
    +
    +
    +    fn.get_consecutive_numbers_index = function(arr, size_y) {
    +        var max = arr.length;
    +        var result = [];
    +        var first = true;
    +        var prev = -1; // or null?
    +
    +        for (var i=0; i < max; i++) {
    +            if (first || arr[i] === prev + 1) {
    +                result.push(i);
    +                if (result.length === size_y) {
    +                    break;
    +                }
    +                first = false;
    +            }else{
    +                result = [];
    +                first = true;
    +            }
    +
    +            prev = arr[i];
    +        }
    +
    +        return result.length >= size_y ? arr[result[0]] : false;
    +    };
    +
    +
    +    /**
    +    * Get widgets overlapping with the player.
    +    *
    +    * @method get_widgets_overlapped
    +    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
    +    */
    +    fn.get_widgets_overlapped = function() {
    +        var $w;
    +        var $widgets = $([]);
    +        var used = [];
    +        var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0);
    +        rows_from_bottom.reverse();
    +
    +        $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col){
    +            $.each(rows_from_bottom, $.proxy(function(i, row){
    +                // if there is a widget in the player position
    +                if (!this.gridmap[col]) { return true; } //next iteration
    +                var $w = this.gridmap[col][row];
    +
    +                if (this.is_occupied(col, row) && !this.is_player($w) &&
    +                    $.inArray($w, used) === -1
    +                ) {
    +                    $widgets = $widgets.add($w);
    +                    used.push($w);
    +                }
    +
    +            }, this));
    +        }, this));
    +
    +        return $widgets;
    +    };
    +
    +
    +    /**
    +    * This callback is executed when the player begins to collide with a column.
    +    *
    +    * @method on_start_overlapping_column
    +    * @param {Number} col The collided column.
    +    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
    +    */
    +    fn.on_start_overlapping_column = function(col) {
    +        this.set_player(col, false);
    +    };
    +
    +
    +    /**
    +    * A callback executed when the player begins to collide with a row.
    +    *
    +    * @method on_start_overlapping_row
    +    * @param {Number} col The collided row.
    +    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
    +    */
    +    fn.on_start_overlapping_row = function(row) {
    +        this.set_player(false, row);
    +    };
    +
    +
    +    /**
    +    * A callback executed when the the player ends to collide with a column.
    +    *
    +    * @method on_stop_overlapping_column
    +    * @param {Number} col The collided row.
    +    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
    +    */
    +    fn.on_stop_overlapping_column = function(col) {
    +        this.set_player();
    +
    +        var self = this;
    +        this.for_each_widget_below(col, this.cells_occupied_by_player.rows[0],
    +            function(tcol, trow) {
    +                self.move_widget_up(this, self.player_grid_data.size_y);
    +        });
    +    };
    +
    +
    +    /**
    +    * This callback is executed when the player ends to collide with a row.
    +    *
    +    * @method on_stop_overlapping_row
    +    * @param {Number} row The collided row.
    +    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
    +    */
    +    fn.on_stop_overlapping_row = function(row) {
    +        this.set_player();
    +
    +        var self = this;
    +        var cols = this.cells_occupied_by_player.cols;
    +        for (var c = 0, cl = cols.length; c < cl; c++) {
    +            this.for_each_widget_below(cols[c], row, function(tcol, trow) {
    +                self.move_widget_up(this, self.player_grid_data.size_y);
    +            });
    +        }
    +    };
    +
    +
    +    /**
    +    * Move a widget to a specific row. The cell or cells must be empty.
    +    * If the widget has widgets below, all of these widgets will be moved also
    +    * if they can.
    +    *
    +    * @method move_widget_to
    +    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the widget is going to be moved.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.move_widget_to = function($widget, row) {
    +        var self = this;
    +        var widget_grid_data = $widget.coords().grid;
    +        var diff = row - widget_grid_data.row;
    +        var $next_widgets = this.widgets_below($widget);
    +
    +        var can_move_to_new_cell = this.can_move_to(
    +            widget_grid_data, widget_grid_data.col, row, $widget);
    +
    +        if (can_move_to_new_cell === false) {
    +            return false;
    +        }
    +
    +        this.remove_from_gridmap(widget_grid_data);
    +        widget_grid_data.row = row;
    +        this.add_to_gridmap(widget_grid_data);
    +        $widget.attr('data-row', row);
    +        this.$changed = this.$changed.add($widget);
    +
    +
    +        $next_widgets.each(function(i, widget){
    +            var $w = $(widget);
    +            var wgd = $w.coords().grid;
    +            var can_go_up = self.can_go_widget_up(wgd);
    +
    +            if (can_go_up && can_go_up !== wgd.row){
    +                self.move_widget_to($w, can_go_up);
    +            }
    +        });
    +
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Move up the specified widget and all below it.
    +    *
    +    * @method move_widget_up
    +    * @param {HTMLElement} $widget The widget you want to move.
    +    * @param {Number} [y_units] The number of cells that the widget has to move.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.move_widget_up = function($widget, y_units) {
    +        var el_grid_data = $widget.coords().grid;
    +        var actual_row = el_grid_data.row;
    +        var moved = [];
    +        var can_go_up = true;
    +        y_units || (y_units = 1);
    +
    +        if (!this.can_go_up($widget)) { return false; } //break;
    +
    +        this.for_each_column_occupied(el_grid_data, function(col){
    +            // can_go_up
    +            if ($.inArray($widget, moved) === -1) {
    +                var widget_grid_data = $widget.coords().grid;
    +                var next_row = actual_row - y_units;
    +                next_row = this.can_go_up_to_row(widget_grid_data, col, next_row);
    +                if (!next_row) {
    +                    return true;
    +                }
    +
    +                var $next_widgets = this.widgets_below($widget);
    +
    +                this.remove_from_gridmap(widget_grid_data);
    +                widget_grid_data.row = next_row;
    +                this.add_to_gridmap(widget_grid_data);
    +                $widget.attr('data-row', widget_grid_data.row);
    +                this.$changed = this.$changed.add($widget);
    +
    +                moved.push($widget);
    +
    +                $next_widgets.each($.proxy(function(i, widget){
    +                    this.move_widget_up($(widget), y_units);
    +                }, this));
    +            }
    +        });
    +
    +    };
    +
    +
    +    /**
    +    * Move down the specified widget and all below it.
    +    *
    +    * @method move_widget_down
    +    * @param {HTMLElement} $widget The jQuery object representing the widget you want to move.
    +    * @param {Number} The number of cells that the widget has to move.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.move_widget_down = function($widget, y_units) {
    +        var el_grid_data = $widget.coords().grid;
    +        var actual_row = el_grid_data.row;
    +        var moved = [];
    +        var y_diff = y_units;
    +
    +        if (!$widget) { return false; }
    +
    +        if ($.inArray($widget, moved) === -1) {
    +
    +            var widget_grid_data = $widget.coords().grid;
    +            var next_row = actual_row + y_units;
    +            var $next_widgets = this.widgets_below($widget);
    +
    +            this.remove_from_gridmap(widget_grid_data);
    +
    +            $next_widgets.each($.proxy(function(i, widget){
    +                var $w = $(widget);
    +                var wd = $w.coords().grid;
    +                var tmp_y = this.displacement_diff(
    +                             wd, widget_grid_data, y_diff);
    +
    +                if (tmp_y > 0) {
    +                    this.move_widget_down($w, tmp_y);
    +                }
    +            }, this));
    +
    +            widget_grid_data.row = next_row;
    +            this.update_widget_position(widget_grid_data, $widget);
    +            $widget.attr('data-row', widget_grid_data.row);
    +            this.$changed = this.$changed.add($widget);
    +
    +            moved.push($widget);
    +        }
    +    };
    +
    +
    +    /**
    +    * Check if the widget can move to the specified row, else returns the
    +    * upper row possible.
    +    *
    +    * @method can_go_up_to_row
    +    * @param {Number} widget_grid_data The current grid coords object of the
    +    *  widget.
    +    * @param {Number} col The target column.
    +    * @param {Number} row The target row.
    +    * @return {Boolean|Number} Returns the row number if the widget can move
    +    *  to the target position, else returns false.
    +    */
    +    fn.can_go_up_to_row = function(widget_grid_data, col, row) {
    +        var ga = this.gridmap;
    +        var result = true;
    +        var urc = []; // upper_rows_in_columns
    +        var actual_row = widget_grid_data.row;
    +        var r;
    +
    +        //generate an array with columns as index and array with upper rows empty in the column
    +        this.for_each_column_occupied(widget_grid_data, function(tcol){
    +            var grid_col = ga[tcol];
    +            urc[tcol] = [];
    +
    +            r = actual_row;
    +            while (r--){
    +                if (this.is_empty(tcol, r) &&
    +                    !this.is_placeholder_in(tcol, r)
    +                ) {
    +                    urc[tcol].push(r);
    +                }else{
    +                    break;
    +                }
    +            }
    +
    +            if (!urc[tcol].length) {
    +                result = false;
    +                return true;
    +            }
    +
    +        });
    +
    +        if (!result) { return false; }
    +
    +        //get common rows starting from upper position in all the columns widget occupies
    +        r = row;
    +        for (r = 1; r < actual_row; r++) {
    +            var common = true;
    +
    +            for (var uc = 0, ucl = urc.length; uc < ucl; uc++) {
    +                if (urc[uc] && $.inArray(r, urc[uc]) === -1) {
    +                    common = false;
    +                }
    +            }
    +
    +            if (common === true) {
    +                result = r;
    +                break;
    +            }
    +        }
    +
    +        return result;
    +    };
    +
    +
    +    fn.displacement_diff = function(widget_grid_data, parent_bgd, y_units) {
    +        var actual_row = widget_grid_data.row;
    +        var diffs = [];
    +        var parent_max_y = parent_bgd.row + parent_bgd.size_y;
    +
    +        this.for_each_column_occupied(widget_grid_data, function(col){
    +            var temp_y_units = 0;
    +
    +            for (var r = parent_max_y; r < actual_row; r++) {
    +                if (this.is_empty(col, r)) {
    +                    temp_y_units = temp_y_units + 1;
    +                }
    +            }
    +
    +            diffs.push(temp_y_units);
    +        });
    +
    +        var max_diff = Math.max.apply(null, diffs);
    +        y_units = (y_units - max_diff);
    +
    +        return y_units > 0 ? y_units : 0;
    +    };
    +
    +
    +    /**
    +    * Get widgets below a widget.
    +    *
    +    * @method widgets_below
    +    * @param {HTMLElement} $el The jQuery wrapped HTMLElement.
    +    * @return {HTMLElements} A jQuery collection of HTMLElements.
    +    */
    +    fn.widgets_below = function($el) {
    +        var el_grid_data = $.isPlainObject($el) ? $el : $el.coords().grid;
    +        var self = this;
    +        var ga = this.gridmap;
    +        var next_row = el_grid_data.row + el_grid_data.size_y - 1;
    +        var $nexts = $([]);
    +
    +        this.for_each_column_occupied(el_grid_data, function(col){
    +            self.for_each_widget_below(col, next_row,
    +                function(tcol, trow){
    +                    if (!self.is_player(this) &&
    +                        $.inArray(this, $nexts) === -1) {
    +                            $nexts = $nexts.add(this);
    +                            return true; // break
    +                    }
    +                });
    +        });
    +
    +        return this.sort_by_row_asc($nexts);
    +    };
    +
    +
    +    /**
    +    * Update the array of mapped positions with the new player position.
    +    *
    +    * @method set_cells_player_occupies
    +    * @param {Number} col The new player col.
    +    * @param {Number} col The new player row.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.set_cells_player_occupies = function(col, row) {
    +        this.remove_from_gridmap(this.placeholder_grid_data);
    +        this.placeholder_grid_data.col = col;
    +        this.placeholder_grid_data.row = row;
    +        this.add_to_gridmap(this.placeholder_grid_data, this.$player);
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Remove from the array of mapped positions the reference to the player.
    +    *
    +    * @method empty_cells_player_occupies
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.empty_cells_player_occupies = function() {
    +        this.remove_from_gridmap(this.placeholder_grid_data);
    +        return this;
    +    };
    +
    +
    +    fn.can_go_up = function($el) {
    +        var el_grid_data = $el.coords().grid;
    +        var initial_row = el_grid_data.row;
    +        var prev_row = initial_row - 1;
    +        var ga = this.gridmap;
    +        var upper_rows_by_column = [];
    +
    +        var result = true;
    +        if (initial_row === 1) { return false; }
    +
    +        this.for_each_column_occupied(el_grid_data, function(col){
    +            if (this.is_occupied(col, prev_row) ||
    +                this.is_player(col, prev_row) ||
    +                this.is_placeholder_in(col, prev_row)
    +            ) {
    +                result = false;
    +                return true; //break
    +            }
    +        });
    +
    +        return result;
    +    };
    +
    +
    +
    +    /**
    +    * Check if it's possible to move a widget to a specific col/row. It takes
    +    * into account the dimensions (`size_y` and `size_x` attrs. of the grid coords
    +    *  object) the widget occupies.
    +    *
    +    * @method can_move_to
    +    * @param {Object} widget_grid_data The grid coords object that represents
    +    *  the widget.
    +    * @param {Object} The col target col.
    +    * @param {Object} The row target row.
    +    * @return {Boolean} Returns true if all cells are empty, else return false.
    +    */
    +    fn.can_move_to = function(widget_grid_data, col, row) {
    +        var ga = this.gridmap;
    +        var $w = widget_grid_data.el;
    +        var future_wd = {
    +            size_y: widget_grid_data.size_y,
    +            size_x: widget_grid_data.size_x,
    +            col: col,
    +            row: row
    +        };
    +        var cells_occupied_by_w = this.get_cells_occupied(widget_grid_data);
    +        var result = true;
    +
    +        this.for_each_cell_occupied(future_wd, function(tcol, trow){
    +            var $tw = this.is_widget(tcol, trow);
    +            if ($tw && !$tw.is($w)) {
    +                result = false;
    +            }
    +        });
    +
    +        return result;
    +    };
    +
    +
    +    /**
    +    * Given the leftmost column returns all columns that are overlapping with the player.
    +    *
    +    * @method get_targeted_columns
    +    * @param {Number} [from_col] The leftmost column.
    +    * @return {Array} Returns an array with column numbers.
    +    */
    +    fn.get_targeted_columns = function(from_col) {
    +        var max = (from_col || this.player_grid_data.col) +
    +            (this.player_grid_data.size_x - 1);
    +        var cols = [];
    +        for (var col = from_col; col <= max; col++) {
    +            cols.push(col);
    +        }
    +        return cols;
    +    };
    +
    +
    +    /**
    +    * Given the upper row returns all rows that are overlapping with the player.
    +    *
    +    * @method get_targeted_rows
    +    * @param {Number} [from_row] The upper row.
    +    * @return {Array} Returns an array with row numbers.
    +    */
    +    fn.get_targeted_rows = function(from_row) {
    +        var max = (from_row || this.player_grid_data.row) +
    +            (this.player_grid_data.size_y - 1);
    +        var rows = [];
    +        for (var row = from_row; row <= max; row++) {
    +            rows.push(row);
    +        }
    +        return rows;
    +    };
    +
    +    /**
    +    * Get all columns and rows that a widget occupies.
    +    *
    +    * @method get_cells_occupied
    +    * @param {Object} el_grid_data The grid coords object of the widget.
    +    * @return {Object} Returns an object like `{ cols: [], rows: []}`.
    +    */
    +    fn.get_cells_occupied = function(el_grid_data) {
    +        var cells = { cols: [], rows: []};
    +        var i;
    +        if (arguments[1] instanceof jQuery) {
    +            el_grid_data = arguments[1].coords().grid;
    +        }
    +
    +        for (i = 0; i < el_grid_data.size_x; i++) {
    +            var col = el_grid_data.col + i;
    +            cells.cols.push(col);
    +        }
    +
    +        for (i = 0; i < el_grid_data.size_y; i++) {
    +            var row = el_grid_data.row + i;
    +            cells.rows.push(row);
    +        }
    +
    +        return cells;
    +    };
    +
    +
    +    /**
    +    * Iterate over the cells occupied by a widget executing a function for
    +    * each one.
    +    *
    +    * @method for_each_column_occupied
    +    * @param {Object} el_grid_data The grid coords object that represents the
    +    *  widget.
    +    * @param {Function} callback The function to execute on each column
    +    *  iteration. Column and row are passed as arguments.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.for_each_cell_occupied = function(grid_data, callback) {
    +        this.for_each_column_occupied(grid_data, function(col){
    +            this.for_each_row_occupied(grid_data, function(row){
    +                callback.call(this, col, row);
    +            });
    +        });
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Iterate over the columns occupied by a widget executing a function for
    +    * each one.
    +    *
    +    * @method for_each_column_occupied
    +    * @param {Object} el_grid_data The grid coords object that represents
    +    *  the widget.
    +    * @param {Function} callback The function to execute on each column
    +    *  iteration. The column number is passed as first argument.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.for_each_column_occupied = function(el_grid_data, callback) {
    +        for (var i = 0; i < el_grid_data.size_x; i++) {
    +            var col = el_grid_data.col + i;
    +            callback.call(this, col, el_grid_data);
    +        }
    +    };
    +
    +
    +    /**
    +    * Iterate over the rows occupied by a widget executing a function for
    +    * each one.
    +    *
    +    * @method for_each_row_occupied
    +    * @param {Object} el_grid_data The grid coords object that represents
    +    *  the widget.
    +    * @param {Function} callback The function to execute on each column iteration. The row number is passed as first argument.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.for_each_row_occupied = function(el_grid_data, callback) {
    +        for (var i = 0; i < el_grid_data.size_y; i++) {
    +            var row = el_grid_data.row + i;
    +            callback.call(this, row, el_grid_data);
    +        }
    +    };
    +
    +
    +
    +    fn._traversing_widgets = function(type, direction, col, row, callback) {
    +        var ga = this.gridmap;
    +        if (!ga[col]) { return; }
    +
    +        var cr, max;
    +        var action = type + '/' + direction;
    +        if (arguments[2] instanceof jQuery) {
    +            var el_grid_data = arguments[2].coords().grid;
    +            col = el_grid_data.col;
    +            row = el_grid_data.row;
    +            callback = arguments[3];
    +        }
    +        var matched = [];
    +        var trow = row;
    +
    +
    +        var methods = {
    +            'for_each/above': function() {
    +                while (trow--) {
    +                    if (trow > 0 && this.is_widget(col, trow) &&
    +                        $.inArray(ga[col][trow], matched) === -1
    +                    ) {
    +                        cr = callback.call(ga[col][trow], col, trow);
    +                        matched.push(ga[col][trow]);
    +                        if (cr) { break; }
    +                    }
    +                }
    +            },
    +            'for_each/below': function() {
    +                for (trow = row + 1, max = ga[col].length; trow < max; trow++) {
    +                    if (this.is_widget(col, trow) &&
    +                        $.inArray(ga[col][trow], matched) === -1
    +                    ) {
    +                        cr = callback.call(ga[col][trow], col, trow);
    +                        matched.push(ga[col][trow]);
    +                        if (cr) { break; }
    +                    }
    +                }
    +            }
    +        };
    +
    +        if (methods[action]) {
    +            methods[action].call(this);
    +        }
    +    };
    +
    +
    +    /**
    +    * Iterate over each widget above the column and row specified.
    +    *
    +    * @method for_each_widget_above
    +    * @param {Number} col The column to start iterating.
    +    * @param {Number} row The row to start iterating.
    +    * @param {Function} callback The function to execute on each widget
    +    * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.for_each_widget_above = function(col, row, callback) {
    +        this._traversing_widgets('for_each', 'above', col, row, callback);
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Iterate over each widget below the column and row specified.
    +    *
    +    * @method for_each_widget_below
    +    * @param {Number} col The column to start iterating.
    +    * @param {Number} row The row to start iterating.
    +    * @param {Function} callback The function to execute on each widget
    +    * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.
    +    * @return {Class} Returns the instance of the Gridster Class.
    +    */
    +    fn.for_each_widget_below = function(col, row, callback) {
    +        this._traversing_widgets('for_each', 'below', col, row, callback);
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Returns the highest occupied cell in the grid.
    +    *
    +    * @method get_highest_occupied_cell
    +    * @return {Object} Returns an object with `col` and `row` numbers.
    +    */
    +    fn.get_highest_occupied_cell = function() {
    +        var r;
    +        var gm = this.gridmap;
    +        var rows = [];
    +        var row_in_col = [];
    +        for (var c = gm.length - 1; c >= 1; c--) {
    +            for (r = gm[c].length - 1; r >= 1; r--) {
    +                if (this.is_widget(c, r)) {
    +                    rows.push(r);
    +                    row_in_col[r] = c;
    +                    break;
    +                }
    +            }
    +        }
    +
    +        var highest_row = Math.max.apply(null, rows);
    +
    +        this.highest_occupied_cell = {
    +            col: row_in_col[highest_row],
    +            row: highest_row
    +        };
    +
    +        return this.highest_occupied_cell;
    +    };
    +
    +
    +    /**
    +    * Set the current height of the parent grid.
    +    *
    +    * @method set_dom_grid_height
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.set_dom_grid_height = function() {
    +        var r = this.get_highest_occupied_cell().row;
    +        this.$el.css('height', r * this.min_widget_height);
    +        return this;
    +    };
    +
    +
    +    /**
    +    * It generates the neccessary styles to position the widgets.
    +    *
    +    * @method generate_stylesheet
    +    * @param {Number} rows Number of columns.
    +    * @param {Number} cols Number of rows.
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.generate_stylesheet = function(rows, cols) {
    +        var styles = '';
    +        var extra_cells = 10;
    +        var max_size_y = 6;
    +        var max_size_x = 6;
    +        var i;
    +        var rules;
    +
    +        /* generate CSS styles for cols */
    +        for (i = cols + extra_cells; i >= 0; i--) {
    +            styles += '[data-col="'+ (i + 1) +'"] { left: ' +
    +                      (i * this.min_widget_width) +
    +                      'px;} ';
    +        }
    +
    +        /* generate CSS styles for rows */
    +        for (i = rows + extra_cells; i >= 0; i--) {
    +            styles += '[data-row="' + (i + 1) + '"] { top: ' +
    +                      (i * this.min_widget_height) + 'px;} ';
    +        }
    +
    +
    +        for (var y = 1; y < max_size_y; y++) {
    +            styles += '[data-sizey="' + (y) + '"] { height: ' +
    +                      (y * this.options.widget_base_dimensions[1] + (y-1)*(this.options.widget_margins[1]*2)) + 'px;}';
    +        }
    +
    +        for (var x = 1; x < max_size_x; x++) {
    +            styles += '[data-sizex="' + (x) + '"] { width: ' +
    +                      (x * this.options.widget_base_dimensions[0] + (x-1)*(this.options.widget_margins[0]*2)) + 'px;}';
    +        }
    +
    +        return this.add_style_tag(styles);
    +    };
    +
    +
    +    /**
    +    * Injects the given CSS as string to the head of the document.
    +    *
    +    * @method generate_stylesheet
    +    * @param {String} css The styles to apply.
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.add_style_tag = function(css){
    +      var d = document;
    +      var tag = d.createElement('style');
    +
    +      d.getElementsByTagName('head')[0].appendChild(tag);
    +      tag.setAttribute('type', 'text/css');
    +
    +      if (tag.styleSheet) {
    +        tag.styleSheet.cssText = css;
    +      }else{
    +        tag.appendChild(document.createTextNode(css));
    +      }
    +      return this;
    +    };
    +
    +
    +    /**
    +    * Generates a faux grid to collide with it when a widget is dragged and
    +    * detect row or column that we want to go.
    +    *
    +    * @method generate_faux_grid
    +    * @param {Number} rows Number of columns.
    +    * @param {Number} cols Number of rows.
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.generate_faux_grid = function(rows, cols) {
    +        this.faux_grid = [];
    +        this.gridmap = [];
    +        var col;
    +        var row;
    +
    +        for (col = cols; col > 0; col--) {
    +            this.gridmap[col] = [];
    +            for (row = rows; row > 0; row--) {
    +                var coords = $({
    +                        left: this.baseX + ((col - 1) * this.min_widget_width),
    +                        top: this.baseY + (row -1) * this.min_widget_height,
    +                        width: this.min_widget_width,
    +                        height: this.min_widget_height,
    +                        col: col,
    +                        row: row,
    +                        original_col: col,
    +                        original_row: row
    +                    }).coords();
    +
    +                this.gridmap[col][row] = false;
    +                this.faux_grid.push(coords);
    +            }
    +        }
    +        return this;
    +    };
    +
    +    /**
    +    * Get all widgets in the DOM and register them.
    +    *
    +    * @method get_widgets_from_DOM
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.get_widgets_from_DOM = function() {
    +        this.$widgets.each($.proxy(function(i, widget){
    +            this.register_widget($(widget));
    +        }, this));
    +        return this;
    +    };
    +
    +
    +    /**
    +    * Calculate columns and rows to be set based on the configuration
    +    *  parameters, grid dimensions, etc ...
    +    *
    +    * @method generate_grid_and_stylesheet
    +    * @return {Object} Returns the instance of the Gridster class.
    +    */
    +    fn.generate_grid_and_stylesheet = function() {
    +        var grid_width;
    +        var aw = this.$wrapper.width();
    +        var ah = this.$wrapper.height();
    +
    +        var cols = Math.floor(aw/this.min_widget_width) +
    +                   this.options.extra_cols;
    +        var rows = Math.floor(ah/this.min_widget_height) +
    +                   this.options.extra_rows;
    +
    +        var actual_cols = this.$widgets.map(function() {
    +            return $(this).attr('data-col');
    +        });
    +
    +        var actual_rows = this.$widgets.map(function() {
    +            return $(this).attr('data-row');
    +        });
    +
    +        var min_cols = Math.max.apply(null, actual_cols);
    +        var min_rows = Math.max.apply(null, actual_rows);
    +
    +        cols = Math.max(min_cols, cols, this.options.min_cols);
    +        rows = Math.max(min_rows, rows, this.options.min_rows);
    +        grid_width = cols * (this.options.widget_base_dimensions[0] +
    +                         (this.options.widget_margins[0] * 2));
    +
    +        //this.support_grid_width = cols * this.min_widget_width;
    +        this.support_grid_width = this.wrapper_width;
    +
    +        this.support_grid_height = rows * this.min_widget_height;
    +        this.baseX = ($(window).width() - this.support_grid_width) / 2;
    +        this.baseY = this.$wrapper.offset().top;
    +
    +        //this.baseX = 0;
    +        if(this.options.autogenerate_stylesheet) {
    +            this.generate_stylesheet(rows, cols);
    +        }
    +
    +        /* more faux rows that needed are created so that there are cells
    +         * where drag beyond the limits */
    +        return this.generate_faux_grid(rows, cols);
    +    };
    +
    +
    +    //jQuery adapter
    +    $.fn.gridster = function(options) {
    +     return this.each(function() {
    +       if (!$(this).data('gridster')) {
    +         $(this).data('gridster', new Gridster( this, options ));
    +       }
    +     });
    +    };
    +
    +
    +}(jQuery, window, document));
    +
    +    
    +
    + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000000..3da554286f --- /dev/null +++ b/docs/index.html @@ -0,0 +1,127 @@ + + + + + + + + + + + + + +
    +
    +
    + + +

    + +
    +
    + API Docs for: +
    +
    +
    + +
    + +
    +
    +
    + Show: + + + + + + + +
    + + +
    +
    +
    +
    +
    +

    + Browse to a module or class using the sidebar to view its API documentation. +

    + +

    Keyboard Shortcuts

    + +
      +
    • Press s to focus the API search box.

    • + +
    • Use Up and Down to select classes, modules, and search results.

    • + +
    • With the API search box or sidebar focused, use -Left or -Right to switch sidebar tabs.

    • + +
    • With the API search box or sidebar focused, use Ctrl+Left and Ctrl+Right to switch sidebar tabs.

    • +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/docs/modules/index.html b/docs/modules/index.html new file mode 100644 index 0000000000..487fe15b2a --- /dev/null +++ b/docs/modules/index.html @@ -0,0 +1,10 @@ + + + + Redirector + + + + Click here to redirect + + diff --git a/grunt.js b/grunt.js new file mode 100644 index 0000000000..f0b2f9d34f --- /dev/null +++ b/grunt.js @@ -0,0 +1,86 @@ +/*global module:false*/ +module.exports = function(grunt) { + + // Project configuration. + grunt.initConfig({ + pkg: '', + meta: { + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' + }, + concat: { + dist_js: { + src: ['', '', '', '.js>'], + dest: 'dist/<%= pkg.name %>.js' + }, + dist_css: { + src: ['', 'src/<%= pkg.name %>.css'], + dest: 'dist/<%= pkg.name %>.css' + } + }, + min: { + dist: { + src: ['', ''], + dest: 'dist/<%= pkg.name %>.min.js' + } + }, + mincss: { + compress: { + files: { + "dist/<%= pkg.name %>.min.css": ["dist/<%= pkg.name %>.css"] + } + } + }, + qunit: { + files: ['test/**/*.html'] + }, + lint: { + files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'] + }, + watch: { + files: ['', 'src/<%= pkg.name %>.css'], + tasks: 'lint concat' + }, + jshint: { + options: { + curly: true, + eqeqeq: true, + immed: true, + latedef: true, + newcap: true, + noarg: true, + sub: true, + undef: true, + boss: true, + eqnull: true, + browser: true + }, + globals: { + jQuery: true + } + }, + uglify: {}, + yuidoc: { + compile: { + "name": '<%= pkg.title || pkg.name %>', + "description": '<%= pkg.description %>', + "version": '<%= pkg.version %>', + "url": '<%= pkg.homepage %>', + "logo": 'http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png', + options: { + paths: "src/", + outdir: "docs/" + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib'); + + // Default task. + grunt.registerTask('default', 'lint qunit concat min mincss'); + +}; diff --git a/index.html b/index.html new file mode 100755 index 0000000000..1486cb89ea --- /dev/null +++ b/index.html @@ -0,0 +1,391 @@ + + + + + + + gridster.js + + + + + + + + + + + + + + + +
    +
    + +

    put a grid in your life

    + + +
    +
    + + +
    + +
    +
    +

    Try it now!

    +

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.

    +
    + + +
    + + +
    + +
    +
      +
    • +
    • +
    • + +
    • +
    • + +
    • +
    • +
    • + +
    • +
    • + +
    • +
    • +
    +
    + +
    + +
    +
    +
    +

    Usage

    +
    + +
    +

    Setup

    +

    Nowadays griddable.js depends on jQuery and jQuery UI draggable, so you need to include this scripts in the head of your document.

    + +

    Include dependencies

    +

    Download the latest release at jQuery and jQuery UI.

    + + + +

    HTML Structure

    +

    The HTML required to make gridster works. Class names and tags are customizable but is needed to follow the structure below:

    + + + +

    Let's go run gridster.js!

    +

    Gridster only accepts one argument with configuration options. Take a look at the documentation.

    + + + +
    + +
    +

    Playing with the API

    +

    The API can be accesed as in most jQuery plugins via the jQuery data method like so:

    + + + +

    Add a new widget to the grid


    + + +

    Remove a widget from the grid


    + + +

    Get serialized array with the elements positions

    +

    Creates a JavaScript array of objects, ready to be encoded as a JSON string.

    + + + + +
    + +
    +
    + + +
    +
    +
    +

    Documentation

    + +

    Options

    +

    + +
    +

    Methods

    +

    The methods listed here are the most common. If this is never enough take a look to the documentation generated from source.

    +
    + + +
    + + +
    +
    +

    Options

    +

    gridder configuration object.

    + +

    widget_selector: "> li"

    +

    Define who are the widgets. Can be a CSS Selector string or a jQuery collection of HTMLElement

    + +

    widget_margins: [10, 10]

    +

    Horizontal and vertical margins respectively for widgets.

    + +

    widget_base_dimensions: [140, 140]

    +

    Base widget dimensions in pixels. The first index for the width and the second for the height.

    + +

    extra_rows: 0

    +

    Add more rows in addition to those that have been calculated.

    + +

    extra_cols: 0

    +

    Add more rows in addition to those that have been calculated.

    + +

    min_cols: 1

    +

    The minimum required columns.

    + +

    min_rows: 10

    +

    The minimum required rows.

    + +

    autogenerate_stylesheet: true

    +

    If true, all the CSS required to position all widgets in their respective columns and rows will be generated automatically and injected to the <head> of the document. You can set this to false, and write your own CSS targeting rows and cols via data-attributes like so: [data-col="1"] { left: 10px; }

    + +

    serialize_params: function($w, wgd) { return { col: wgd.col, row: wgd.row } }

    +

    Return the data you want for each widget in the serialize method. Two arguments are passed: `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid coords object (`col`, `row`, `size_x`, `size_y`).

    + +

    draggable: {}

    +

    The configuration object of the jQuery UI Draggable Plugin. See http://jqueryui.com/demos/draggable/ for more information.

    + +

    collision.on_overlap_start: function(collider_data) { }

    +

    Executes a function first time a widget overlaps with a "faux" grid cell.

    + +

    collision.on_overlap: function(collider_data) { }

    +

    Executes a function each time a widget overlaps with a "faux" grid cell.

    + +

    collision.on_overlap_stop: function(collider_data) { }

    +

    Executes a function last time a widget overlaps with a "faux" grid cell.

    +
    +
    + + +
    +

    .add_widget( html, [size_x], [size_y] )

    + +
    +

    Create a new widget with the given html and add it to the grid.

    + +

    Parameters

    +
    +
    html String
    +
    The string that represents the HTML of the widget.
    +
    size_x Number
    +
    The number of rows that the widget occupies. Default is 1.
    +
    size_y Number
    +
    The number of columns that the widget occupies. Default is 1.
    +
    + +

    Returns

    +

    Returns the jQuery wrapped HTMLElement representing the widget that was just created.

    +
    +
    + +
    +

    .remove_widget( el )

    + +
    +

    Remove a widget from the grid

    + +

    Parameters

    +
    +
    el HTMLElement
    +
    The jQuery wrapped HTMLElement representing the widget that you want to remove.
    +
    + +

    Returns

    +

    Returns the instance of the Gridster Class.

    +
    +
    + +
    +

    .serialize( [$widgets] )

    + +
    +

    Creates an array of objects representing the current position of all widgets in the grid.

    + +

    Parameters

    +
    +
    $widgets HTMLElement
    +
    The collection of jQuery wrapped HTMLElements you want to serialize. If no argument is passed all widgets will be serialized.
    +
    + +

    Returns

    +

    Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.

    + +
    +
    + +
    +

    .serialize_changed( )

    + +
    +

    Creates an array of objects representing the current position of the widgets who have changed position.

    +

    Returns

    +

    Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.

    +
    +
    + +
    +
    + + + +
    +
    +
    +

    Download

    +
    + + + +
    +
    + +
    +
    +
    +

    Browser support

    +
    + +
    +

    Gridster supports Internet Explorer 9+, Firefox, Chrome, Safari and Opera.

    +
    + +
    +
    + + + + +
    + + + + + + + + + + + + + + + + diff --git a/libs/jquery-ui/jquery-ui.js b/libs/jquery-ui/jquery-ui.js new file mode 100644 index 0000000000..72e5907fd4 --- /dev/null +++ b/libs/jquery-ui/jquery-ui.js @@ -0,0 +1,25 @@ +/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.core.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.21",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.position.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 +* https://github.com/jquery/jquery-ui +* Includes: jquery.ui.draggable.js +* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ +(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
    ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.2", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array, i ) { + var len; + + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, pass ) { + var exec, + bulk = key == null, + i = 0, + length = elems.length; + + // Sets many values + if ( key && typeof key === "object" ) { + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); + } + chainable = 1; + + // Sets one value + } else if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = pass === undefined && jQuery.isFunction( value ); + + if ( bulk ) { + // Bulk operations only iterate when executing function values + if ( exec ) { + exec = fn; + fn = function( elem, key, value ) { + return exec.call( jQuery( elem ), value ); + }; + + // Otherwise they run against the entire set + } else { + fn.call( elems, value ); + fn = null; + } + } + + if ( fn ) { + for (; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + } + + chainable = 1; + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + fired = true; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + + + +var // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList + }, + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } + } + return obj; + } + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = sliceDeferred.call( arguments, 0 ), + i = 0, + length = args.length, + pValues = new Array( length ), + count = length, + pCount = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(), + promise = deferred.promise(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + deferred.resolveWith( deferred, args ); + } + }; + } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } + if ( length > 1 ) { + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return promise; + } +}); + + + + +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = "
    a"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + pixelMargin: true + }; + + // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead + jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for ( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = div = input = null; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, outer, inner, table, td, offsetSupport, + marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, + paddingMarginBorderVisibility, paddingMarginBorder, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + conMarginTop = 1; + paddingMarginBorder = "padding:0;margin:0;border:"; + positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; + paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; + style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; + html = "
    " + + "" + + "
    "; + + container = document.createElement("div"); + container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
    t
    "; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + div.innerHTML = ""; + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.innerHTML = ""; + div.style.width = div.style.padding = "1px"; + div.style.border = 0; + div.style.overflow = "hidden"; + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = "block"; + div.style.overflow = "visible"; + div.innerHTML = "
    "; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + } + + div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + if ( window.getComputedStyle ) { + div.style.marginTop = "1%"; + support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; + } + + if ( typeof container.style.zoom !== "undefined" ) { + container.style.zoom = 1; + } + + body.removeChild( container ); + marginDiv = div = container = null; + + jQuery.extend( support, offsetSupport ); + }); + + return support; +})(); + + + + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = ++jQuery.uuid; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + privateCache = thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ internalKey ] : internalKey; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the cache and need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ internalKey ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + } else { + elem[ internalKey ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, part, attr, name, l, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attr = elem.attributes; + for ( l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split( ".", 2 ); + parts[1] = parts[1] ? "." + parts[1] : ""; + part = parts[1] + "!"; + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + data = this.triggerHandler( "getData" + part, [ parts[0] ] ); + + // Try to fetch any internally stored data first + if ( data === undefined && elem ) { + data = jQuery.data( elem, key ); + data = dataAttr( elem, key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + } + + parts[1] = value; + this.each(function() { + var self = jQuery( this ); + + self.triggerHandler( "setData" + part, parts ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + part, parts ); + }); + }, null, value, arguments.length > 1, null, false ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + jQuery.isNumeric( data ) ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + hooks = {}; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise( object ); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = ( value || "" ).split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, isBool, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); + + // See #9699 for explanation of this approach (setting first, then removal) + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( isBool && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true, + coords: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + + + + +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, + rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: selector && quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var type = event.type || event, + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + special = jQuery.event.special[ event.type ] || {}, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers that should run if there are delegated events + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + + // Don't process events on disabled elements (#6911, #8165) + if ( cur.disabled !== true ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { + event.metaKey = event.ctrlKey; + } + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady + }, + + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { // && selector != null + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rReturn = /\r\n/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context, seed ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set, seed ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set, i, len, match, type, left; + + if ( !expr ) { + return []; + } + + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + type, found, item, filter, left, + i, pass, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + filter = Expr.filter[ type ]; + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + pass = not ^ found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var first, last, + doneName, parent, cache, + count, diff, + type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + /* falls through */ + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + first = match[2]; + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + doneName = match[0]; + parent = elem.parentNode; + + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent[ expando ] = doneName; + } + + diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Sizzle.attr ? + Sizzle.attr( elem, name ) : + Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + !type && Sizzle.attr ? + result != null : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); +} +// Expose origPOS +// "global" as in regardless of relation to brackets/parens +Expr.match.globalPOS = origPOS; + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = ""; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "

    "; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "
    "; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context, seed ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet, seed ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.globalPOS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array (deprecated as of jQuery 1.7) + if ( jQuery.isArray( selectors ) ) { + var level = 1; + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { + + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} + + + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /]", "i"), + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /\/(java|ecma)script/i, + rcleanScript = /^\s*", "" ], + legend: [ 1, "
    ", "
    " ], + thead: [ 1, "", "
    " ], + tr: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + col: [ 2, "", "
    " ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize and + + + + + + + + + + + + + + + + + + + + + +

    gridster.js Test Suite

    +

    +
    +

    +
      +
      + +
      +
        +
      • +
      • +
      • +
      • + +
      • +
      • +
      • +
      • +
      • + +
      • + + +
      • +
      • +
      • +
      • + +
      • +
      • + +
      • + +
      +
      +
      + + + + diff --git a/test/jquery.gridder_test.js b/test/jquery.gridder_test.js new file mode 100644 index 0000000000..2df25e775e --- /dev/null +++ b/test/jquery.gridder_test.js @@ -0,0 +1,38 @@ +/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/ +/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/ +/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/ +(function($) { + + /* + ======== A Handy Little QUnit Reference ======== + http://docs.jquery.com/QUnit + + Test methods: + expect(numAssertions) + stop(increment) + start(decrement) + Test assertions: + ok(value, [message]) + equal(actual, expected, [message]) + notEqual(actual, expected, [message]) + deepEqual(actual, expected, [message]) + notDeepEqual(actual, expected, [message]) + strictEqual(actual, expected, [message]) + notStrictEqual(actual, expected, [message]) + raises(block, [expected], [message]) + */ + + module('jQuery#gridster', { + setup: function() { + + this.el = $('#qunit-fixture').find(".wrapper ul"); + + } + }); + + // test('is chainable', 1, function() { + // // Not a bad test to run on collection methods. + // strictEqual(this.el, this.el.gridster(), 'should be chaninable'); + // }); + +}(jQuery)); diff --git a/www/css/style.css b/www/css/style.css new file mode 100755 index 0000000000..9d9394170c --- /dev/null +++ b/www/css/style.css @@ -0,0 +1,437 @@ +/* ============================================================================= + NORMALIZATION +========================================================================== */ + +* { + margin: 0; + padding: 0; +} + +article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } +[hidden] { display: none; } + +ul, ol { + list-style: none; +} + + +/* ============================================================================= + COMMONS +========================================================================== */ + +* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } + +body { + background-color: #EEEEEE; + font-family: 'Helvetica Neue', Arial, sans-serif; + -webkit-font-smoothing: antialiased; + font-size: x-small; + color: #666666; +} + +a { + color: #004756; + text-decoration: underline; + font-weight: bold; +} + +.wrapper { + margin: 0 auto; + width: 960px; +} + + +[role='header'] { + padding-top: 78px; + text-align: center; + background: #FFF; +} + +.logo, +.logo-small, +.ducksboard-logo { + display: inline-block; + text-indent: -999em; + background-image: url(../img/sprite.png); + background-repeat: no-repeat; +} + +.ducksboard-logo { + width: 120px; + height: 18px; + background-position: right bottom; + margin:0 5px; +} + +.logo { + width: 300px; + height: 100px; + background-position:20px top; +} + + +.logo-small { + width: 200px; + height: 60px; + background-position: 14px -110px; +} + +.i_download { + background: #FFF; + padding: 1.8em 2.5em; + color: #333; +} + +.i_download, +.i_download:before, +.i_download span { + display: inline-block; + vertical-align: middle; +} + +.i_download:before { + content: ''; + background: url(../img/sprite.png) no-repeat -216px -198px; + height: 50px; + width: 50px; + margin-right: 15px; +} + +.i_download:hover { + background-color: #004756; + color: #FFF; +} + +.i_download:hover:before { + background-position: -158px -198px; +} + +.i_download span { + font-size: 2em; +} + +.claim { + font-family: 'Rancho', cursive; + font-weight: normal; +} + +[role='header'] .claim { + font-size: 2em; + font-style: italic; + font-weight: normal; + + margin-top: -20px; + padding-bottom: 60px; +} + +[role='header'] nav li, +[role='header'] nav a { + display: inline-block; +} + +[role='header'] nav a { + padding: .6em 1.3em; + background: #F6F6F6; + font-size: 2em; + text-decoration: none; + color: #666666; + background-color: #F6F6F6; + font-weight: bold; + background-color: #EEEEEE; + -webkit-transition: color .3s; + transition: color .3s; +} + +[role='header'] nav a:hover { + color: #333; +} + +[role='header'] nav .active { + background-color: #EEEEEE; +} + +[role='header'] nav .active a { + color: #333333; +} + + + + +footer { + margin-top: 70px; + background: #004756; + padding-top: 3.3em; + text-align: center; +} + +footer .claim { + font-size: 1.6em; + font-style: italic; + color: #FFF; + margin-top: -16px; +} + +footer > p{ + margin-top: 2.6em; + background: #FFF; + padding: .8em 0; + color: #333333; + font-weight: bold; + font-size: 1.3em; +} + + +section header, +.scoped { + margin: 0 38px; +} + +.ttr { + text-align: right; +} + +section header .m_txt{ + margin-top: -2.5em; + padding: 0 0 25px 0; +} + + + + +/* Headings */ +.heading-xl, +.heading-l, +.heading-m { + color: #333333; + text-shadow: 1px 0 0 #FFF; + padding-bottom: .5em; +} + +.heading-xl { + font-size: 3em; + padding:2em 0 1em; +} + +.heading-l { + font-size: 2.6em; +} + +.heading-m { + font-size: 2.2em; + color: #999999; +} + +.heading-m em { + color: #666; + font-weight: normal; + font-size: .8em; +} + + + +/* Mod text */ +.m_txt { + padding: 38px; +} + +.m_txt p, +.m_txt ul, +.m_txt ol, +.m_txt dl { + font-size: 1.6em; + text-shadow: 1px 0 0 #FFF; + padding-bottom: 2em; + line-height: 1.4em; +} + +.m_txt :last-child:not(a) { + padding-bottom: 0; +} + +.m_txt .gist { + margin-top: -10px; + margin-bottom: 40px; + font-size: 1.4em; + line-height: 1.3em; +} + +.m_txt .heading-xl { + padding-top: 1em; +} + +.m_txt dl { + padding-top: 10px; + padding-left: 30px; +} + +.m_txt dt { + color: #333; + font-weight: bold; + padding-bottom:.4em; +} + +.m_txt dt em{ + color: #666666; + font-weight: normal; + font-style: italic; +} + +.m_txt dd { + padding-bottom: 1em; +} + +.m_txt hr { + margin-bottom: 30px; + border-width: 1px 0 0 0 0; + border-top: 1px solid #CCC; +} + + +/* tags */ + +.m_tags { + margin-bottom: 30px; +} + +.m_tags li { + padding-bottom:4px; +} + +.m_tags li, +.m_tags a { + display: inline-block; +} + +.m_tags li { + margin-right: 4px; +} + +.m_tags a { + color: #666666; + font-size: 1.6em; + background: #FFF; + padding: .3em .6em; + text-decoration: none; +} + +.m_tags a:hover { + color: #FFF; + background-color: #004756; +} + + + + + + + + + + +/* Gridster styles */ +.demo { + margin: 3em 0; + padding: 7.5em 0 5.5em; + background: #004756; +} + +.demo:hover .gridster { + opacity: 1; +} + +.gridster { + width: 940px; + margin: 0 auto; + + opacity: .8; + + -webkit-transition: opacity .6s; + -moz-transition: opacity .6s; + -o-transition: opacity .6s; + -ms-transition: opacity .6s; + transition: opacity .6s; +} + +.gridster .gs_w { + background: #FFF; + cursor: pointer; + -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3); + box-shadow: 0 0 5px rgba(0,0,0,0.3); +} + +.gridster .player { + -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3); + box-shadow: 3px 3px 5px rgba(0,0,0,0.3); +} + + +.gridster .gs_w.try { + background-image: url(../img/sprite.png); + background-repeat: no-repeat; + background-position: 37px -169px; + +} + +.gridster .preview-holder { + border: none!important; + border-radius: 0!important; + background: rgba(255,255,255,.2)!important; +} + + + + + + + + + + + +article, +.m_doc_method { + background: #FFF; +} + +article:not(:last-child), +.m_doc_method:not(:last-child) { + margin-bottom: 50px; +} + + +.m_doc_method > h3 { + background-color: #E5E5E5; + padding: 1.4em 2em; + color: #333333; + font-size: 1.8em; +} + + +.m_doc_method .heading-m { + color: #333333; +} + + + + +#intro { + overflow: hidden; +} + +#intro .i_download { + margin-top: 100px; +} + +#intro > div{ + width: 65%; + float: left; +} + +#intro { + padding-right: 0; +} + +#intro > div:last-child{ + width: 32%; + float: right; +} diff --git a/www/css/untitled b/www/css/untitled new file mode 100644 index 0000000000..01348d39eb --- /dev/null +++ b/www/css/untitled @@ -0,0 +1,4 @@ +{ + -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3); + box-shadow: 0 0 5px rgba(0,0,0,0.3); +} diff --git a/www/img/sprite.png b/www/img/sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..8f2bfc17eb30c39d770132cf54d73721c9b7eff5 GIT binary patch literal 21203 zcmdRWWmgl!QCym1h?QWK?ZjZFa&o9!9BQ#;KAM9o!S2Fp8W>@ zeX(;+4?W%0Jynm~d!MQvB2|@TFi=TQK_C!@oUEie2n2@?Y?LTSz>%mbCc3_({QqM^E7p_0Db!6WM)AjZR29$ z>EvSPN+F@av)}$J253j{UpomG3sW~6Cr1iR8wU#zJ1;9QD?7)(v+j5hhyo-h`AO3& z`y|KHi$LpjV6BCwg9;8Il>TD`YIkD84?A5ce5MH8w$O$kdJ;|hHhD9BM8i!LH8=%T zNyHQr{cc1So~StLkMtB7LDy*sQ2pJz!LjAB97TSOQ>7m0#MSb07H5gy#8|dxXUQ0P z@0AceK57_(jy|bao~i(*CL8dP{eSA63}gbP{g~N>i-K)+?9p}tHl?jnGiX~XkkS_o z|6S@Qc-#NWv2ZYcTZp0|iyCU1ZNgTX>5)H(m;6E-h=A04)m{+%i3*peuluySk&(%P zh7eadn_^O6INM%Gd-Kh0Ts+=h46g7~Lt}&BMnsee_$^|dYzB9qa=~1*mAgJyd)Bfw!?szjC7_a(yhP>E{9CM#*jsydmx z)E$SyD|_KX%y8`{ze=*%ql7I$?4{g}QPj8$H0W%iYtb1oy6yc&U;J?B;#9a;aV}9lpVJdu57#=SE%t>V8fcv z<{L3XJ}{&^$Fb?epNn^JU0yXIb9ui!prbBP}M znN&9MQpZkllF+hX%ignCl3CQqO0XtkkiKWz8H948IRU5~fem=Bz#p|yoxl~8OehxATDM5fT1H4hTwV3wp7u4x>Gm3C@yLJCPR&zj|KhK=PDg0HrKola*S9y z9t<;*-D9xJXY-FFX$T==OfdnByGiB$sm-=eBE|WpdTfdjVW0CTgvC5s*?l%FM|gVV*x9EOWQEWL z8#6DkWm}bf#PfE8?G{Wm;|QsVXgSS*oz-SU%|@F@$VM|{>BLezFJUX+RG#e}E*f(l zn}C>hSg&Hn>~rkp&k(4f!uPcLCzH^X(?}ums*2*|Rmj4Nicc-42JHbjfv_-t@}qJ3 zs73KRDtio{;L43;zbrKmLB|4yjr)LE&*5&d1m_m2y_|k{IMDv;Q}gcW!r(*0C7Wq@ z()sYk#?e))_txgK&T^9HZ%Jb5f-?{HL;d7pEy0a(FVYbq*-@>0Z_I#~hd{iS*C2he zg%b~{?db-qyWIf(5^lTg3fdsOSfg=e&X7E{{y38i0<JRZDlIzBg(2s_hocTO{tm_w!VQ^jtbr{mFaaT+<~+g*+ZwWGAHX zJ@v=Slg-vn3{9&JP~yDho{T6D(j`DI=?kW2vElb=EHic2|03DF#CBznsO_yn;yx-A zsBvWi-NS3ZZ3&%q_t^n+>y;=|RhZ?~cb9&m@7=b38%i+IyZ=mCPWs^;`3`>>?K;Hp zZO%^~B8-w&YHca;lfeCFtYEezSVPa4JrNZ#@0VU7`0>}|o4z+71IMQ5AMZMnCGE0o zLty^BP8Y_3ozKmNse;OUF3sgm8s^iHua>a4o+7WmGp3RDxOAB`Mitm_(W=~}p@?$5 zYJxhltOD`|s!doQJ@yv{Kq#NuUiE_U+$VohfvI%@I@SvFKT%=pA*V^Q#Wa3y`Nfx1 zqRda-Q%HyY-H*e`be^CHmbvM4d-oRU%|f2)KDfcFTkLni&)z86;U=3{tMk8(Oe4)6 zB*m*v()Z?mXQ9VJs?ilR5w^E-W*h2$N8ax2q|q4zMl?rEtF7NtAEfzvc zp=u9a$VQ6peq^{dzaFe&p`>vf#ijdi=cOPcIC00CTbowr3&Sdlap$NH`ZrjRY*#g&Siya zyK;|JmL&&Bs6lc{Do@m4blNwI8089gj#-nfr_wvp3T%ZA#l7J4=pot=h-s+aoy21m z4TaANZoyY(N;Qciv%bQ@lGl=!vWN6@=~P!r&Z7)+>;;<1ORsHrngvgv!OtpO+ZKWl zJVRXO^f*cCN*@xRwUIT;h#~Vw-@1~+6iS)ZpzBZt;pJs8T{58wU%1~V9^`QLIXVrG?gXIuzLG5aAR)PsulDb_mf?*PDI&CTWZU!*s%8zKK1A%|M}NA-iE~1S!by*_>m7-ii5JmAf+-{BrniR(n7GFvw#3{9xa;7Fev8$&!Bb zcNqS0jrU<;u+!VDCxyMO@$9}N&0qMJukhVJ#%aPgzxxt-D^V}N@{l2i&rpM}svvOpTL()G;>)O#D=tL-?q}hUn`@6vxT~VKKf}Qswj&!b6joq_S zvY!vSh&nGQKtgWQId|Ic`7}WXUL1-ib};X*T(yV4IMHo2%`IHm=edRHe8QYpIeV-A z?yXD_$U*UIMt}Xi5B5~J=6JV**YCYLjH<6{4UPS`VbE755lYI4q3*v4n}IDE<&apb zjG#}M5Z!>yG^CODmH4>KwO>29{Vj7F7`t9mur3btGQ-95l)F-2F6Ro&&seH!szx^? z+AZOCCGxy#(L?W5e`zl-9)1W!LwIv4PIf>NE>@u z&rzjM$xGz{qkC+2>b-m%G8~OykC}&hZ7lzqU7Mh=*;juAeDSHP3g-QHyJFD62M9Wy z@ZfHQ0)deY2|xAwrf8LK`KL;;vDI|6iY<4)q5fMbOV`%6_GVoVX8oJvqE63u$xiKj z$caYq6Co;-zv}X;U(EvRU>o6%+2?MCN+%c})nck6e2fr!!(%4kp?k^rJ8Ya}0hiB8 zJETVJdMR|hJ9kgWXREJ!>%%$#A2H^RlSdIIs#b*09ixc_C};K@R^Z;WBFayyMo&~4 zUbru|rmitf;h}jyhWOs8IF?pS%tjY(HOgS4hH;b_h`!Qb)F#+-wJqzr%o;8Q!af{q zc@qAa#6x=v-7^%LAT|2dZ!`PzU+3K=X-Qhu>njbO8O|p&mnm8h3$l?sp7R(iGjO5{ z^LW9Nu`);h)L-yU(fhe^*z?B?qI5D~&WGRbO%rMaXtbOE65QhT1BdR^_-c4dI=D!B&8t}tyLfr3r4{3s1p2-3A&{H$ znzHxhb)SDt|NAin83UOZ`ENb|+UN(VoR9jK5U8SrVaHQe5hHXjj3u82X%EVa^(R|( zL;CW11l`hihgw-lN(6VUxD)hDt zNWL2Q_n~z-jjW6Rq-Z%v^zVwTk@JP~(!jFwl_k4Aoe=sw>srmka&5z=NS3!;^L*8P ztLg~pEotcLLn(ps_DU#P!u#CMDz8sYz?j0d%vT)mcH5%J7Jty|k6VhZh}4P8#H2!s z8VlfVMn0YRj$djub+-_c2tS!+BEttgxUJ^1dsH(~?`Ybu@{B1X3CEwkkYx*&fk9(E z3r=faW?!@m%4%)aWt{$;!CS?bB(hn*jVyEV(6;ZIiL1?NbqmnwN5U1%KehSSg3E{~ z{y2BT0%CKQv90;3R^9mNkr$LX62*nJGj4@^d)n4#xj?d0f7}Im^yyWD&BW9bNI+mG zbDS`rKZb_B9)Z)OdoLRGO$QLUCV!TlorLi2w^j38;!4n!TNkQ0{3=Vd#4YoUJn0CoAxU*Gn!y$!pvr!P4LJbn64JanQSxOSC> zV6y!p4XyOOGn)ePTs4=rFwW>TpBi6!e5%7WPV{LIs8EN+d&}ZCTYJYhvuUyc!0;+} zyxezGQTD$aU9#>IUNu=k**so;@}p+w zXFvfR41N)5w%-^$J1XJ_2#7T)N7{p!LNrb92s|TXwqalvF@d;% z$W-Lepz1x})@{06DmjdsQHDK9cs}7KCy9gZE1Wu<@q(0G+E_{a7pkMBjT?_v(v4~s zKG*jCT(1}~gc;W0#n&Y7)owif`X+ra1?UNRMP<}AXYZRTUdLCLNxE^Ni9ws93tsMA zid0kU3=wsoonYFIiuy7}kI)k7_4=1f{{^(^Q{PJK%^74^RuXgs{`X1zavRQXq|aR3 zwF&byyL>06;1)SWr5l_TnH;%n=he@wmhYw+P=dUVXAiDujXbuPrK7XHI0~{mzrE1+ z{c@-G)xL&If0;~WXzKz&KZbX&=yV&>+Q4s`&*v#O?0Pv=!;og`0JyE*-eh3KVsUqJd&$eqm54hpC~X;rpkJwWD+Y#>!Yo zzn^9FiDDfK%%WNsMck%7r5>1`#85Xm0;Q<7!P;V#n9xT+8!RcyyQmo@^#5hH=pPT$ z8Wh2{59#I^{rCC6hP%_$cxA_hn?l_yU*HlgHe@t}*Zr?VcS5l*^M*^yc6>gsulfb( ztK4d8DlqI(rD6h(^@mV$?JAbn_1Pp1f(?&qgUM`Z57Zs+FEU`aQR37Y-h?a^*hI(eWn|D2WW`s^1Hvuva0qHvp{Q?UeI9*A0JTaUU#N5y#_UB`uUs`k{S z(AmS`6>F|TX+@LEv-u%ziRTE{(;p&!+r7j|ttEO)96Yivn6p!MQ;)nJbWfPH<#N6p zlZ=NGn+z|%c1q(!zr`>eh`7?^@aa7qH z=ej$y=km5-@c0d>0v0@I-J`7{cJo{)_vg!<=ypC10X|*pWg#6Nh!Tqo1ST@Sw?_ji zZjvL??K7$`>VR3vsy$5!@gSqW$@0c zBRqzxggm+By2ZOjS*uv;=%wa12Dz@Z*xPnfq5$hX-;V<=Irz#!w_&}PeFfM@_fmt` z&OI_1YY^+2|G`awXh6sAZR_{NXt}ufuCkU~X{dwr7~%(hZi}PDUdRcmXwB0_txi<2 zsFsG-N|nnfxo4<&o@Ni#m=W`ijUxHG2LfKefrEK312v+C4;Mu9MqEDI*8soHUt!^| z;-e#ASjBBiMXim+uT`G74R~9Hksi%9tu`MV>O1*;xzInm`P^zUY*3(8`0Ets9y`QNk0>kXby9OyszOw40~gKybVS*}uB8MW7h4k);RAV<3f4Pr$1k zp`JSli(c&jYB1&RQ=tgWywba-<7SZs4A55qvI1deGPz`!_wdq2pZQdvSU9sU9XhM6 z9ria^3U(Fog`N|qEk`4@^A0C7+;&&1Ic@IK+}vEZ{wKpke-hiJEesFsjtq?bZ!O~2 zMgk7noaUj~e^y#k*6x@VC7yvDVA_UD3v*2!6T}qY`Wgw;;r?*zcNkqt{*R~OFr0MkE*cR^ zQ(tol37+ATGqM^_R>ir8^;LgfzpMUBQjp0+Zkth?%dvYGmeAAKrE%c%Fg-)v>ykU` zil9K35IchnZYzXVaFEKrITWQajxQ7H!TrnPGN9v z#?KM)mcopcJaxZ@JsR9XN1U8)qHN#aTQ|DIS!^t{>dW`sqg}0PrjY-DIORil1w=vI zOwy-hjJ)ufBW{@MU5xgoldUo$Hi=LFxglB2;6Dch13+|#V3PBBDb03E6acP7x2tsG z`v63b&h0@KX_oR@n`;x%97%-UJY?_f`~#y9fr3Si{=><5l#uYa(s;?->`dG>FE8op zI4US|SgwL#ht&NbKQ8Ap?x@Zlp32EnajZ)NMiRGCzLXBLjzf_ub}oHBBl({K4edP@ zCSnyNte~~p2CB|S)zp=xeTl&L&Xa@K_E`U&ngCXp~9c{MNBwB{9~}67KopU3E#~^=CaywaK_@rC*XO z8>&r1+_y<5{4jLqd~vZRXwdi^N-1#BKfvO2PT46>8cJ$p-r0 zIhUeWU0#2X_5oiek5!t;UOfCK+q;4M7^AIE1!vOXEo!xFNf+GvGz&vT>6CNS5yHeg z1gi%HEiZwI$TIas=-{0#*lqPQA}GQU|3hB!;}9a7GaR$tF~X*( zF@fhJx)*!(YHBS;FAj>q*wr^o6le2xS4WXX5!+9M`R=BM_Jz7r9}q*{dK@iu@QF~q zTH)&7ovj|-4)kj!Etd2FYRqk`aOqMRNM(Vd6-3zMp3G`(%aTG&(rA zb@42)37Pz`a5YgaaU@`k0bhT_j{df|0X|X61f|-hP9wT)cgI z1Tpkqh{&I}YEMhctWElnZ8BGDm}SZ2Br^eNI1J zfsT`k-nPRSb9^P_eQZIy!st7L$NX^YB3&1Qxwztas>N#Cg(=&pAU~k-_b5?6yXUp) z_U)wY`k8*qI2GwVWtG>h9jkETfa#1ElAFJ{n5EBHsW1og+i@!+hMbW>i*xGI@0Tj9PK+U#Wsu{5BtaPiSk>e=!53Dmn69VD@Xl|oRt1f{sY^R++L6ur zU%M-t;$atA+yzH=he($~x$7=1BzPK0BS<-dUc(KZaZAOS3U)KcX16EHCx&cC4jwu? zaorg1H*|>4-~Md2$$K>|`BPIem})d_`S|&}cHeUYT=5pXL-*nZa0QaXlf!7lKr18w zs9WHJmbOH|>DVwUJ?Y1RWaMl;p2xF!9j|sH3y}?>k@@F@M_{gK@BOmpdd%)XF;Mr7 zrhYfg_yNo*;u8@yG4eC-#5;EQI5r;-RPf#ooz9~FGS8pq(~LLm->q_PJ)K$0)ay2|}XZueYvy$KaHgq|QK@JiY^zc~=YzSSc zGv6~NIXqNBMGF2rb>ZA%I19`ybXmF|wH~HDojy1Eoe36}v5nb;hHcp~~lrHeu(qSaqDoQ6zoN^_#8JKnbUVA>y*)M}_ z>(OhmCcWCEP90-;$raetq(gIQ?N5<{9HA2`XLBzzxGH=)v~f5JS1Ljuw)b!^_IoWF z>jE;`1E5(a(1pl3aiX0js0saaa{jD!tYZ?u_&QVk7!%KEP6HR$ie#mn8`!;y&#F+G%7{W?BMa{JxppY-MrI)Ra2`4EC` z)vJ%&OWX7{tvG_`_W^WO+^xvp5P&+Tx|!bzv)=PZqU?Sd`@uK1r{;QHAFy@@O@-ui z?_Y(22E(&XIt!syQu4vV;-YH4fB#Y{5_uGXTqB$4csAR4A8sibBFQKIi*LklW+XPs z6D}i{W|Bi)1tXOJ3-*UJaFiUqcP5KlPcDATS0?IG=l?znAnftyCmQA_i*53rR!~*g zXCF>#=?zPfPd#jpYHP5|D;b9@HNB3nvq+C)OPp)_b9GOW(pKmc4BR^>bgT3M#vcN! zu4GzbbwZE4!Sa-UTkoYX=+Yn+VWUlU+Cu!y-0K%U=x2IUlrt^*=_O>o7K>E6cJ)5U z->(ta<3U`TJYQLftJ(>9*tmy9_qX?b~N zsG#`dA*z2LE#;Pqa54?5=@OAkvV%Kbd+xn7peiLL<;7g$pH zC;rd<`FJ?@Kd@m7Hg)$!h5Ymg}3^0=UgW4M)_Yh+H$?D z@$?ET3o@_NRo;z7NJ;+lg1qgf^_VjqLX>!%!+pC0DksWWL$7`e#m%K~7nB z3S#CdmdKkJz5>~uX+;-4KJ_fPx3sFc?%9DIy$#jNct05=pOL2v3Yrc!y@3^vBJ^(mch;F=4Ez4*2 zmrRY_k4D3Ztp-LywcfHYecM>QMZ)0M;R1YQ?z=@Y%ZL3NTN1*^>r_EPsu$}MY$k)PUP?ME!e=T3Dy8E_t zuZYO_LEkP5YFC;TZYX=Wn6|%QMW;eHExDvXB`j?zB*(aypXpSt4VLC+&f&_5Wj;Za?zs$ z4QxXs$<2gM<%`=+obAOLsYirJVmiV#vSzyky2MM6oZaaeUTpfBDZZ6v18=W5Hfa-ue$noWi%1arr7_;> z=27!i`(P+|1HtmJW_R57lK?I4#QXs}F(VPj=BW%DIA*a0FP0s>!>P_2ehxG3eNC?- zzx;8;JE`|29caud;z#cqIQFZXl+OGbTur0PRb?{>(ZkZ=_!voSsZ0kP=q|7oZ{WFm z>JtWI`}0c*h&hApJSN}StZKL8BzW9KAFqzIb2dCROqwkI=wkU&Ubqcbh~3Rd_S@%?o@Un^%NWeBavh%2J(*DD`k`Ecjzac%*j%KjO>aOcJ7h z$otxZR*O4f>qn=`Q{DJy&^quaRe}m%lPiwOY=OoUB_Io<4tG#~xsgiSC>C!;yrpW& z=_82@aqWIm0!o(j1V~ItY1}GD(DOBd0t@szo8MKPwRJx~ zAV|K+l|g{Mo{GBY=7!-x=i|I`1jckof@MK$qROQtA=jkSl?1djU^|lE6vOK!+iSw z;HUvL$;wu0Ju}n(r@tS2E0xMOjB0q*7zlxKAPgLQT}3kR4Ia5#PDQ1w`@|!+k4;ep zWCY!_gL8xbY|b&gUKwMTadODeFMbrb!@EOIk!FaC^d;DIbjjM$QG12fLkax~6X8wy zK}h!xsEPH?U`cVY(dLC03vGm5O3jqr*TeEEyYPVkjo2vJjY6^kHQE2unSp85r!E4$ z;7K|k5*#jn|B2wM-hk)#z%tfE(sLpTEJTiGnbRM9%Vsf?(Jaq0NjzLn^+8cLvq zR#q~lkMLMz=w(Mtq%deCMMp&)5<`Yn0|48S&&ki%7>la-__U^UspaS`EOZ41#>W|2 zUM9__e#yo5hkEa3;&+%+_=6#GreIpF*U0$zEvZ_$U|E44O| z7s#t$n-qOfG>nt|FT2Q&2qvPxA?{Dxhzr(T; zANZltvNCUGFuJ4GaJ5`{?;v@g-^U=ggR3b8*7t$iLx~3gU4ifuR~Tk~fo$MqZ4C`h z^SR2;9iYOf+!S{60k`s+nn0=7g zue;NgrlHZNiNM$Cro6n3DpmS=4ei`TF^Zp!jg7Y(Gzw{M1o7_K_ZL(iXb22yL38;c7r zzQ4m)gh~QnKS>g!X@(sS_ZyvrYu`De(w7bVg;wc17sND!tDrfH$H8Y-u@m(5^xLAMC1K@6)jlI1eFFxwaVw>lg6Z1c*0}9Ed-iYQXLm=-$@-{D# z-+YS|1uPY27Pvqt-Q#lBafcZ?LXo|82Akcx!lxVfDt$@ z19>w#B4og#b4#FOkoaSchO#du94^&=fK5?cTYHYUzrWv@hL%?OYuic)^P>0xMc*Nu z06M6!xENa4c(L9cQd7&+_PXTM<*()d_-W=i2?4NK=hJB$nu^dxUp4TAjN1nZ0ngKA z9cI4?sIU|Idx3ht{wRVfk`hUO{}-NA6BQsgVcdbQ&*K12)Qo-Su4qfdK+Tw$(d5p$ zzgr9Js&8p|5Cx*sN0E8Oecmv=EY*er`~GAvH?Y&>cMx0-FqOsd7kWyAn+>GnnpUtd zKxN-W{2#CX%NqXCH0J4Y!ISUrX!@=r^?~}JPS4BT{RUH4sEmY!q?3f>i|oT(m3|2I z1s*Q$ubG~T^72N~BEwF<2PzO;g98x$)O2+5EiboA^RMT# z|J%soWwf@h0V=u00JHr#2Kq(2$jbH)wifVoB5pnNUd+tEVA;JFg27l(St&G6&niDy zWGIwh)6$Y@E!|D2sj>_7Q=lMp-Z;>|ztjH-`gc6r6nBDeE5`Gzc`NQq1yT|&I+A%~ zlna1|1jtxqOk5FZZp+St%)lspqL^Z$1_63Rl(<1nO-q|Qv}8p)2YJO0nwQ}e6&HKF z`Q5hSxN;4EmcRSe?)XEu$=7ggV5x74-1oSa5hc2Dd4J7&FQ->~Ix53<42Vx?i~rMY zmPB4cF)t7Wk0(uQA|u6yDIW5Qh`ncbXX%zBN@rf5EZuR&54uWwdq3<05Ua+ltf!|J2x=eQQLh`PSsa58N>joTIv3;VWg8q4 z$@!8yW-*$^T~Rch-_qhO#|AcFe5wQNe94A3|nVh zTwLYk7lkt#{-}sDljEhPGops`zP`T6ot+(DPEO7SLbt@b7T3Mk`{TL^q`Zt(3otDU3(FttpGkldzVCaqsqg{)mtoTV zDaL6gA<=6&$ujGx3nVTlh|R1o!czqHe8ug#;;w@d1xZUxbPfbO@};ygcW8Wk1#6uE zyfs4rJ)0?;HUv665lIK-bNQ3a{~ZV5xnlYSF&lF;9~#{@4~L(%wY7cndLgxM<+x%7 z*zSQroJOpj@pd#1?YLb0hgB57gx;G^*TtS|{!RFxwZDJQvyA!@Kgbj>``@iR0Su<2 zCnaG~Nl8OvL5*^#V8VFa&LL+#Iy(9}eRMXQqOEwgLMKpGouz0C2d#VEf_yB4eT$*$ z6DM?!^dv2BCqLT!?bI-gzPtkk|PH0K#O*6yiU;pf!R(z=>j#i&QqMq8`mv`Bs;e9cYxIL}diPPFLET{)~+H zXneH0-k%h_J6kgbxlgW7Pfz2)ou?amEZh<>YG;$9Am}l}>-^ond+J&SqVz<+(S9;J zPTOtPjkIRzWH%S!SQgtQ@w~s3AbLhd-$no(@%Cq4&Nq5_0a)&=UM|$(DKhUq7s7%> zj%cS*|2cmK067&ayT7LERp1v8r6Z1^3r)5S zK8@P|QF2~hUP633R;vMhlgep1c7Jw#Fntuu;d4DHlkC)X(%5})a6soJ1dS1+Q1##c zn}=aO5c63_Tf4Yb_3-6x?abvr%HO~7nSS$4OanmNxe1Y{;}U?WOZ136hm&YlCWNjO zdHDHT1VIQP-Kys1TTlRf99ypb2=cnVqhsxLH2(tn0jRUu?d@&kRMNZS1oI$L}}?bdWs| zB18X46Jq=)=-$I(ety1)l$6xX#~u2+w(qgsA}LR#9bQ<5SH zDe0PuqGG!QP9+VlC89b>&itTg8HPW#AeZtKYUDKY<3y)ZiSq^gr6C_>> z)Lbo~LKU8%RT4EuI8D$w+&Me?R^4Y7P>?BDa3O(Hh?R)&FtP~E&m$`JkO6=j@-}%5 zdd%Nf&-9=IP)tMStO2M9y*EYgC!AOcqPZ8e;HGa1G3|%}$G;m4O~;^+dHxbj&i%1Z zg*b?V$xszXxPbmW4s`Dd4qyD~&^A>b6b4+K@e@%j1;O0QNF-lZ1!yJyoq{KLGC!u} zr_q5tieoB`Md3T)h?O`q5PX4wCV$YIq*HlK1c`l*zDg+dO6vYw$hsUpXb3sMQM4DO z94-Y!Ukn|D5eiKZ!8h{`^mh)iDSk6T7zFxflr@8=K!iQ3(bH*yBCdw=^unaREB>|O zqnRdI5yrZ=2z+oj@kvD$;SR`!7*eLbw4Y&uK4C}n->6z|Qhu_4#ih_dirl&XaH4*? zeKI9YRf?n%n%D!;hh6!5)oH!~_p>Qxx`ccPW*4e4oCUtidQPL~yNO#+l)3cM^qx#6HZk#sCB5ToD z6l{A20tZ*5Zb7H?8+?c9zU7{(4R4x=72PmmOA{|6%rurECp!uH#`8~m;+k6e;c8M7 z=Cc!|%oZZ%&${>q+&%JBtN9N6X{e5|SOPa=vU1V~Gss`N4_<&4-g5@{tgp-R>b*Wm z?s5pT4AM{dX#B2}ibQ3Y>#B>a)OD0C8c|HqVSV~{Ymv{UE!xT9Rw_)MawwJ(e$yp- zglLh@tnE=rtp5M|L}jdLz43&2Y|G5_zHY=3lQv1eIZF#6i0!7>E z%s}`5Nl#_?`qLohy~n5fz^r_Bd2RvUmp-8Ix#?gq7Ep$^_LE*;JcoRAz9^tQdeaChFRPBK22eNQHP+j62ka$dpoI6 zlc6TKo`A&L-rsmWTUAeIl3IrE<-49%%d4sm%S87X&}luWYZJf<$l`)Xn=VcYcG&Wr z*Lh!8#Wjx?$Z?GLoG4NEm?anHqQ2@%yKu;tD1Y*C!39yk!gQz_vrK+i*YSt$tfn1i ziZT&}@y34gXsV1j@5vhYabC1Btw7LQrl(H* zegd7522S_Q`p1j9J~J|pOv<@$Q=JU;-`PI!6N9Ko)X!L$yXxAcd43*Oe?C{rin`vW z)|{XHaMw*$k*@|W-~u7wfUqfJQlIn!bdF>3$D%r(5}!T4&OGoaEeZ_&jcETghdaRyXo6)6#Kj+m2+1&7@ef$ zT`IT$TjyZMu4132Qb{y7jkpLabUl%UT@gyh$fP(_q5G<9HMmzz0lQztxqLX&4M^2g z+yS7_L9rvK1X8RYz>L@pZ;^{+3{xrVhOp=3DSf7_DG^F1w~xR@AlKmroRB~TZ5U`b z$u3c_NS4!3IoCc#Ip+-sFxFsc{+S8&Z!W}O}x zQ9!C)uO@p$R$Z`{QNks1(gRMjA!xGKmtw?8Y>yf74@NV-9pU2aj}Q9_O&(~7p^g#T zMwj1c53AbT%}!X6m!xJb@FdDpNaMWt1gzT5XgH)5{#A5D*p6BgsgE@QiRWA{mD)$4 zZfcf0e7rr4-|w}ert7_%mfp_(E9l4l-aYQoUiS3&Yw5o>a@Q^c0`^g}V1s%C>RFs( zb%*2?Zbmc3;__t!&rqly-|4#ljZBXy zan5pFYT9^jNQst=M7DGp5MK+1%A9?5Fy0nOlp9VLxgX($bc6w!IdsoLOoOF}jwTJ5 zdHl8QtRxo4j!Q8K?L+t1Qs_gkOQPVHfl_gWXKbO|hnaUHwilRpw{lQQxPG5cepg5~~I+vWGLLlmYD=}Ay`A-+?9hB(P z%;)hz@c-zejM;rg{QhK;nCeVau`Mr}5(0f_tV`>o#2p?5;$I3Rf%C*L{|ru(Vy9h- zR0Qk>`2S$TaTth#lS)S}g+>YI7|w(5VN+!qJu695Wmx|{SJ}3D9mqt7Q!2jjIo}!Z zgr3Uq>k*c3zoEw|(cMXj+R+Y^lHR|P+EVUxL!Tg(BEOq={JQP92iTFm+4f7box0am z#!zQ~!+Uw1z%|>dU`g{j(c|(845~LMHK;*^W{je3Z9 zB%}pfd5+pPFtu;LMmAq&b2_A}c};`A7ziu7wi&RwIHVJ1s)RAwQ$Y4CB0LjEbmDj6 z>G7o`QOKdZ%6{dwehD*l)flx;ZZ!tI;1o;+X?gXEpXG}_GM8y-dQHePhlSdnjIs)Q z4cG`08SkABzwssUZb*EAPlvK;GB7ggKd03Uj3KL1EnbI%MRg2D6P>32tO8lBWTg-% z;-b9o(46GF{0_T?sL+3buN$ypM8BkM)6CJ}r*GlK-_nOz zayM9>%L_T8o8@h@)9!Qe`9O`;JM7Cc)xYy^#70w&ZRGFNevu2K=H)P9mv4c^dntxv z(a-!c1w!)3kS~_hfx3>mnl61eD4Fxm?>i4PdZSwb*6IP0>q~@=o{hJ=@3$|Oh1&|o zx|$<>H#Ffy9g)inQX5i+0O=(N{tzwiYn2<_iA}JS%kGq8lsOI;~>@b@?4WM$v75kZ6yWj7^;`HhUS{0|ng^dJXpu(Q<2t z*rMpbP*GOU7`iy>E62eR8{U2uDTiqNgp9B0NGdtlG4{xpKmN(Aa=RnovP!h#RG7>e zjL+r(i14A!j%fROn8yVsmliHyr1IbC+G?+7UEp+QE>FJMnFxTaY=?isjt)XiQY11? zN>%ILG6$Q+Z+N$0GQW;^{3eO=|A@VXET>?mX7Jdud-w<74Cilr(@BCwL)ODyh@WZ+ zBAkV3YU#n;;;!yi9`j6FBYsDY_ z8Z?{_*C`4g4O@W=Fi!K-MG!tS`we(q`YIL)YQZtGazs(T2UJ_%X}F8Gu9M`R6muv2 zwww*=;-Q?qvdO@0K{3<=5#HK6QZ$U8FS5lWqUT7d?{G{w18R$9%#R>FUSUz zSgWUdnnRUXw_T6B@|m+I>PJ&)gftfV{`2tI+*89=fRNRMKJ7#Hg*#P0(Ev1v zbCV(zgE~zpJw@8HQmPg4>ae}QGp)mC0^iS%y7cS3yw#`j(Ys)Qx12zaeng&R5D-c| zKo;^oNjHdF1Z|u0Ip1`0_&wd9w^K<4nZ72A;Xg4jM zNe2cZ2OgcjQ;0O1Q}CNUBWtIYM8l&T{~d=Ai$tKfsk4C&irF`$Yt??7vjUZ^_f58o(&gHfLzL__e!wineK@T)0)@paBEXGSzB#=ah<1;IiY! zmDos2i4hFLl%f4xfhz&ziZ(gR(gp3Vo}x{DG?!&!wW@FK%7IgWNiv{<^JN*rWtlX_z5f*hl6h@6&L5{Z_F z?>b2}B$sD+UNKsp%UKCw<)sh8v}u`Y!xq+bD4)V*hU2MVbX>&uuoffwGYjPa3P`3- zZOxKsAv`7`X7$vXI+dfGC21`f033RxzmjSI*;u-uO58DJs>&v8%aMKT?z|!_T~KH< z4@x_L=lOgH%axtJC!-QTA;T~wCTs!VuwY0CPscArlcG}>UIbNZR z95^cuN-D8*LAJwrQrZ}v=SM*p)3Up6XfA+KhG9(4o<&tKBm~dev3gpWB_tCJ0OH-J z>n$3nhcqf2i{~5;A|1@3bWFtViuB2b_IV}m{`zdK*hGv3Lr%-v0CQoYo+RB4J;((^ zFw)7Dnz3fGxNwX@q1Zq!8v23(IK5;%R?sEj6pBO01;hA>TSCL@NRJq!VnLxq3DQUO z6`*5?#$4FD{g^_b=wRF>k<-4rC)Bf`P@;gjE{PnWK~8qo97mW;#ezbKKIS|O31P~$ z6fu4UoC=i??y#d%rxZ$*FgHu0M|4(%l2Qbq*vvY33WZ`G=L7?g?ma0)?8Y|cqUGJK z6bdEEI4c+uf^ZZ-xU1CZH=b2Pc%DTu6$%O^wnRrT}Dr%))) z5PiXrBX}Ot&1Kopeoa7y_|d-2okF3+oY)Emg+l4jSYL-hp-}#(p@Ko7P>A`T6AYGR z2eK@i+17SYC>@diDZyY_b|i#B)vw#y77C>!@;@aQ5N2Tjpg+s9$!%!}h0+nx6%3YT z?`K(dLadC50b9gx2EcJ`X$XbV5z!P3mSy_^cpkucu`?&Sa2(eRK)Uy&OIzAPp>#y_ zJd88N?>}Q|nm5OacA>28;1i&-^ZnTWW1jO$e=dGqtj&Ah2B$8l+)Hbp# zI}ku$j^h@{!aM*HIF75;%9Lf<1OWE{7!Kfbj^kcXiQ|Rva$1IE+0QwS+sm@-0|0IU zFp}fAodBK_^8kRmAc%v+GXM?%xE8=|VwiF)X0Miw6zk0Hb(Q?xxn@~%$M(geoV17H zEP8^`YV1OsIoSrFJAm&2Yyhxe(4aw#%jH@O;4%PimSr0Nd;wqr$8q~)>3c!wCS;32 zLjbfA436XcEXytdFd9IvxH5CPxH*qy+4%q_$&wr|E29&DvjDsapdWyz0PF*>QjF3B zUp-PEyr=aIF4)7*)NpnP~O%CQ0x(Ld%M`BcoM>s!Q*A| zCIHA1w_OF`0|0RVngMj>I4f&$Z=eMmSuMU=qZM00r&{OATiEj08eoow@H?7 z9DrUN$Ng@3uTeCa-Rmk|5mXIfIex(%+ZUJ3?sZim^q&KJ{2kjDSI7fcmMwaU55o%v8CJW!Vh0JRwec$kP%4#T>`^#5g(P|GA31asU*I<(G(g6+?Jv zR62x*Ka~O~l-hKVvg`{0mO=0^ zZiLYNkPNyEz;mKl^oHO$NaeTkGB}Q_2GA&$u}Yj4{T@Iv1dl@UI`)g-Cy6J|*<$%Y z0238r;R3(`*ut{xQL`Yeos$ls3p#3cudDJQG!Q+qRl;&0oWO;$PX>TLSeDIK#8XSJ zw#^5jk&WUwj)8E2D+91nY_Jf^xImtXcrN<@RLB~zPqJOiD<8rIPTmNmyySI|L?#?h ztWPO~2F-~16#yt;S+)e~6o_?Gdx@9YzAFZhFN%qlZ9cKgGEoo#M2=y+3c=l92HfEgUe1tFXi zr$QLetpp`j^oDRUkAiSATA@O^@{9ObmaPC#%(85${0eP^cty?tkRzoNzYAqocb`f+ zNh}IwSLa*+138WhU&T3&^RX;j2*Jb6m*=6V1H^W<7(xTi2JjYuq4IcQez^cDSeDI~ zdm1dujuPvV51@o)*$kC^q1<=!a>F8{5~mcRcL?#gxx@{9AdCy_2QXUf?++8xWsBd^ z%!eCd1LipHTaM%Quq=BigoeKcf(O!1jCX~Y<}3(Zi@^{Yxa46-V;ow`w3Ec|rQ-KH z05$`d#&Mi9izCg_Op#p~3IKcs!E>1ops#4}K>+6f=)-Z`4vjJ?&QlKIJSv9bifsp} z(LxX+GmL`JooFR89LMEy9M>v8nOGFa$_2#90fnanj^j#2?|=kp=|Vn$a%IC6^Q(g3 z>E|mpkq0tko=9URBiL2Uf8N`1z% z>@xrcK$x`w$8q%lE?`;qGyqK;$8C|tU#n3TC3@uEv3+qBfSlRAuF8RM;tzBv?=on2 zL$r|GZz9ACQ7Iz3Apii5X8vN5`C=S--KBwK>GL95k8`M%Sqklapjsv%dKetXeIu^o zj0=TA8`rO2&x_$r03MeWbct53Vw#ACFLqs&-4{7M#cwsQg>v+e4xn^)ud7NS^qVu# zGRvx zmp@0o210D~YU>-+>X8FsokgkWnM4dUit+Nrcv5&ifF&w38x;WVRnDfUU^uHJ+9EHr zWm>h3`uc;#?`>^RHYIi}fpFrD6+f$>JzG+t5uUGDA2ASuSjeXZOJviJB@h}#wpivk zNm#^b%5f077o*T}g&zfB#-T*3A{@t6iD}kLECO?isAX9ry!kMWf0a)R4C$=hz&$q z$5000DqkjxR)&^aB;;w!Se6|m*~D>NfjGb^").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
      a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
      "+""+"
      ",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
      t
      ",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
      ",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
      ","
      "]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
      ").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/www/js/libs/modernizr-2.5.3.min.js b/www/js/libs/modernizr-2.5.3.min.js new file mode 100755 index 0000000000..10ac67de11 --- /dev/null +++ b/www/js/libs/modernizr-2.5.3.min.js @@ -0,0 +1,4 @@ +/* Modernizr 2.5.3 (Custom Build) | MIT & BSD + * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load + */ +;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function L(){e.input=function(c){for(var d=0,e=c.length;d",a,""].join(""),k.id=h,m.innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e});var K=function(c,d){var f=c.join(""),g=d.length;y(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch||(j.touch&&j.touch.offsetTop)===9,e.csstransforms3d=(j.csstransforms3d&&j.csstransforms3d.offsetLeft)===9&&j.csstransforms3d.offsetHeight===3,e.generatedcontent=(j.generatedcontent&&j.generatedcontent.offsetHeight)>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",n.join("touch-enabled),("),h,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",n.join("transform-3d),("),h,")","{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join(""),['#generatedcontent:after{content:"',l,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);s.flexbox=function(){return J("flexOrder")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){try{var d=b.createElement("canvas"),e;e=!(!a.WebGLRenderingContext||!d.getContext("experimental-webgl")&&!d.getContext("webgl")),d=c}catch(f){e=!1}return e},s.touch=function(){return e.touch},s.geolocation=function(){return!!navigator.geolocation},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){for(var b=-1,c=p.length;++b",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f Date: Wed, 18 Jul 2012 19:07:59 +0200 Subject: [PATCH 002/248] links to downloads and others --- index.html | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 1486cb89ea..38fe155291 100755 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@
      - +

      put a grid in your life

      @@ -46,7 +46,7 @@

      Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.

      @@ -153,7 +153,7 @@

      Methods

      -

      The methods listed here are the most common. If this is never enough take a look to the documentation generated from source.

      +

      The methods listed here are the most common. If this is never enough take a look to the documentation generated from source.



      @@ -196,11 +201,20 @@

      autogenerate_stylesheet: true

      If true, all the CSS required to position all widgets in their respective columns and rows will be generated automatically and injected to the <head> of the document. You can set this to false, and write your own CSS targeting rows and cols via data-attributes like so: [data-col="1"] { left: 10px; }

      +

      avoid_overlapped_widgets: true

      +

      Avoid that widgets loaded from the DOM can be overlapped. It is helpful if the positions were bad stored in the database or if there was any conflict.

      +

      serialize_params: function($w, wgd) { return { col: wgd.col, row: wgd.row } }

      Return the data you want for each widget in the serialize method. Two arguments are passed: `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid coords object (`col`, `row`, `size_x`, `size_y`).

      -

      draggable: {}

      -

      The configuration object of the jQuery UI Draggable Plugin. See http://jqueryui.com/demos/draggable/ for more information.

      +

      draggable.start: function(event, ui){}

      +

      Executes a function when dragging starts.

      + +

      draggable.drag: function(event, ui){}

      +

      Executes a function when the mouse is moved during the dragging.

      + +

      draggable.stop: function(event, ui){}

      +

      Executes a function when dragging stops.

      collision.on_overlap_start: function(collider_data) { }

      Executes a function first time a widget overlaps with a "faux" grid cell.

      @@ -292,7 +306,7 @@
      -

      Reminds that gridster.js depends on jQuery and jQuery UI draggable. Download the latest release at jQuery and jQuery UI. +

      Reminds that gridster.js depends on jQuery. Download the latest release at jQuery.

      gridster.js

      @@ -354,7 +368,6 @@ - @@ -367,10 +380,7 @@ widget_margins: [10, 10], widget_base_dimensions: [140, 140], min_cols: 6, - min_rows: 10, - draggable: { - helper: "clone" - } + min_rows: 10 }).data('gridster'); }); From f650da85862d055d7b64e9fada53311c8baee572 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:44:03 +0200 Subject: [PATCH 029/248] fixing tab spaces and some documentation --- src/jquery.collision.js | 282 +++++++++++++++++++++------------------- 1 file changed, 150 insertions(+), 132 deletions(-) diff --git a/src/jquery.collision.js b/src/jquery.collision.js index f981d168df..9d4cee172f 100644 --- a/src/jquery.collision.js +++ b/src/jquery.collision.js @@ -9,198 +9,216 @@ ;(function($, window, document, undefined){ var defaults = { - colliders_context: document.body, - on_overlap: function(collider_data){}, - on_overlap_start : function(collider_data){ - // console.log('the element START being a collider', collider_data); - }, - on_overlap_stop : function(collider_data){ - // console.log('the element STOP being a collider', collider_data); - } + colliders_context: document.body + // ,on_overlap: function(collider_data){}, + // on_overlap_start : function(collider_data){}, + // on_overlap_stop : function(collider_data){} }; + /** - * Collision - * * @class Collision + * + * Detects collisions between a DOM element against other DOM elements or + * Coords objects. + * * @uses Coords - * @param {HTMLElement} element An Attribute name or object property path - * @param {String|HTMLElement|Array} colliders An Attribute name or object property path - * @param {Object} [options] An Attribute name or object property path - * @param {Function} [options.on_overlap] An Attribute name or object property path - * @param {Function} [options.on_overlap_start] An Attribute name or object property path - * @param {Function} [options.on_overlap_stop] An Attribute name or object property path - * @return {Object} dasdasdadasd + * @param {HTMLElement} el The jQuery wrapped HTMLElement. + * @param {HTMLElement|Array} colliders Can be a jQuery collection + * of HTMLElements or an Array of Coords instances. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {Function} [options.on_overlap_start] Executes a function the first + * time each `collider ` is overlapped. + * @param {Function} [options.on_overlap_stop] Executes a function when a + * `collider` is no longer collided. + * @param {Function} [options.on_overlap] Executes a function when the + * mouse is moved during the collision. + * @return {Object} Collision instance. * @constructor */ - function Collision(element, colliders, options) { - this.options = $.extend(defaults, options); - this.$element = element; - this.last_colliders = []; - this.last_colliders_coords = []; - if (typeof colliders === 'string' || colliders instanceof jQuery) { - this.$colliders = $(colliders, - this.options.colliders_context).not(this.$element); - }else{ - this.colliders = $(colliders); - } + function Collision(el, colliders, options) { + this.options = $.extend(defaults, options); + this.$element = el; + this.last_colliders = []; + this.last_colliders_coords = []; + if (typeof colliders === 'string' || colliders instanceof jQuery) { + this.$colliders = $(colliders, + this.options.colliders_context).not(this.$element); + }else{ + this.colliders = $(colliders); + } - this.init(); + this.init(); } + var fn = Collision.prototype; + fn.init = function() { - this.find_collisions(); + this.find_collisions(); }; + fn.overlaps = function(a, b) { - var x = false; - var y = false; + var x = false; + var y = false; - if ((b.x1 >= a.x1 && b.x1 <= a.x2) || - (b.x2 >= a.x1 && b.x2 <= a.x2) || - (a.x1 >= b.x1 && a.x2 <= b.x2) - ) { x = true; } + if ((b.x1 >= a.x1 && b.x1 <= a.x2) || + (b.x2 >= a.x1 && b.x2 <= a.x2) || + (a.x1 >= b.x1 && a.x2 <= b.x2) + ) { x = true; } - if ((b.y1 >= a.y1 && b.y1 <= a.y2) || - (b.y2 >= a.y1 && b.y2 <= a.y2) || - (a.y1 >= b.y1 && a.y2 <= b.y2) - ) { y = true; } + if ((b.y1 >= a.y1 && b.y1 <= a.y2) || + (b.y2 >= a.y1 && b.y2 <= a.y2) || + (a.y1 >= b.y1 && a.y2 <= b.y2) + ) { y = true; } - return (x && y); + return (x && y); }; + fn.detect_overlapping_region = function(a, b){ - var regionX = ''; - var regionY = ''; + var regionX = ''; + var regionY = ''; - if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } - if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } - if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } - if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } + if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } + if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } + if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } + if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } - return (regionX + regionY) || 'C'; + return (regionX + regionY) || 'C'; }; + fn.calculate_overlapped_area_coords = function(a, b){ - var x1 = Math.max(a.x1, b.x1); - var y1 = Math.max(a.y1, b.y1); - var x2 = Math.min(a.x2, b.x2); - var y2 = Math.min(a.y2, b.y2); + var x1 = Math.max(a.x1, b.x1); + var y1 = Math.max(a.y1, b.y1); + var x2 = Math.min(a.x2, b.x2); + var y2 = Math.min(a.y2, b.y2); - return $({ - left: x1, - top: y1, - width : (x2 - x1), - height: (y2 - y1) - }).coords().get(); + return $({ + left: x1, + top: y1, + width : (x2 - x1), + height: (y2 - y1) + }).coords().get(); }; + fn.calculate_overlapped_area = function(coords){ - return (coords.width * coords.height); + return (coords.width * coords.height); }; + fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){ - var last = this.last_colliders_coords; + var last = this.last_colliders_coords; - for (var i = 0, il = last.length; i < il; i++) { - if ($.inArray(last[i], new_colliders_coords) === -1) { - start_callback.call(this, last[i]); - } - } + for (var i = 0, il = last.length; i < il; i++) { + if ($.inArray(last[i], new_colliders_coords) === -1) { + start_callback.call(this, last[i]); + } + } - for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { - if ($.inArray(new_colliders_coords[j], last) === -1) { - stop_callback.call(this, new_colliders_coords[j]); - } + for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { + if ($.inArray(new_colliders_coords[j], last) === -1) { + stop_callback.call(this, new_colliders_coords[j]); + } - } + } }; + fn.find_collisions = function(player_data_coords){ - var self = this; - var colliders_coords = []; - var colliders_data = []; - var $colliders = (this.colliders || this.$colliders); - var count = $colliders.length; - var player_coords = self.$element.coords().update(player_data_coords || false).get(); + var self = this; + var colliders_coords = []; + var colliders_data = []; + var $colliders = (this.colliders || this.$colliders); + var count = $colliders.length; + var player_coords = self.$element.coords() + .update(player_data_coords || false).get(); - while(count--){ - var $collider = self.$colliders ? $($colliders[count]) : $colliders[count]; - var $collider_coords_ins = ($collider.isCoords) ? - $collider : $collider.coords(); - var collider_coords = $collider_coords_ins.get(); - var overlaps = self.overlaps(player_coords, collider_coords); + while(count--){ + var $collider = self.$colliders ? + $($colliders[count]) : $colliders[count]; + var $collider_coords_ins = ($collider.isCoords) ? + $collider : $collider.coords(); + var collider_coords = $collider_coords_ins.get(); + var overlaps = self.overlaps(player_coords, collider_coords); - if (!overlaps) { - continue; + if (!overlaps) { + continue; + } + + var region = self.detect_overlapping_region( + player_coords, collider_coords); + + //todo: make this an option + if (region === 'C'){ + var area_coords = self.calculate_overlapped_area_coords( + player_coords, collider_coords); + var area = self.calculate_overlapped_area(area_coords); + var collider_data = { + area: area, + area_coords : area_coords, + region: region, + coords: collider_coords, + player_coords: player_coords, + el: $collider + }; + + if (self.options.on_overlap) { + self.options.on_overlap.call(this, collider_data); + } + colliders_coords.push($collider_coords_ins); + colliders_data.push(collider_data); + } } - var region = self.detect_overlapping_region(player_coords, - collider_coords); - //todo: make this if customizable - if (region === 'C'){ - var area_coords = self.calculate_overlapped_area_coords( - player_coords, collider_coords); - var area = self.calculate_overlapped_area(area_coords); - var collider_data = { - area: area, - area_coords : area_coords, - region: region, - coords: collider_coords, - player_coords: player_coords, - el: $collider - }; - - self.options.on_overlap.call(this, collider_data); - colliders_coords.push($collider_coords_ins); - colliders_data.push(collider_data); + if (self.options.on_overlap_stop || self.options.on_overlap_start) { + this.manage_colliders_start_stop(colliders_coords, + self.options.on_overlap_stop, self.options.on_overlap_start); } - } + this.last_colliders_coords = colliders_coords; - this.manage_colliders_start_stop(colliders_coords, - self.options.on_overlap_stop, self.options.on_overlap_start); - - this.last_colliders_coords = colliders_coords; - - return colliders_data; + return colliders_data; }; fn.get_closest_colliders = function(player_data_coords){ - var colliders = this.find_collisions(player_data_coords); - var min_area = 100; - colliders.sort(function(a, b){ + var colliders = this.find_collisions(player_data_coords); + var min_area = 100; + colliders.sort(function(a, b){ + if (a.area <= min_area) { + return 1; + } - if (a.area <= min_area) { - return 1; - } + /* if colliders are being overlapped by the "C" (center) region, + * we have to set a lower index in the array to which they are placed + * above in the grid. */ + if (a.region === 'C' && b.region === 'C') { + if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { + return - 1; + }else{ + return 1; + } + } - /* if colliders are being overlapped by the "C" (center) region, - * we have to set a lower index in the array to which they are placed - * above in the grid. */ - if (a.region === 'C' && b.region === 'C') { - if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { - return - 1; - }else{ + if (a.area < b.area){ return 1; } - } - if (a.area < b.area){ - return 1; - } - - return 1; - }); - return colliders; + return 1; + }); + return colliders; }; + //jQuery adapter $.fn.collision = function(collider, options) { - return new Collision( this, collider, options ); + return new Collision( this, collider, options ); }; From 981895eab4fe25388cd2fdd96e3b11d44eb6e111 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:44:51 +0200 Subject: [PATCH 030/248] default value for css transitions is: "all 0s" not "none" --- src/jquery.gridster.css | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jquery.gridster.css b/src/jquery.gridster.css index 9a6a633ba3..6b5460e367 100644 --- a/src/jquery.gridster.css +++ b/src/jquery.gridster.css @@ -40,10 +40,11 @@ } .gridster .dragging { - -webkit-transition: none!important; - -moz-transition: none!important; - -o-transition: none!important; - transition: none!important; + z-index: 10!important; + -webkit-transition: all 0s !important; + -moz-transition: all 0s !important; + -o-transition: all 0s !important; + transition: all 0s !important; } /* Uncomment this if you set helper : "clone" in draggable options */ From bf2ee674506904c6e88a60de088cbc724b462cf3 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:46:27 +0200 Subject: [PATCH 031/248] only start drag with right click --- src/jquery.draggable.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index dde261e3a9..f9faa5f52b 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -59,6 +59,10 @@ fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + }; + var self = this; var first = true; this.$player = $(e.currentTarget); From 00e7c46b31a5f423f7b1c460e4fc813feca9946f Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:48:25 +0200 Subject: [PATCH 032/248] avoid calls to empty functions in defaults object --- src/jquery.draggable.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index f9faa5f52b..a33f8d9d1f 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -12,10 +12,10 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0, - drag: function(e){}, - start : function(e, ui){}, - stop : function(e){} + offset_left: 0 + // ,drag: function(e){}, + // start : function(e, ui){}, + // stop : function(e){} }; var $body = $(document.body); From 7ae385ea05adee3f89a0ec241750f73667fe0247 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:49:53 +0200 Subject: [PATCH 033/248] some small documentation for draggable class --- src/jquery.draggable.js | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index a33f8d9d1f..6d2bcb5ae5 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -22,14 +22,32 @@ /** - * Draggable - * * @class Draggable + * + * @param {HTMLElement} el The HTMLelement that contains all the widgets + * to be dragged. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {HTMLElement|String} [options.items] Define who will + * be the draggable items. Can be a CSS Selector String or a + * collection of HTMLElements. + * @param {Number} [options.distance] Distance in pixels after mousedown + * the mouse must move before dragging should start. + * @param {Boolean} [options.limit] Constrains dragging to the width of + * the container + * @param {offset_left} [options.offset_left] Offset added to the item + * that is being dragged. + * @param {Number} [options.drag] Executes a callback when the mouse is + * moved during the dragging. + * @param {Number} [options.start] Executes a callback when the drag + * starts. + * @param {Number} [options.stop] Executes a callback when the drag stops. + * @return {Object} Returns `el`. * @constructor */ - function Draggable(element, options) { - this.options = $.extend(defaults, options); - this.$container = $(element); + function Draggable(el, options) { + this.options = $.extend({}, defaults, options); + this.$container = $(el); this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; @@ -44,6 +62,7 @@ this.enable(); }; + fn.get_actual_pos = function($el) { var pos = $el.position(); return pos; @@ -71,6 +90,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); $body.on('mousemove.draggable', function(mme){ + var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); From 7e8ce8dd0ac6bf563b75dc03ccbff1e3772f3200 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 21:50:15 +0200 Subject: [PATCH 034/248] Coords constructor documentation --- src/jquery.coords.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/jquery.coords.js b/src/jquery.coords.js index 05daa6b520..6fdd74eee6 100644 --- a/src/jquery.coords.js +++ b/src/jquery.coords.js @@ -8,10 +8,16 @@ ;(function($, window, document, undefined){ /** - * Coords - * * @class Coords - * @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties. + * + * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) + * to simulate DOM elements on the screen. + * Coords is used by Gridster to create a faux grid with any DOM element can + * collide. + * + * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left, + * top, width and height properties. + * @return {Object} Coords instance. * @constructor */ function Coords(obj) { @@ -27,8 +33,10 @@ return this; } + var fn = Coords.prototype; + fn.init = function(){ this.set(); this.original_coords = this.get(); @@ -86,6 +94,7 @@ return this.coords; }; + //jQuery adapter $.fn.coords = function() { if (this.data('coords') ) { From 33b8f206cf11dc325a25f9f3383a56bb943479c1 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 22:07:43 +0200 Subject: [PATCH 035/248] updated Gridster doc and code style corrections --- src/jquery.gridster.js | 229 +++++++++++++++++++++++------------------ 1 file changed, 127 insertions(+), 102 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 1d07addd63..4f79a7fe79 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -14,7 +14,7 @@ extra_rows: 0, extra_cols: 0, min_cols: 1, - min_rows: 10, + min_rows: 15, autogenerate_stylesheet: true, avoid_overlapped_widgets: true, serialize_params: function($w, wgd) { @@ -32,7 +32,7 @@ /** * @class Gridster - * @uses Coords + * @uses Draggable * @uses Collision * @param {HTMLElement} el The HTMLelement that contains all the widgets. * @param {Object} [options] An Object with all options you want to @@ -58,6 +58,9 @@ * `` of the document. You can set this to false, and write * your own CSS targeting rows and cols via data-attributes like so: * `[data-col="1"] { left: 10px; }` + * @param {Boolean} [avoid_overlapped_widgets] Avoid that widgets loaded + * from the DOM can be overlapped. It is helpful if the positions were + * bad stored in the database or if there was any conflict. * @param {Function} [options.serialize_params] Return the data you want * for each widget in the serialization. Two arguments are passed: * `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid @@ -66,8 +69,8 @@ * Collision class you want to overwrite. See Collision docs for * more info. * @param {Object} [options.draggable] An Object with all options for - * jQuery UI Draggable you want to overwrite. See - * http://jqueryui.com/demos/draggable/ for more info. + * Draggable class you want to overwrite. See Draggable docs for more + * info. * * @constructor */ @@ -75,7 +78,7 @@ this.options = $.extend(true, defaults, options); this.$el = $(el); this.$wrapper = this.$el.parent(); - this.$widgets = this.$el.find(this.options.widget_selector).addClass('gs_w'); + this.$widgets = $(this.options.widget_selector, this.$el).addClass('gs_w'); this.widgets = []; this.$changed = $([]); this.wrapper_width = this.$wrapper.width(); @@ -108,7 +111,7 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.disable = function(){ + fn.disable = function() { this.$wrapper.find('.player-revert').removeClass('player-revert'); this.drag_api.disable(); return this; @@ -121,7 +124,7 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.enable = function(){ + fn.enable = function() { this.drag_api.enable(); return this; } @@ -210,15 +213,17 @@ var $el = el instanceof jQuery ? el : $(el); var wgd = $el.coords().grid; + this.cells_occupied_by_placeholder = {}; this.$widgets = this.$widgets.not($el); var $nexts = this.widgets_below($el); this.remove_from_gridmap(wgd); - $el.fadeOut($.proxy(function(){ + $el.fadeOut($.proxy(function() { $el.remove(); - $nexts.each($.proxy(function(i, widget){ + + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( $(widget), wgd.size_y ); }, this)); @@ -242,9 +247,9 @@ fn.serialize = function($widgets) { $widgets || ($widgets = this.$widgets); var result = []; - $widgets.each($.proxy(function(i, widget){ - result.push( this.options.serialize_params( - $(widget),$(widget).coords().grid ) ); + $widgets.each($.proxy(function(i, widget) { + result.push(this.options.serialize_params( + $(widget), $(widget).coords().grid ) ); }, this)); return result; @@ -252,7 +257,8 @@ /** - * Returns a serialized array of the widgets that have changed their position. + * Returns a serialized array of the widgets that have changed their + * position. * * @method serialize_changed * @return {Array} Returns an Array of Objects with the data specified in @@ -282,7 +288,7 @@ if (this.options.avoid_overlapped_widgets && !this.can_move_to( - { size_x: wgd.size_x, size_y: wgd.size_y }, wgd.col, wgd.row) + {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row) ) { wgd = this.next_position(wgd.size_x, wgd.size_y); wgd.el = $el; @@ -335,7 +341,7 @@ * to update in the mapped array. * @return {Class} Returns the instance of the Gridster Class. */ - fn.remove_from_gridmap = function(grid_data){ + fn.remove_from_gridmap = function(grid_data) { return this.update_widget_position(grid_data, false); }; @@ -350,12 +356,12 @@ * position . * @return {Class} Returns the instance of the Gridster Class. */ - fn.add_to_gridmap = function(grid_data, value){ + fn.add_to_gridmap = function(grid_data, value) { this.update_widget_position(grid_data, value || grid_data.el); if (grid_data.el) { var $widgets = this.widgets_below(grid_data.el); - $widgets.each($.proxy(function(i, widget){ + $widgets.each($.proxy(function(i, widget) { this.move_widget_up( $(widget)); }, this)); } @@ -363,8 +369,9 @@ /** - * Make widgets draggable. It Wraps the jQuery UI Draggable Plugin. + * Make widgets draggable. * + * @uses Draggable * @method draggable * @return {Class} Returns the instance of the Gridster Class. */ @@ -374,7 +381,9 @@ offset_left: this.options.widget_margins[0], items: '.gs_w', start: function(event, ui) { - self.$widgets.filter('.player-revert').removeClass('player-revert'); + self.$widgets.filter('.player-revert') + .removeClass('player-revert'); + self.$player = $(this); self.$helper = self.options.draggable.helper === 'clone' ? $(ui.helper) : self.$player; @@ -404,7 +413,6 @@ * @method on_start_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_start_drag = function(event, ui) { @@ -456,14 +464,15 @@ * @method on_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_drag = function(event, ui) { var abs_offset = { left: ui.position.left + this.baseX, top: ui.position.top + this.baseY } - this.colliders_data = this.collision_api.get_closest_colliders(abs_offset); + + this.colliders_data = this.collision_api.get_closest_colliders( + abs_offset); this.on_overlapped_column_change( this.on_start_overlapping_column, @@ -493,10 +502,10 @@ * @method on_stop_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_stop_drag = function(event, ui) { - this.$helper.add(this.$player).add(this.$wrapper).removeClass('dragging'); + this.$helper.add(this.$player).add(this.$wrapper) + .removeClass('dragging'); ui.position.left = ui.position.left + this.baseX; ui.position.top = ui.position.top + this.baseY; @@ -512,14 +521,14 @@ this.on_stop_overlapping_row ); - this.$player - .addClass('player-revert').removeClass('player').attr({ - 'data-col': this.placeholder_grid_data.col, - 'data-row': this.placeholder_grid_data.row - }).css({ - 'left': '', - 'top': '' - }); + this.$player.addClass('player-revert').removeClass('player') + .attr({ + 'data-col': this.placeholder_grid_data.col, + 'data-row': this.placeholder_grid_data.row + }).css({ + 'left': '', + 'top': '' + }); this.$changed = this.$changed.add(this.$player); @@ -688,7 +697,7 @@ var wgd_can_go_up = []; var wgd_can_not_go_up = []; - $widgets.each($.proxy(function(i, w){ + $widgets.each($.proxy(function(i, w) { var $w = $(w); var wgd = $w.coords().grid; if (this.can_go_widget_up(wgd)) { @@ -717,7 +726,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row) { return 1; } @@ -737,7 +746,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_and_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row || a.row == b.row && a.col > b.col) { return 1; } @@ -757,7 +766,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.col > b.col) { return 1; } @@ -777,8 +786,8 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_desc = function(widgets) { - widgets = widgets.sort(function(a, b){ - if (a.row + a.size_y < b.row + b.size_y){ + widgets = widgets.sort(function(a, b) { + if (a.row + a.size_y < b.row + b.size_y) { return 1; } return -1; @@ -799,7 +808,7 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.manage_movements = function($widgets, to_col, to_row) { - $.each($widgets, $.proxy(function(i, w){ + $.each($widgets, $.proxy(function(i, w) { var wgd = w; var $w = wgd.el; @@ -874,7 +883,7 @@ * @return {Boolean} Returns true or false. */ fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; + var c = this.cells_occupied_by_placeholder || {}; return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0; }; @@ -983,9 +992,9 @@ var cells = this.cells_occupied_by_player; var $widgets = $([]); - $.each(cells.cols, $.proxy(function(i, col){ - $.each(cells.rows, $.proxy(function(i, row){ - if(this.is_widget(col, row)){ + $.each(cells.cols, $.proxy(function(i, col) { + $.each(cells.rows, $.proxy(function(i, row) { + if(this.is_widget(col, row)) { $widgets = $widgets.add(this.gridmap[col][row]); } }, this)); @@ -1026,8 +1035,6 @@ this.placeholder_grid_data.col = col; this.placeholder_grid_data.row = row; - - this.cells_occupied_by_placeholder = this.get_cells_occupied( this.placeholder_grid_data); @@ -1037,9 +1044,9 @@ }); if (moved_down || changed_column) { - $nexts.each($.proxy(function(i, widget){ + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( - $(widget), this.placeholder_grid_data.col - col + phgd.size_y); + $(widget), this.placeholder_grid_data.col - col + phgd.size_y); }, this)); } @@ -1064,12 +1071,12 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; var r = p_bottom_row + 1; upper_rows[tcol] = []; - while (--r > 0){ + while (--r > 0) { if (this.is_empty(tcol, r) || this.is_player(tcol, r) || this.is_widget(tcol, r) && grid_col[r].is($widgets_under_player) @@ -1112,7 +1119,7 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; upper_rows[tcol] = []; @@ -1123,7 +1130,9 @@ break; } - if (!this.is_player(tcol, r) &&!this.is_placeholder_in(tcol, r)) { + if (!this.is_player(tcol, r) && + !this.is_placeholder_in(tcol, r) + ) { upper_rows[tcol].push(r); } @@ -1159,7 +1168,7 @@ * @return {Number|Boolean} Returns the upper row valid from the `upper_rows` * for the widget in question. */ - fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row){ + fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) { var p_top_row = widget_grid_data.row; var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; var size_y = widget_grid_data.size_y; @@ -1168,7 +1177,7 @@ while (++r <= p_bottom_row ) { var common = true; - $.each(upper_rows, function(col, rows){ + $.each(upper_rows, function(col, rows) { if (rows && $.inArray(r, rows) === -1) { common = false; } @@ -1237,8 +1246,8 @@ var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0); rows_from_bottom.reverse(); - $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col){ - $.each(rows_from_bottom, $.proxy(function(i, row){ + $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col) { + $.each(rows_from_bottom, $.proxy(function(i, row) { // if there is a widget in the player position if (!this.gridmap[col]) { return true; } //next iteration var $w = this.gridmap[col][row]; @@ -1325,7 +1334,8 @@ * if they can. * * @method move_widget_to - * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the widget is going to be moved. + * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the + * widget is going to be moved. * @return {Class} Returns the instance of the Gridster Class. */ fn.move_widget_to = function($widget, row) { @@ -1348,12 +1358,12 @@ this.$changed = this.$changed.add($widget); - $next_widgets.each(function(i, widget){ + $next_widgets.each(function(i, widget) { var $w = $(widget); var wgd = $w.coords().grid; var can_go_up = self.can_go_widget_up(wgd); - if (can_go_up && can_go_up !== wgd.row){ + if (can_go_up && can_go_up !== wgd.row) { self.move_widget_to($w, can_go_up); } }); @@ -1379,12 +1389,14 @@ if (!this.can_go_up($widget)) { return false; } //break; - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { // can_go_up if ($.inArray($widget, moved) === -1) { var widget_grid_data = $widget.coords().grid; var next_row = actual_row - y_units; - next_row = this.can_go_up_to_row(widget_grid_data, col, next_row); + next_row = this.can_go_up_to_row( + widget_grid_data, col, next_row); + if (!next_row) { return true; } @@ -1399,7 +1411,7 @@ moved.push($widget); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { this.move_widget_up($(widget), y_units); }, this)); } @@ -1412,7 +1424,8 @@ * Move down the specified widget and all below it. * * @method move_widget_down - * @param {HTMLElement} $widget The jQuery object representing the widget you want to move. + * @param {HTMLElement} $widget The jQuery object representing the widget + * you want to move. * @param {Number} The number of cells that the widget has to move. * @return {Class} Returns the instance of the Gridster Class. */ @@ -1432,7 +1445,7 @@ this.remove_from_gridmap(widget_grid_data); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { var $w = $(widget); var wd = $w.coords().grid; var tmp_y = this.displacement_diff( @@ -1472,13 +1485,14 @@ var actual_row = widget_grid_data.row; var r; - //generate an array with columns as index and array with upper rows empty in the column - this.for_each_column_occupied(widget_grid_data, function(tcol){ + /* generate an array with columns as index and array with + * upper rows empty in the column */ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = ga[tcol]; urc[tcol] = []; r = actual_row; - while (r--){ + while (r--) { if (this.is_empty(tcol, r) && !this.is_placeholder_in(tcol, r) ) { @@ -1497,7 +1511,8 @@ if (!result) { return false; } - //get common rows starting from upper position in all the columns widget occupies + /* get common rows starting from upper position in all the columns + * that widget occupies */ r = row; for (r = 1; r < actual_row; r++) { var common = true; @@ -1523,7 +1538,7 @@ var diffs = []; var parent_max_y = parent_bgd.row + parent_bgd.size_y; - this.for_each_column_occupied(widget_grid_data, function(col){ + this.for_each_column_occupied(widget_grid_data, function(col) { var temp_y_units = 0; for (var r = parent_max_y; r < actual_row; r++) { @@ -1556,9 +1571,9 @@ var next_row = el_grid_data.row + el_grid_data.size_y - 1; var $nexts = $([]); - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { self.for_each_widget_below(col, next_row, - function(tcol, trow){ + function(tcol, trow) { if (!self.is_player(this) && $.inArray(this, $nexts) === -1) { $nexts = $nexts.add(this); @@ -1610,7 +1625,8 @@ var result = true; if (initial_row === 1) { return false; } - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { + var $w = this.is_widget(col, prev_row); if (this.is_occupied(col, prev_row) || this.is_player(col, prev_row) || this.is_placeholder_in(col, prev_row) @@ -1627,8 +1643,8 @@ /** * Check if it's possible to move a widget to a specific col/row. It takes - * into account the dimensions (`size_y` and `size_x` attrs. of the grid coords - * object) the widget occupies. + * into account the dimensions (`size_y` and `size_x` attrs. of the grid + * coords object) the widget occupies. * * @method can_move_to * @param {Object} widget_grid_data The grid coords object that represents @@ -1654,7 +1670,7 @@ return false; }; - this.for_each_cell_occupied(future_wd, function(tcol, trow){ + this.for_each_cell_occupied(future_wd, function(tcol, trow) { var $tw = this.is_widget(tcol, trow); if ($tw && (!widget_grid_data.el || $tw.is($w))) { result = false; @@ -1666,7 +1682,8 @@ /** - * Given the leftmost column returns all columns that are overlapping with the player. + * Given the leftmost column returns all columns that are overlapping + * with the player. * * @method get_targeted_columns * @param {Number} [from_col] The leftmost column. @@ -1740,8 +1757,8 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_cell_occupied = function(grid_data, callback) { - this.for_each_column_occupied(grid_data, function(col){ - this.for_each_row_occupied(grid_data, function(row){ + this.for_each_column_occupied(grid_data, function(col) { + this.for_each_row_occupied(grid_data, function(row) { callback.call(this, col, row); }); }); @@ -1775,7 +1792,8 @@ * @method for_each_row_occupied * @param {Object} el_grid_data The grid coords object that represents * the widget. - * @param {Function} callback The function to execute on each column iteration. The row number is passed as first argument. + * @param {Function} callback The function to execute on each column + * iteration. The row number is passed as first argument. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_row_occupied = function(el_grid_data, callback) { @@ -1841,7 +1859,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery + * wrapped HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_above = function(col, row, callback) { @@ -1857,7 +1876,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery wrapped + * HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_below = function(col, row, callback) { @@ -1898,14 +1918,13 @@ }; - fn.get_widgets_from = function(col, row) { var ga = this.gridmap; var $widgets = $(); if (col) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var tcol = $(this).attr('data-col'); return (tcol == col || tcol > col); }) @@ -1914,7 +1933,7 @@ if (row) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var trow = $(this).attr('data-row'); return (trow == row || trow > row); }) @@ -1934,7 +1953,6 @@ fn.set_dom_grid_height = function() { var r = this.get_highest_occupied_cell().row; this.$el.css('height', r * this.min_widget_height); - // this.$widgets.draggable("option", "containment", this.$el); return this; }; @@ -1959,11 +1977,14 @@ opts.cols || (opts.cols = this.cols); opts.rows || (opts.rows = this.rows); opts.namespace || (opts.namespace = ''); - opts.widget_base_dimensions || (opts.widget_base_dimensions = this.options.widget_base_dimensions); - opts.widget_margins || (opts.widget_margins = this.options.widget_margins); - - opts.min_widget_width = (opts.widget_margins[0] * 2) + opts.widget_base_dimensions[0]; - opts.min_widget_height = (opts.widget_margins[1] * 2) + opts.widget_base_dimensions[1]; + opts.widget_base_dimensions || + (opts.widget_base_dimensions = this.options.widget_base_dimensions); + opts.widget_margins || + (opts.widget_margins = this.options.widget_margins); + opts.min_widget_width = (opts.widget_margins[0] * 2) + + opts.widget_base_dimensions[0]; + opts.min_widget_height = (opts.widget_margins[1] * 2) + + opts.widget_base_dimensions[1]; var serialized_opts = $.param(opts); // don't duplicate stylesheets for the same configuration @@ -1975,27 +1996,31 @@ /* generate CSS styles for cols */ for (i = opts.cols + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-col="'+ (i + 1) +'"] { left: ' + - ((i * opts.widget_base_dimensions[0]) + (i *opts.widget_margins[0] ) + ((i+1) * opts.widget_margins[0])) + - 'px;} '; + styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' + + ((i * opts.widget_base_dimensions[0]) + + (i * opts.widget_margins[0]) + + ((i + 1) * opts.widget_margins[0])) + 'px;} '); } /* generate CSS styles for rows */ for (i = opts.rows + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-row="' + (i + 1) + '"] { top: ' + - ((i * opts.widget_base_dimensions[1]) + (i * opts.widget_margins[1]) + ((i+1) * opts.widget_margins[1]) ) + - 'px;} '; + styles += (opts.namespace + ' [data-row="' + (i + 1) + '"] { top:' + + ((i * opts.widget_base_dimensions[1]) + + (i * opts.widget_margins[1]) + + ((i + 1) * opts.widget_margins[1]) ) + 'px;} '); } for (var y = 1; y < max_size_y; y++) { - styles += opts.namespace + ' [data-sizey="' + (y) + '"] { height: ' + - (y * opts.widget_base_dimensions[1] + (y-1)*(opts.widget_margins[1]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizey="' + y + '"] { height:' + + (y * opts.widget_base_dimensions[1] + + (y - 1) * (opts.widget_margins[1] * 2)) + 'px;}'); } for (var x = 1; x < max_size_x; x++) { - styles += opts.namespace + ' [data-sizex="' + (x) + '"] { width: ' + - (x * opts.widget_base_dimensions[0] + (x-1)*(opts.widget_margins[0]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizex="' + x + '"] { width:' + + (x * opts.widget_base_dimensions[0] + + (x - 1) * (opts.widget_margins[0] * 2)) + 'px;}'); } return this.add_style_tag(styles); @@ -2009,7 +2034,7 @@ * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */ - fn.add_style_tag = function(css){ + fn.add_style_tag = function(css) { var d = document; var tag = d.createElement('style'); @@ -2073,7 +2098,7 @@ this.baseX = ($(window).width() - aw) / 2; this.baseY = this.$wrapper.offset().top; - $.each(this.faux_grid, $.proxy(function(i, coords){ + $.each(this.faux_grid, $.proxy(function(i, coords) { this.faux_grid[i] = coords.update({ left: this.baseX + (coords.data.col -1) * this.min_widget_width, top: this.baseY + (coords.data.row -1) * this.min_widget_height @@ -2092,7 +2117,7 @@ * @return {Object} Returns the instance of the Gridster class. */ fn.get_widgets_from_DOM = function() { - this.$widgets.each($.proxy(function(i, widget){ + this.$widgets.each($.proxy(function(i, widget) { this.register_widget($(widget)); }, this)); return this; From aa939d8bf7ed5360b721a920770336dd6dff1c1c Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 22:08:09 +0200 Subject: [PATCH 036/248] updated docs and dist --- dist/jquery.gridster.css | 8 +- dist/jquery.gridster.js | 581 ++++++++++-------- dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 2 +- docs/api.js | 4 +- ...her DOM elements or\nCoords objects..html" | 97 ++- ...d with any DOM element can\ncollide..html" | 70 ++- docs/classes/Draggable.html | 207 ++++++- docs/classes/Gridster.html | 218 ++++--- docs/data.json | 298 +++++---- docs/files/src_jquery.collision.js.html | 302 +++++---- docs/files/src_jquery.coords.js.html | 35 +- docs/files/src_jquery.draggable.js.html | 62 +- docs/files/src_jquery.gridster.js.html | 250 ++++---- docs/index.html | 20 +- 15 files changed, 1387 insertions(+), 769 deletions(-) rename docs/classes/Collision.html => "docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" (80%) rename docs/classes/Coords.html => "docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" (71%) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index 800e228bbb..986c69f573 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -45,10 +45,10 @@ .gridster .dragging { z-index: 10!important; - -webkit-transition: none!important; - -moz-transition: none!important; - -o-transition: none!important; - transition: none!important; + -webkit-transition: all 0s !important; + -moz-transition: all 0s !important; + -o-transition: all 0s !important; + transition: all 0s !important; } /* Uncomment this if you set helper : "clone" in draggable options */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 54497cffaf..2cc3b61937 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -4,10 +4,16 @@ ;(function($, window, document, undefined){ /** - * Coords - * * @class Coords - * @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties. + * + * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) + * to simulate DOM elements on the screen. + * Coords is used by Gridster to create a faux grid with any DOM element can + * collide. + * + * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left, + * top, width and height properties. + * @return {Object} Coords instance. * @constructor */ function Coords(obj) { @@ -23,8 +29,10 @@ return this; } + var fn = Coords.prototype; + fn.init = function(){ this.set(); this.original_coords = this.get(); @@ -82,6 +90,7 @@ return this.coords; }; + //jQuery adapter $.fn.coords = function() { if (this.data('coords') ) { @@ -98,198 +107,216 @@ ;(function($, window, document, undefined){ var defaults = { - colliders_context: document.body, - on_overlap: function(collider_data){}, - on_overlap_start : function(collider_data){ - // console.log('the element START being a collider', collider_data); - }, - on_overlap_stop : function(collider_data){ - // console.log('the element STOP being a collider', collider_data); - } + colliders_context: document.body + // ,on_overlap: function(collider_data){}, + // on_overlap_start : function(collider_data){}, + // on_overlap_stop : function(collider_data){} }; + /** - * Collision - * * @class Collision + * + * Detects collisions between a DOM element against other DOM elements or + * Coords objects. + * * @uses Coords - * @param {HTMLElement} element An Attribute name or object property path - * @param {String|HTMLElement|Array} colliders An Attribute name or object property path - * @param {Object} [options] An Attribute name or object property path - * @param {Function} [options.on_overlap] An Attribute name or object property path - * @param {Function} [options.on_overlap_start] An Attribute name or object property path - * @param {Function} [options.on_overlap_stop] An Attribute name or object property path - * @return {Object} dasdasdadasd + * @param {HTMLElement} el The jQuery wrapped HTMLElement. + * @param {HTMLElement|Array} colliders Can be a jQuery collection + * of HTMLElements or an Array of Coords instances. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {Function} [options.on_overlap_start] Executes a function the first + * time each `collider ` is overlapped. + * @param {Function} [options.on_overlap_stop] Executes a function when a + * `collider` is no longer collided. + * @param {Function} [options.on_overlap] Executes a function when the + * mouse is moved during the collision. + * @return {Object} Collision instance. * @constructor */ - function Collision(element, colliders, options) { - this.options = $.extend(defaults, options); - this.$element = element; - this.last_colliders = []; - this.last_colliders_coords = []; - if (typeof colliders === 'string' || colliders instanceof jQuery) { - this.$colliders = $(colliders, - this.options.colliders_context).not(this.$element); - }else{ - this.colliders = $(colliders); - } + function Collision(el, colliders, options) { + this.options = $.extend(defaults, options); + this.$element = el; + this.last_colliders = []; + this.last_colliders_coords = []; + if (typeof colliders === 'string' || colliders instanceof jQuery) { + this.$colliders = $(colliders, + this.options.colliders_context).not(this.$element); + }else{ + this.colliders = $(colliders); + } - this.init(); + this.init(); } + var fn = Collision.prototype; + fn.init = function() { - this.find_collisions(); + this.find_collisions(); }; + fn.overlaps = function(a, b) { - var x = false; - var y = false; + var x = false; + var y = false; - if ((b.x1 >= a.x1 && b.x1 <= a.x2) || - (b.x2 >= a.x1 && b.x2 <= a.x2) || - (a.x1 >= b.x1 && a.x2 <= b.x2) - ) { x = true; } + if ((b.x1 >= a.x1 && b.x1 <= a.x2) || + (b.x2 >= a.x1 && b.x2 <= a.x2) || + (a.x1 >= b.x1 && a.x2 <= b.x2) + ) { x = true; } - if ((b.y1 >= a.y1 && b.y1 <= a.y2) || - (b.y2 >= a.y1 && b.y2 <= a.y2) || - (a.y1 >= b.y1 && a.y2 <= b.y2) - ) { y = true; } + if ((b.y1 >= a.y1 && b.y1 <= a.y2) || + (b.y2 >= a.y1 && b.y2 <= a.y2) || + (a.y1 >= b.y1 && a.y2 <= b.y2) + ) { y = true; } - return (x && y); + return (x && y); }; + fn.detect_overlapping_region = function(a, b){ - var regionX = ''; - var regionY = ''; + var regionX = ''; + var regionY = ''; - if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } - if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } - if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } - if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } + if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } + if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } + if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } + if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } - return (regionX + regionY) || 'C'; + return (regionX + regionY) || 'C'; }; + fn.calculate_overlapped_area_coords = function(a, b){ - var x1 = Math.max(a.x1, b.x1); - var y1 = Math.max(a.y1, b.y1); - var x2 = Math.min(a.x2, b.x2); - var y2 = Math.min(a.y2, b.y2); + var x1 = Math.max(a.x1, b.x1); + var y1 = Math.max(a.y1, b.y1); + var x2 = Math.min(a.x2, b.x2); + var y2 = Math.min(a.y2, b.y2); - return $({ - left: x1, - top: y1, - width : (x2 - x1), - height: (y2 - y1) - }).coords().get(); + return $({ + left: x1, + top: y1, + width : (x2 - x1), + height: (y2 - y1) + }).coords().get(); }; + fn.calculate_overlapped_area = function(coords){ - return (coords.width * coords.height); + return (coords.width * coords.height); }; + fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){ - var last = this.last_colliders_coords; + var last = this.last_colliders_coords; - for (var i = 0, il = last.length; i < il; i++) { - if ($.inArray(last[i], new_colliders_coords) === -1) { - start_callback.call(this, last[i]); - } - } + for (var i = 0, il = last.length; i < il; i++) { + if ($.inArray(last[i], new_colliders_coords) === -1) { + start_callback.call(this, last[i]); + } + } - for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { - if ($.inArray(new_colliders_coords[j], last) === -1) { - stop_callback.call(this, new_colliders_coords[j]); - } + for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { + if ($.inArray(new_colliders_coords[j], last) === -1) { + stop_callback.call(this, new_colliders_coords[j]); + } - } + } }; + fn.find_collisions = function(player_data_coords){ - var self = this; - var colliders_coords = []; - var colliders_data = []; - var $colliders = (this.colliders || this.$colliders); - var count = $colliders.length; - var player_coords = self.$element.coords().update(player_data_coords || false).get(); + var self = this; + var colliders_coords = []; + var colliders_data = []; + var $colliders = (this.colliders || this.$colliders); + var count = $colliders.length; + var player_coords = self.$element.coords() + .update(player_data_coords || false).get(); - while(count--){ - var $collider = self.$colliders ? $($colliders[count]) : $colliders[count]; - var $collider_coords_ins = ($collider.isCoords) ? - $collider : $collider.coords(); - var collider_coords = $collider_coords_ins.get(); - var overlaps = self.overlaps(player_coords, collider_coords); + while(count--){ + var $collider = self.$colliders ? + $($colliders[count]) : $colliders[count]; + var $collider_coords_ins = ($collider.isCoords) ? + $collider : $collider.coords(); + var collider_coords = $collider_coords_ins.get(); + var overlaps = self.overlaps(player_coords, collider_coords); - if (!overlaps) { - continue; + if (!overlaps) { + continue; + } + + var region = self.detect_overlapping_region( + player_coords, collider_coords); + + //todo: make this an option + if (region === 'C'){ + var area_coords = self.calculate_overlapped_area_coords( + player_coords, collider_coords); + var area = self.calculate_overlapped_area(area_coords); + var collider_data = { + area: area, + area_coords : area_coords, + region: region, + coords: collider_coords, + player_coords: player_coords, + el: $collider + }; + + if (self.options.on_overlap) { + self.options.on_overlap.call(this, collider_data); + } + colliders_coords.push($collider_coords_ins); + colliders_data.push(collider_data); + } } - var region = self.detect_overlapping_region(player_coords, - collider_coords); - //todo: make this if customizable - if (region === 'C'){ - var area_coords = self.calculate_overlapped_area_coords( - player_coords, collider_coords); - var area = self.calculate_overlapped_area(area_coords); - var collider_data = { - area: area, - area_coords : area_coords, - region: region, - coords: collider_coords, - player_coords: player_coords, - el: $collider - }; - - self.options.on_overlap.call(this, collider_data); - colliders_coords.push($collider_coords_ins); - colliders_data.push(collider_data); + if (self.options.on_overlap_stop || self.options.on_overlap_start) { + this.manage_colliders_start_stop(colliders_coords, + self.options.on_overlap_stop, self.options.on_overlap_start); } - } + this.last_colliders_coords = colliders_coords; - this.manage_colliders_start_stop(colliders_coords, - self.options.on_overlap_stop, self.options.on_overlap_start); - - this.last_colliders_coords = colliders_coords; - - return colliders_data; + return colliders_data; }; fn.get_closest_colliders = function(player_data_coords){ - var colliders = this.find_collisions(player_data_coords); - var min_area = 100; - colliders.sort(function(a, b){ + var colliders = this.find_collisions(player_data_coords); + var min_area = 100; + colliders.sort(function(a, b){ + if (a.area <= min_area) { + return 1; + } - if (a.area <= min_area) { - return 1; - } + /* if colliders are being overlapped by the "C" (center) region, + * we have to set a lower index in the array to which they are placed + * above in the grid. */ + if (a.region === 'C' && b.region === 'C') { + if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { + return - 1; + }else{ + return 1; + } + } - /* if colliders are being overlapped by the "C" (center) region, - * we have to set a lower index in the array to which they are placed - * above in the grid. */ - if (a.region === 'C' && b.region === 'C') { - if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { - return - 1; - }else{ + if (a.area < b.area){ return 1; } - } - if (a.area < b.area){ - return 1; - } - - return 1; - }); - return colliders; + return 1; + }); + return colliders; }; + //jQuery adapter $.fn.collision = function(collider, options) { - return new Collision( this, collider, options ); + return new Collision( this, collider, options ); }; @@ -343,24 +370,42 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0, - drag: function(e){}, - start : function(e, ui){}, - stop : function(e){} + offset_left: 0 + // ,drag: function(e){}, + // start : function(e, ui){}, + // stop : function(e){} }; var $body = $(document.body); /** - * Draggable - * * @class Draggable + * + * @param {HTMLElement} el The HTMLelement that contains all the widgets + * to be dragged. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {HTMLElement|String} [options.items] Define who will + * be the draggable items. Can be a CSS Selector String or a + * collection of HTMLElements. + * @param {Number} [options.distance] Distance in pixels after mousedown + * the mouse must move before dragging should start. + * @param {Boolean} [options.limit] Constrains dragging to the width of + * the container + * @param {offset_left} [options.offset_left] Offset added to the item + * that is being dragged. + * @param {Number} [options.drag] Executes a callback when the mouse is + * moved during the dragging. + * @param {Number} [options.start] Executes a callback when the drag + * starts. + * @param {Number} [options.stop] Executes a callback when the drag stops. + * @return {Object} Returns `el`. * @constructor */ - function Draggable(element, options) { - this.options = $.extend(defaults, options); - this.$container = $(element); + function Draggable(el, options) { + this.options = $.extend({}, defaults, options); + this.$container = $(el); this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; @@ -375,6 +420,7 @@ this.enable(); }; + fn.get_actual_pos = function($el) { var pos = $el.position(); return pos; @@ -390,6 +436,10 @@ fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + }; + var self = this; var first = true; this.$player = $(e.currentTarget); @@ -398,6 +448,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); $body.on('mousemove.draggable', function(mme){ + var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); @@ -562,7 +613,7 @@ extra_rows: 0, extra_cols: 0, min_cols: 1, - min_rows: 10, + min_rows: 15, autogenerate_stylesheet: true, avoid_overlapped_widgets: true, serialize_params: function($w, wgd) { @@ -580,7 +631,7 @@ /** * @class Gridster - * @uses Coords + * @uses Draggable * @uses Collision * @param {HTMLElement} el The HTMLelement that contains all the widgets. * @param {Object} [options] An Object with all options you want to @@ -606,6 +657,9 @@ * `` of the document. You can set this to false, and write * your own CSS targeting rows and cols via data-attributes like so: * `[data-col="1"] { left: 10px; }` + * @param {Boolean} [avoid_overlapped_widgets] Avoid that widgets loaded + * from the DOM can be overlapped. It is helpful if the positions were + * bad stored in the database or if there was any conflict. * @param {Function} [options.serialize_params] Return the data you want * for each widget in the serialization. Two arguments are passed: * `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid @@ -614,8 +668,8 @@ * Collision class you want to overwrite. See Collision docs for * more info. * @param {Object} [options.draggable] An Object with all options for - * jQuery UI Draggable you want to overwrite. See - * http://jqueryui.com/demos/draggable/ for more info. + * Draggable class you want to overwrite. See Draggable docs for more + * info. * * @constructor */ @@ -623,7 +677,7 @@ this.options = $.extend(true, defaults, options); this.$el = $(el); this.$wrapper = this.$el.parent(); - this.$widgets = this.$el.find(this.options.widget_selector).addClass('gs_w'); + this.$widgets = $(this.options.widget_selector, this.$el).addClass('gs_w'); this.widgets = []; this.$changed = $([]); this.wrapper_width = this.$wrapper.width(); @@ -656,7 +710,7 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.disable = function(){ + fn.disable = function() { this.$wrapper.find('.player-revert').removeClass('player-revert'); this.drag_api.disable(); return this; @@ -669,7 +723,7 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.enable = function(){ + fn.enable = function() { this.drag_api.enable(); return this; } @@ -758,14 +812,17 @@ var $el = el instanceof jQuery ? el : $(el); var wgd = $el.coords().grid; + this.cells_occupied_by_placeholder = {}; this.$widgets = this.$widgets.not($el); var $nexts = this.widgets_below($el); + this.remove_from_gridmap(wgd); - $el.fadeOut($.proxy(function(){ + $el.fadeOut($.proxy(function() { $el.remove(); - $nexts.each($.proxy(function(i, widget){ + + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( $(widget), wgd.size_y ); }, this)); @@ -789,9 +846,9 @@ fn.serialize = function($widgets) { $widgets || ($widgets = this.$widgets); var result = []; - $widgets.each($.proxy(function(i, widget){ - result.push( this.options.serialize_params( - $(widget),$(widget).coords().grid ) ); + $widgets.each($.proxy(function(i, widget) { + result.push(this.options.serialize_params( + $(widget), $(widget).coords().grid ) ); }, this)); return result; @@ -799,7 +856,8 @@ /** - * Returns a serialized array of the widgets that have changed their position. + * Returns a serialized array of the widgets that have changed their + * position. * * @method serialize_changed * @return {Array} Returns an Array of Objects with the data specified in @@ -829,7 +887,7 @@ if (this.options.avoid_overlapped_widgets && !this.can_move_to( - { size_x: wgd.size_x, size_y: wgd.size_y }, wgd.col, wgd.row) + {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row) ) { wgd = this.next_position(wgd.size_x, wgd.size_y); wgd.el = $el; @@ -882,7 +940,7 @@ * to update in the mapped array. * @return {Class} Returns the instance of the Gridster Class. */ - fn.remove_from_gridmap = function(grid_data){ + fn.remove_from_gridmap = function(grid_data) { return this.update_widget_position(grid_data, false); }; @@ -897,12 +955,12 @@ * position . * @return {Class} Returns the instance of the Gridster Class. */ - fn.add_to_gridmap = function(grid_data, value){ + fn.add_to_gridmap = function(grid_data, value) { this.update_widget_position(grid_data, value || grid_data.el); if (grid_data.el) { var $widgets = this.widgets_below(grid_data.el); - $widgets.each($.proxy(function(i, widget){ + $widgets.each($.proxy(function(i, widget) { this.move_widget_up( $(widget)); }, this)); } @@ -910,8 +968,9 @@ /** - * Make widgets draggable. It Wraps the jQuery UI Draggable Plugin. + * Make widgets draggable. * + * @uses Draggable * @method draggable * @return {Class} Returns the instance of the Gridster Class. */ @@ -921,7 +980,9 @@ offset_left: this.options.widget_margins[0], items: '.gs_w', start: function(event, ui) { - self.$widgets.filter('.player-revert').removeClass('player-revert'); + self.$widgets.filter('.player-revert') + .removeClass('player-revert'); + self.$player = $(this); self.$helper = self.options.draggable.helper === 'clone' ? $(ui.helper) : self.$player; @@ -951,7 +1012,6 @@ * @method on_start_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_start_drag = function(event, ui) { @@ -1003,14 +1063,15 @@ * @method on_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_drag = function(event, ui) { var abs_offset = { left: ui.position.left + this.baseX, top: ui.position.top + this.baseY } - this.colliders_data = this.collision_api.get_closest_colliders(abs_offset); + + this.colliders_data = this.collision_api.get_closest_colliders( + abs_offset); this.on_overlapped_column_change( this.on_start_overlapping_column, @@ -1040,10 +1101,10 @@ * @method on_stop_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_stop_drag = function(event, ui) { - this.$helper.add(this.$player).add(this.$wrapper).removeClass('dragging'); + this.$helper.add(this.$player).add(this.$wrapper) + .removeClass('dragging'); ui.position.left = ui.position.left + this.baseX; ui.position.top = ui.position.top + this.baseY; @@ -1059,14 +1120,14 @@ this.on_stop_overlapping_row ); - this.$player - .addClass('player-revert').removeClass('player').attr({ - 'data-col': this.placeholder_grid_data.col, - 'data-row': this.placeholder_grid_data.row - }).css({ - 'left': '', - 'top': '' - }); + this.$player.addClass('player-revert').removeClass('player') + .attr({ + 'data-col': this.placeholder_grid_data.col, + 'data-row': this.placeholder_grid_data.row + }).css({ + 'left': '', + 'top': '' + }); this.$changed = this.$changed.add(this.$player); @@ -1235,7 +1296,7 @@ var wgd_can_go_up = []; var wgd_can_not_go_up = []; - $widgets.each($.proxy(function(i, w){ + $widgets.each($.proxy(function(i, w) { var $w = $(w); var wgd = $w.coords().grid; if (this.can_go_widget_up(wgd)) { @@ -1264,7 +1325,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row) { return 1; } @@ -1284,7 +1345,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_and_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row || a.row == b.row && a.col > b.col) { return 1; } @@ -1304,7 +1365,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.col > b.col) { return 1; } @@ -1324,8 +1385,8 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_desc = function(widgets) { - widgets = widgets.sort(function(a, b){ - if (a.row + a.size_y < b.row + b.size_y){ + widgets = widgets.sort(function(a, b) { + if (a.row + a.size_y < b.row + b.size_y) { return 1; } return -1; @@ -1346,7 +1407,7 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.manage_movements = function($widgets, to_col, to_row) { - $.each($widgets, $.proxy(function(i, w){ + $.each($widgets, $.proxy(function(i, w) { var wgd = w; var $w = wgd.el; @@ -1421,7 +1482,7 @@ * @return {Boolean} Returns true or false. */ fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; + var c = this.cells_occupied_by_placeholder || {}; return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0; }; @@ -1530,9 +1591,9 @@ var cells = this.cells_occupied_by_player; var $widgets = $([]); - $.each(cells.cols, $.proxy(function(i, col){ - $.each(cells.rows, $.proxy(function(i, row){ - if(this.is_widget(col, row)){ + $.each(cells.cols, $.proxy(function(i, col) { + $.each(cells.rows, $.proxy(function(i, row) { + if(this.is_widget(col, row)) { $widgets = $widgets.add(this.gridmap[col][row]); } }, this)); @@ -1573,8 +1634,6 @@ this.placeholder_grid_data.col = col; this.placeholder_grid_data.row = row; - - this.cells_occupied_by_placeholder = this.get_cells_occupied( this.placeholder_grid_data); @@ -1584,9 +1643,9 @@ }); if (moved_down || changed_column) { - $nexts.each($.proxy(function(i, widget){ + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( - $(widget), this.placeholder_grid_data.col - col + phgd.size_y); + $(widget), this.placeholder_grid_data.col - col + phgd.size_y); }, this)); } @@ -1611,12 +1670,12 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; var r = p_bottom_row + 1; upper_rows[tcol] = []; - while (--r > 0){ + while (--r > 0) { if (this.is_empty(tcol, r) || this.is_player(tcol, r) || this.is_widget(tcol, r) && grid_col[r].is($widgets_under_player) @@ -1659,7 +1718,7 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; upper_rows[tcol] = []; @@ -1670,7 +1729,9 @@ break; } - if (!this.is_player(tcol, r) &&!this.is_placeholder_in(tcol, r)) { + if (!this.is_player(tcol, r) && + !this.is_placeholder_in(tcol, r) + ) { upper_rows[tcol].push(r); } @@ -1706,7 +1767,7 @@ * @return {Number|Boolean} Returns the upper row valid from the `upper_rows` * for the widget in question. */ - fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row){ + fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) { var p_top_row = widget_grid_data.row; var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; var size_y = widget_grid_data.size_y; @@ -1715,7 +1776,7 @@ while (++r <= p_bottom_row ) { var common = true; - $.each(upper_rows, function(col, rows){ + $.each(upper_rows, function(col, rows) { if (rows && $.inArray(r, rows) === -1) { common = false; } @@ -1784,8 +1845,8 @@ var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0); rows_from_bottom.reverse(); - $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col){ - $.each(rows_from_bottom, $.proxy(function(i, row){ + $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col) { + $.each(rows_from_bottom, $.proxy(function(i, row) { // if there is a widget in the player position if (!this.gridmap[col]) { return true; } //next iteration var $w = this.gridmap[col][row]; @@ -1872,7 +1933,8 @@ * if they can. * * @method move_widget_to - * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the widget is going to be moved. + * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the + * widget is going to be moved. * @return {Class} Returns the instance of the Gridster Class. */ fn.move_widget_to = function($widget, row) { @@ -1895,12 +1957,12 @@ this.$changed = this.$changed.add($widget); - $next_widgets.each(function(i, widget){ + $next_widgets.each(function(i, widget) { var $w = $(widget); var wgd = $w.coords().grid; var can_go_up = self.can_go_widget_up(wgd); - if (can_go_up && can_go_up !== wgd.row){ + if (can_go_up && can_go_up !== wgd.row) { self.move_widget_to($w, can_go_up); } }); @@ -1924,33 +1986,31 @@ var can_go_up = true; y_units || (y_units = 1); - // if (!this.can_go_up($widget)) { return false; } //break; - console.log($widget, y_units); + if (!this.can_go_up($widget)) { return false; } //break; - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { // can_go_up if ($.inArray($widget, moved) === -1) { - var widget_grid_data = $.extend({}, el_grid_data); + var widget_grid_data = $widget.coords().grid; var next_row = actual_row - y_units; - next_row = this.can_go_up_to_row(widget_grid_data, col, next_row); - console.log('can_go_up_to_row?', $widget, y_units, next_row); - if (next_row === false) { + next_row = this.can_go_up_to_row( + widget_grid_data, col, next_row); + + if (!next_row) { return true; } var $next_widgets = this.widgets_below($widget); - console.log('$next_widgets', $next_widgets); this.remove_from_gridmap(widget_grid_data); widget_grid_data.row = next_row; this.add_to_gridmap(widget_grid_data); - console.log($widget, 'next-row', next_row); - $widget.attr('data-row', next_row); + $widget.attr('data-row', widget_grid_data.row); this.$changed = this.$changed.add($widget); moved.push($widget); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { this.move_widget_up($(widget), y_units); }, this)); } @@ -1963,7 +2023,8 @@ * Move down the specified widget and all below it. * * @method move_widget_down - * @param {HTMLElement} $widget The jQuery object representing the widget you want to move. + * @param {HTMLElement} $widget The jQuery object representing the widget + * you want to move. * @param {Number} The number of cells that the widget has to move. * @return {Class} Returns the instance of the Gridster Class. */ @@ -1983,7 +2044,7 @@ this.remove_from_gridmap(widget_grid_data); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { var $w = $(widget); var wd = $w.coords().grid; var tmp_y = this.displacement_diff( @@ -2023,20 +2084,17 @@ var actual_row = widget_grid_data.row; var r; - //generate an array with columns as index and array with upper rows empty in the column - this.for_each_column_occupied(widget_grid_data, function(tcol){ + /* generate an array with columns as index and array with + * upper rows empty in the column */ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = ga[tcol]; urc[tcol] = []; r = actual_row; - while (r--){ - var $w = this.is_widget(tcol, r); - console.log(tcol, r, $w, this.is_empty(tcol, r)); - if ($w && $w.is(widget_grid_data.el) || - (this.is_empty(tcol, r) && - !this.is_placeholder_in(tcol, r)) + while (r--) { + if (this.is_empty(tcol, r) && + !this.is_placeholder_in(tcol, r) ) { - console.log('push', tcol, r); urc[tcol].push(r); }else{ break; @@ -2050,11 +2108,10 @@ }); - console.log('urc', urc); - if (!result) { return false; } - //get common rows starting from upper position in all the columns widget occupies + /* get common rows starting from upper position in all the columns + * that widget occupies */ r = row; for (r = 1; r < actual_row; r++) { var common = true; @@ -2080,7 +2137,7 @@ var diffs = []; var parent_max_y = parent_bgd.row + parent_bgd.size_y; - this.for_each_column_occupied(widget_grid_data, function(col){ + this.for_each_column_occupied(widget_grid_data, function(col) { var temp_y_units = 0; for (var r = parent_max_y; r < actual_row; r++) { @@ -2113,9 +2170,9 @@ var next_row = el_grid_data.row + el_grid_data.size_y - 1; var $nexts = $([]); - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { self.for_each_widget_below(col, next_row, - function(tcol, trow){ + function(tcol, trow) { if (!self.is_player(this) && $.inArray(this, $nexts) === -1) { $nexts = $nexts.add(this); @@ -2167,9 +2224,9 @@ var result = true; if (initial_row === 1) { return false; } - this.for_each_column_occupied(el_grid_data, function(col){ - if (!$el.is(this.is_widget(col, prev_row)) && - this.is_occupied(col, prev_row) || + this.for_each_column_occupied(el_grid_data, function(col) { + var $w = this.is_widget(col, prev_row); + if (this.is_occupied(col, prev_row) || this.is_player(col, prev_row) || this.is_placeholder_in(col, prev_row) ) { @@ -2185,8 +2242,8 @@ /** * Check if it's possible to move a widget to a specific col/row. It takes - * into account the dimensions (`size_y` and `size_x` attrs. of the grid coords - * object) the widget occupies. + * into account the dimensions (`size_y` and `size_x` attrs. of the grid + * coords object) the widget occupies. * * @method can_move_to * @param {Object} widget_grid_data The grid coords object that represents @@ -2212,7 +2269,7 @@ return false; }; - this.for_each_cell_occupied(future_wd, function(tcol, trow){ + this.for_each_cell_occupied(future_wd, function(tcol, trow) { var $tw = this.is_widget(tcol, trow); if ($tw && (!widget_grid_data.el || $tw.is($w))) { result = false; @@ -2224,7 +2281,8 @@ /** - * Given the leftmost column returns all columns that are overlapping with the player. + * Given the leftmost column returns all columns that are overlapping + * with the player. * * @method get_targeted_columns * @param {Number} [from_col] The leftmost column. @@ -2298,8 +2356,8 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_cell_occupied = function(grid_data, callback) { - this.for_each_column_occupied(grid_data, function(col){ - this.for_each_row_occupied(grid_data, function(row){ + this.for_each_column_occupied(grid_data, function(col) { + this.for_each_row_occupied(grid_data, function(row) { callback.call(this, col, row); }); }); @@ -2333,7 +2391,8 @@ * @method for_each_row_occupied * @param {Object} el_grid_data The grid coords object that represents * the widget. - * @param {Function} callback The function to execute on each column iteration. The row number is passed as first argument. + * @param {Function} callback The function to execute on each column + * iteration. The row number is passed as first argument. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_row_occupied = function(el_grid_data, callback) { @@ -2399,7 +2458,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery + * wrapped HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_above = function(col, row, callback) { @@ -2415,7 +2475,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery wrapped + * HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_below = function(col, row, callback) { @@ -2456,14 +2517,13 @@ }; - fn.get_widgets_from = function(col, row) { var ga = this.gridmap; var $widgets = $(); if (col) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var tcol = $(this).attr('data-col'); return (tcol == col || tcol > col); }) @@ -2472,7 +2532,7 @@ if (row) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var trow = $(this).attr('data-row'); return (trow == row || trow > row); }) @@ -2492,7 +2552,6 @@ fn.set_dom_grid_height = function() { var r = this.get_highest_occupied_cell().row; this.$el.css('height', r * this.min_widget_height); - // this.$widgets.draggable("option", "containment", this.$el); return this; }; @@ -2536,27 +2595,31 @@ /* generate CSS styles for cols */ for (i = opts.cols + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-col="'+ (i + 1) +'"] { left: ' + - ((i * opts.widget_base_dimensions[0]) + (i *opts.widget_margins[0]) + ((i+1) * opts.widget_margins[0])) + - 'px;} '; + styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' + + ((i * opts.widget_base_dimensions[0]) + + (i * opts.widget_margins[0]) + + ((i + 1) * opts.widget_margins[0])) + 'px;} '); } /* generate CSS styles for rows */ for (i = opts.rows + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-row="' + (i + 1) + '"] { top: ' + - ((i * opts.widget_base_dimensions[1]) + (i * opts.widget_margins[1]) + ((i+1) * opts.widget_margins[1]) ) + - 'px;} '; + styles += (opts.namespace + ' [data-row="' + (i + 1) + '"] { top:' + + ((i * opts.widget_base_dimensions[1]) + + (i * opts.widget_margins[1]) + + ((i + 1) * opts.widget_margins[1]) ) + 'px;} '); } for (var y = 1; y < max_size_y; y++) { - styles += opts.namespace + ' [data-sizey="' + (y) + '"] { height: ' + - (y * opts.widget_base_dimensions[1] + (y-1)*(opts.widget_margins[1]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizey="' + y + '"] { height:' + + (y * opts.widget_base_dimensions[1] + + (y - 1) * (opts.widget_margins[1] * 2)) + 'px;}'); } for (var x = 1; x < max_size_x; x++) { - styles += opts.namespace + ' [data-sizex="' + (x) + '"] { width: ' + - (x * opts.widget_base_dimensions[0] + (x-1)*(opts.widget_margins[0]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizex="' + x + '"] { width:' + + (x * opts.widget_base_dimensions[0] + + (x - 1) * (opts.widget_margins[0] * 2)) + 'px;}'); } return this.add_style_tag(styles); @@ -2570,7 +2633,7 @@ * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */ - fn.add_style_tag = function(css){ + fn.add_style_tag = function(css) { var d = document; var tag = d.createElement('style'); @@ -2634,7 +2697,7 @@ this.baseX = ($(window).width() - aw) / 2; this.baseY = this.$wrapper.offset().top; - $.each(this.faux_grid, $.proxy(function(i, coords){ + $.each(this.faux_grid, $.proxy(function(i, coords) { this.faux_grid[i] = coords.update({ left: this.baseX + (coords.data.col -1) * this.min_widget_width, top: this.baseY + (coords.data.row -1) * this.min_widget_height @@ -2653,7 +2716,7 @@ * @return {Object} Returns the instance of the Gridster class. */ fn.get_widgets_from_DOM = function() { - this.$widgets.each($.proxy(function(i, widget){ + this.$widgets.each($.proxy(function(i, widget) { this.register_widget($(widget)); }, this)); return this; diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index 7d676b6f5b..3cce5bc9d1 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ /*! gridster.js - v0.1.0 - 2012-07-23 * https://github.com/ducksboard/gridster.js -* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important} \ No newline at end of file +* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index bb48c41add..9be252218e 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-23 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data={}||c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body,on_overlap:function(a){},on_overlap_start:function(a){},on_overlap_stop:function(a){}},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&throttle(c.on_dragmove.call(c,a),130),!1):!1}),!1},h.on_dragstart=function(a){return a.preventDefault(),this.drag_start=!0,this.is_dragging=!0,this.$container_offset=this.$container.offset(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,a,{helper:this.helper?this.$helper:this.$player}),!1},h.get_offset=function(a){a.preventDefault();var b=this.get_mouse_pos(a),c=b.left-this.mouse_init_pos.left,d=b.top-this.mouse_init_pos.top,e=this.el_init_offset.left+c-this.$container_offset.left,f=this.el_init_offset.top+d-this.$container_offset.top;return this.options.limit&&(e>this.player_max_left?e=this.player_max_left:e li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:10,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||[];return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c==b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b==c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left: '+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top: '+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data={}||c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&throttle(c.on_dragmove.call(c,a),130),!1):!1}),!1},h.on_dragstart=function(a){return a.preventDefault(),this.drag_start=!0,this.is_dragging=!0,this.$container_offset=this.$container.offset(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,a,{helper:this.helper?this.$helper:this.$player}),!1},h.get_offset=function(a){a.preventDefault();var b=this.get_mouse_pos(a),c=b.left-this.mouse_init_pos.left,d=b.top-this.mouse_init_pos.top,e=this.el_init_offset.left+c-this.$container_offset.left,f=this.el_init_offset.top+d-this.$container_offset.top;return this.options.limit&&(e>this.player_max_left?e=this.player_max_left:e li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c==b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b==c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/api.js b/docs/api.js index 8b7efa7acb..47d6d2545a 100644 --- a/docs/api.js +++ b/docs/api.js @@ -1,8 +1,8 @@ YUI.add("yuidoc-meta", function(Y) { Y.YUIDoc = { meta: { "classes": [ - "Collision", - "Coords", + "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", + "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", "Draggable", "Gridster" ], diff --git a/docs/classes/Collision.html "b/docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" similarity index 80% rename from docs/classes/Collision.html rename to "docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" index 74c25d5b5d..7b89b6fc6c 100644 --- a/docs/classes/Collision.html +++ "b/docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" @@ -2,7 +2,10 @@ - Collision + Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects. @@ -42,9 +45,25 @@
        -
      • Collision
      • +
      • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
      • -
      • Coords
      • +
      • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
      • Draggable
      • @@ -89,7 +108,10 @@
        -

        Collision Class

        +

        Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects. Class

        @@ -106,7 +128,7 @@ @@ -118,14 +140,20 @@
        -

        Collision

        +

        Constructor

        -
        -

        Collision

        +
        +

        Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.

        @@ -133,7 +161,7 @@
      • - element + el
      • @@ -182,7 +210,7 @@ - src/jquery.collision.js:22 + src/jquery.collision.js:19

        @@ -204,14 +232,14 @@
      • - element + el HTMLElement
        -

        An Attribute name or object property path

        +

        The jQuery wrapped HTMLElement.

        @@ -220,13 +248,14 @@
      • colliders - String | HTMLElement | Array + HTMLElement | Array
        -

        An Attribute name or object property path

        +

        Can be a jQuery collection + of HTMLElements or an Array of Coords instances.

        @@ -242,26 +271,13 @@
        -

        An Attribute name or object property path

        +

        An Object with all options you want to + overwrite:

          -
        • - - [on_overlap] - Function - optional - - -
          -

          An Attribute name or object property path

          -
          - - -
        • -
        • [on_overlap_start] @@ -270,7 +286,8 @@
          -

          An Attribute name or object property path

          +

          Executes a function the first + time each collider is overlapped.

          @@ -284,7 +301,23 @@
          -

          An Attribute name or object property path

          +

          Executes a function when a + collider is no longer collided.

          +
          + + +
        • + +
        • + + [on_overlap] + Function + optional + + +
          +

          Executes a function when the +mouse is moved during the collision.

          @@ -307,7 +340,7 @@ Object: - dasdasdadasd + Collision instance.
      • diff --git a/docs/classes/Coords.html "b/docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" similarity index 71% rename from docs/classes/Coords.html rename to "docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" index 603259dcf0..eace6a44b7 100644 --- a/docs/classes/Coords.html +++ "b/docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" @@ -2,7 +2,12 @@ - Coords + Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide. @@ -42,9 +47,25 @@
        @@ -962,7 +1002,7 @@ - src/jquery.gridster.js:2004 + src/jquery.gridster.js:2030

        @@ -1072,7 +1112,7 @@ - src/jquery.gridster.js:342 + src/jquery.gridster.js:349

        @@ -1205,7 +1245,7 @@ - src/jquery.gridster.js:129 + src/jquery.gridster.js:133

        @@ -1340,7 +1380,7 @@ - src/jquery.gridster.js:1048 + src/jquery.gridster.js:1056

        @@ -1458,7 +1498,7 @@ - src/jquery.gridster.js:1455 + src/jquery.gridster.js:1469

        @@ -1595,7 +1635,7 @@ upper row possible.

        - src/jquery.gridster.js:1097 + src/jquery.gridster.js:1105

        @@ -1713,7 +1753,7 @@ upper row possible.

        - src/jquery.gridster.js:1627 + src/jquery.gridster.js:1644

        @@ -1725,8 +1765,8 @@ upper row possible.

        Check if it's possible to move a widget to a specific col/row. It takes -into account the dimensions (size_y and size_x attrs. of the grid coords - object) the widget occupies.

        +into account the dimensions (size_y and size_x attrs. of the grid + coords object) the widget occupies.

        @@ -1840,7 +1880,7 @@ into account the dimensions (size_y and size_x attrs. - src/jquery.gridster.js:364 + src/jquery.gridster.js:371

        @@ -1851,7 +1891,7 @@ into account the dimensions (size_y and size_x attrs.
        -

        Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.

        +

        Make widgets draggable.

        @@ -1911,7 +1951,7 @@ into account the dimensions (size_y and size_x attrs. - src/jquery.gridster.js:1590 + src/jquery.gridster.js:1606

        @@ -1982,7 +2022,7 @@ into account the dimensions (size_y and size_x attrs. - src/jquery.gridster.js:105 + src/jquery.gridster.js:108

        @@ -2053,7 +2093,7 @@ into account the dimensions (size_y and size_x attrs. - src/jquery.gridster.js:117 + src/jquery.gridster.js:121

        @@ -2140,7 +2180,7 @@ into account the dimensions (size_y and size_x attrs. - src/jquery.gridster.js:1730 + src/jquery.gridster.js:1748

        @@ -2268,7 +2308,7 @@ each one.

        - src/jquery.gridster.js:1751 + src/jquery.gridster.js:1769

        @@ -2396,7 +2436,7 @@ each one.

        - src/jquery.gridster.js:1770 + src/jquery.gridster.js:1788

        @@ -2442,7 +2482,8 @@ each one.

        -

        The function to execute on each column iteration. The row number is passed as first argument.

        +

        The function to execute on each column + iteration. The row number is passed as first argument.

        @@ -2529,7 +2570,7 @@ each one.

        - src/jquery.gridster.js:1836 + src/jquery.gridster.js:1855

        @@ -2589,7 +2630,8 @@ each one.

        The function to execute on each widget -iteration. The value of this inside the function is the jQuery wrapped HTMLElement.

        + iteration. The value of this inside the function is the jQuery + wrapped HTMLElement.

        @@ -2676,7 +2718,7 @@ iteration. The value of this inside the function is the jQuery wrap - src/jquery.gridster.js:1852 + src/jquery.gridster.js:1872

        @@ -2736,7 +2778,8 @@ iteration. The value of this inside the function is the jQuery wrap

        The function to execute on each widget -iteration. The value of this inside the function is the jQuery wrapped HTMLElement.

        + iteration. The value of this inside the function is the jQuery wrapped + HTMLElement.

        @@ -2817,7 +2860,7 @@ iteration. The value of this inside the function is the jQuery wrap - src/jquery.gridster.js:2027 + src/jquery.gridster.js:2053

        @@ -2927,7 +2970,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:2101 + src/jquery.gridster.js:2127

        @@ -3015,7 +3058,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1941 + src/jquery.gridster.js:1960

        @@ -3134,7 +3177,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1702 + src/jquery.gridster.js:1720

        @@ -3228,7 +3271,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1868 + src/jquery.gridster.js:1889

        @@ -3309,7 +3352,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1667 + src/jquery.gridster.js:1684

        @@ -3320,7 +3363,8 @@ detect row or column that we want to go.

        -

        Given the leftmost column returns all columns that are overlapping with the player.

        +

        Given the leftmost column returns all columns that are overlapping + with the player.

        @@ -3414,7 +3458,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1685 + src/jquery.gridster.js:1703

        @@ -3531,7 +3575,7 @@ detect row or column that we want to go.

        - src/jquery.gridster.js:1148 + src/jquery.gridster.js:1158

        @@ -3659,7 +3703,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:2087 + src/jquery.gridster.js:2113

        @@ -3730,7 +3774,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:1226 + src/jquery.gridster.js:1236

        @@ -3801,7 +3845,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:975 + src/jquery.gridster.js:985

        @@ -3888,7 +3932,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:894 + src/jquery.gridster.js:904

        @@ -4013,7 +4057,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:913 + src/jquery.gridster.js:923

        @@ -4138,7 +4182,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:867 + src/jquery.gridster.js:877

        @@ -4257,7 +4301,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:881 + src/jquery.gridster.js:891

        @@ -4367,7 +4411,7 @@ theupperrowsarray. Iteration starts from row specified insrc/jquery.gridster.js:835 + src/jquery.gridster.js:845

        @@ -4495,7 +4539,7 @@ HTMLElements.

        - src/jquery.gridster.js:852 + src/jquery.gridster.js:862

        @@ -4621,7 +4665,7 @@ and col given.

        - src/jquery.gridster.js:933 + src/jquery.gridster.js:943

        @@ -4747,7 +4791,7 @@ else returns the jQuery HTMLElement - src/jquery.gridster.js:958 + src/jquery.gridster.js:968

        @@ -4879,7 +4923,7 @@ params and if this is under the widget that is being dragged.

        - src/jquery.gridster.js:789 + src/jquery.gridster.js:799

        @@ -5021,7 +5065,7 @@ each widget) in descending way.

        - src/jquery.gridster.js:1410 + src/jquery.gridster.js:1423

        @@ -5050,7 +5094,8 @@ each widget) in descending way.

        -

        The jQuery object representing the widget you want to move.

        +

        The jQuery object representing the widget + you want to move.

        @@ -5140,7 +5185,7 @@ each widget) in descending way.

        - src/jquery.gridster.js:1321 + src/jquery.gridster.js:1331

        @@ -5171,7 +5216,8 @@ if they can.

        -

        The jQuery wrapped HTMLElement of the widget is going to be moved.

        +

        The jQuery wrapped HTMLElement of the +widget is going to be moved.

        @@ -5252,7 +5298,7 @@ if they can.

        - src/jquery.gridster.js:1364 + src/jquery.gridster.js:1375

        @@ -5378,7 +5424,7 @@ if they can.

        - src/jquery.gridster.js:159 + src/jquery.gridster.js:163

        @@ -5500,7 +5546,7 @@ if they can.

        - src/jquery.gridster.js:452 + src/jquery.gridster.js:461

        @@ -5544,8 +5590,7 @@ if they can.

        -

        prepared ui object. - See http://jqueryui.com/demos/draggable/ for more info.

        +

        prepared ui object.

        @@ -5613,7 +5658,7 @@ if they can.

        - src/jquery.gridster.js:545 + src/jquery.gridster.js:555

        @@ -5741,7 +5786,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:585 + src/jquery.gridster.js:595

        @@ -5865,7 +5910,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:400 + src/jquery.gridster.js:410

        @@ -5909,8 +5954,7 @@ overlapped or stops being overlapped.

        -

        prepared ui object. - See http://jqueryui.com/demos/draggable/ for more info.

        +

        prepared ui object.

        @@ -5972,7 +6016,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:1259 + src/jquery.gridster.js:1269

        @@ -6076,7 +6120,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:1271 + src/jquery.gridster.js:1281

        @@ -6182,7 +6226,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:489 + src/jquery.gridster.js:499

        @@ -6226,8 +6270,7 @@ overlapped or stops being overlapped.

        -

        prepared ui object. - See http://jqueryui.com/demos/draggable/ for more info.

        +

        prepared ui object.

        @@ -6289,7 +6332,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:1283 + src/jquery.gridster.js:1293

        @@ -6393,7 +6436,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:1301 + src/jquery.gridster.js:1311

        @@ -6487,7 +6530,7 @@ overlapped or stops being overlapped.

        - src/jquery.gridster.js:2063 + src/jquery.gridster.js:2089

        @@ -6559,7 +6602,7 @@ the browser is resized.

        - src/jquery.gridster.js:265 + src/jquery.gridster.js:272

        @@ -6641,7 +6684,7 @@ mapped array of positions.

        - src/jquery.gridster.js:329 + src/jquery.gridster.js:336

        @@ -6746,7 +6789,7 @@ mapped array of positions.

        - src/jquery.gridster.js:201 + src/jquery.gridster.js:205

        @@ -6850,7 +6893,7 @@ mapped array of positions.

        - src/jquery.gridster.js:231 + src/jquery.gridster.js:237

        @@ -6948,7 +6991,7 @@ mapped array of positions.

        - src/jquery.gridster.js:253 + src/jquery.gridster.js:259

        @@ -6959,7 +7002,8 @@ mapped array of positions.

        -

        Returns a serialized array of the widgets that have changed their position.

        +

        Returns a serialized array of the widgets that have changed their + position.

        @@ -7036,7 +7080,7 @@ mapped array of positions.

        - src/jquery.gridster.js:1573 + src/jquery.gridster.js:1589

        @@ -7145,7 +7189,7 @@ mapped array of positions.

        - src/jquery.gridster.js:1927 + src/jquery.gridster.js:1947

        @@ -7232,7 +7276,7 @@ mapped array of positions.

        - src/jquery.gridster.js:997 + src/jquery.gridster.js:1007

        @@ -7359,7 +7403,7 @@ mapped array of positions.

        - src/jquery.gridster.js:621 + src/jquery.gridster.js:631

        @@ -7480,7 +7524,7 @@ mapped array of positions.

        - src/jquery.gridster.js:710 + src/jquery.gridster.js:720

        @@ -7585,7 +7629,7 @@ each widget) in ascending way.

        - src/jquery.gridster.js:750 + src/jquery.gridster.js:760

        @@ -7690,7 +7734,7 @@ coords of each widget) in ascending way.

        - src/jquery.gridster.js:730 + src/jquery.gridster.js:740

        @@ -7795,7 +7839,7 @@ each widget) placing first the empty cells upper left.

        - src/jquery.gridster.js:770 + src/jquery.gridster.js:780

        @@ -7906,7 +7950,7 @@ each widget) in descending way.

        - src/jquery.gridster.js:308 + src/jquery.gridster.js:315

        @@ -8029,7 +8073,7 @@ the grid coords object passed in the grid_data param.

        - src/jquery.gridster.js:1544 + src/jquery.gridster.js:1560

        @@ -8133,7 +8177,7 @@ the grid coords object passed in the grid_data param.

        - src/jquery.gridster.js:674 + src/jquery.gridster.js:684

        diff --git a/docs/data.json b/docs/data.json index 63b56646c8..b050d5dd75 100644 --- a/docs/data.json +++ b/docs/data.json @@ -5,7 +5,7 @@ "name": "src/jquery.collision.js", "modules": {}, "classes": { - "Collision": 1 + "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.": 1 }, "fors": {}, "namespaces": {} @@ -14,7 +14,7 @@ "name": "src/jquery.coords.js", "modules": {}, "classes": { - "Coords": 1 + "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.": 1 }, "fors": {}, "namespaces": {} @@ -40,54 +40,51 @@ }, "modules": {}, "classes": { - "Collision": { - "name": "Collision", - "shortname": "Collision", + "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.": { + "name": "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", + "shortname": "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], - "extension_for": [ - "Gridster" - ], + "extension_for": [], "file": "src/jquery.collision.js", - "line": 22, - "description": "Collision", + "line": 19, "uses": [ "Coords" ], "params": [ { - "name": "element", - "description": "An Attribute name or object property path", + "name": "el", + "description": "The jQuery wrapped HTMLElement.", "type": "HTMLElement" }, { "name": "colliders", - "description": "An Attribute name or object property path", - "type": "String|HTMLElement|Array" + "description": "Can be a jQuery collection\n of HTMLElements or an Array of Coords instances.", + "type": "HTMLElement|Array" }, { "name": "options", - "description": "An Attribute name or object property path", + "description": "An Object with all options you want to\n overwrite:", "type": "Object", "optional": true, "props": [ - { - "name": "on_overlap", - "description": "An Attribute name or object property path", - "type": "Function", - "optional": true - }, { "name": "on_overlap_start", - "description": "An Attribute name or object property path", + "description": "Executes a function the first\n time each `collider ` is overlapped.", "type": "Function", "optional": true }, { "name": "on_overlap_stop", - "description": "An Attribute name or object property path", + "description": "Executes a function when a\n `collider` is no longer collided.", + "type": "Function", + "optional": true + }, + { + "name": "on_overlap", + "description": "Executes a function when the\nmouse is moved during the collision.", "type": "Function", "optional": true } @@ -95,32 +92,32 @@ } ], "return": { - "description": "dasdasdadasd", + "description": "Collision instance.", "type": "Object" }, "is_constructor": 1 }, - "Coords": { - "name": "Coords", - "shortname": "Coords", + "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.": { + "name": "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", + "shortname": "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], - "extension_for": [ - "Collision", - "Gridster" - ], + "extension_for": [], "file": "src/jquery.coords.js", "line": 10, - "description": "Coords", "params": [ { "name": "obj", - "description": "HTMLElement or a literal Object with the left, top, width and height properties.", + "description": "The jQuery HTMLElement or a object with: left,\ntop, width and height properties.", "type": "HTMLElement|Object" } ], + "return": { + "description": "Coords instance.", + "type": "Object" + }, "is_constructor": 1 }, "Draggable": { @@ -130,10 +127,72 @@ "plugins": [], "extensions": [], "plugin_for": [], - "extension_for": [], + "extension_for": [ + "Gridster" + ], "file": "src/jquery.draggable.js", "line": 24, - "description": "Draggable", + "params": [ + { + "name": "el", + "description": "The HTMLelement that contains all the widgets\n to be dragged.", + "type": "HTMLElement" + }, + { + "name": "options", + "description": "An Object with all options you want to\n overwrite:", + "type": "Object", + "optional": true, + "props": [ + { + "name": "items", + "description": "Define who will\n be the draggable items. Can be a CSS Selector String or a\n collection of HTMLElements.", + "type": "HTMLElement|String", + "optional": true + }, + { + "name": "distance", + "description": "Distance in pixels after mousedown\n the mouse must move before dragging should start.", + "type": "Number", + "optional": true + }, + { + "name": "limit", + "description": "Constrains dragging to the width of\n the container", + "type": "Boolean", + "optional": true + }, + { + "name": "offset_left", + "description": "Offset added to the item\n that is being dragged.", + "type": "Offset_left", + "optional": true + }, + { + "name": "drag", + "description": "Executes a callback when the mouse is\n moved during the dragging.", + "type": "Number", + "optional": true + }, + { + "name": "start", + "description": "Executes a callback when the drag\n starts.", + "type": "Number", + "optional": true + }, + { + "name": "stop", + "description": "Executes a callback when the drag stops.", + "type": "Number", + "optional": true + } + ] + } + ], + "return": { + "description": "Returns `el`.", + "type": "Object" + }, "is_constructor": 1 }, "Gridster": { @@ -147,7 +206,7 @@ "file": "src/jquery.gridster.js", "line": 33, "uses": [ - "Coords", + "Draggable", "Collision" ], "params": [ @@ -224,11 +283,17 @@ }, { "name": "draggable", - "description": "An Object with all options for\n jQuery UI Draggable you want to overwrite. See\n http://jqueryui.com/demos/draggable/ for more info.", + "description": "An Object with all options for\n Draggable class you want to overwrite. See Draggable docs for more\n info.", "type": "Object", "optional": true } ] + }, + { + "name": "avoid_overlapped_widgets", + "description": "Avoid that widgets loaded\n from the DOM can be overlapped. It is helpful if the positions were\n bad stored in the database or if there was any conflict.", + "type": "Boolean", + "optional": true } ], "is_constructor": 1 @@ -237,7 +302,7 @@ "classitems": [ { "file": "src/jquery.gridster.js", - "line": 105, + "line": 108, "description": "Disable dragging.", "itemtype": "method", "name": "enable", @@ -249,7 +314,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 117, + "line": 121, "description": "Enable dragging.", "itemtype": "method", "name": "enable", @@ -261,7 +326,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 129, + "line": 133, "description": "Add a new widget to the grid.", "itemtype": "method", "name": "add_widget", @@ -290,7 +355,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 159, + "line": 163, "description": "Get the most left column below to add a new widget.", "itemtype": "method", "name": "next_position", @@ -314,7 +379,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 201, + "line": 205, "description": "Remove a widget from the grid.", "itemtype": "method", "name": "remove_widget", @@ -333,7 +398,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 231, + "line": 237, "description": "Returns a serialized array of the widgets in the grid.", "itemtype": "method", "name": "serialize", @@ -353,8 +418,8 @@ }, { "file": "src/jquery.gridster.js", - "line": 253, - "description": "Returns a serialized array of the widgets that have changed their position.", + "line": 259, + "description": "Returns a serialized array of the widgets that have changed their\n position.", "itemtype": "method", "name": "serialize_changed", "return": { @@ -365,7 +430,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 265, + "line": 272, "description": "Creates the grid coords object representing the widget a add it to the\nmapped array of positions.", "itemtype": "method", "name": "register_widget", @@ -377,7 +442,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 308, + "line": 315, "description": "Update in the mapped array of positions the value of cells represented by\nthe grid coords object passed in the `grid_data` param.", "params": [ { @@ -401,7 +466,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 329, + "line": 336, "description": "Remove a widget from the mapped array of positions.", "itemtype": "method", "name": "remove_from_gridmap", @@ -420,7 +485,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 342, + "line": 349, "description": "Add a widget to the mapped array of positions.", "itemtype": "method", "name": "add_to_gridmap", @@ -444,8 +509,11 @@ }, { "file": "src/jquery.gridster.js", - "line": 364, - "description": "Make widgets draggable. It Wraps the jQuery UI Draggable Plugin.", + "line": 371, + "description": "Make widgets draggable.", + "uses": [ + "Draggable" + ], "itemtype": "method", "name": "draggable", "return": { @@ -456,7 +524,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 400, + "line": 410, "description": "This function is executed when the player begins to be dragged.", "itemtype": "method", "name": "on_start_drag", @@ -468,7 +536,7 @@ }, { "name": "A", - "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "description": "prepared ui object.", "type": "Object" } ], @@ -476,7 +544,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 452, + "line": 461, "description": "This function is executed when the player is being dragged.", "itemtype": "method", "name": "on_drag", @@ -488,7 +556,7 @@ }, { "name": "A", - "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "description": "prepared ui object.", "type": "Object" } ], @@ -496,7 +564,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 489, + "line": 499, "description": "This function is executed when the player stops being dragged.", "itemtype": "method", "name": "on_stop_drag", @@ -508,7 +576,7 @@ }, { "name": "A", - "description": "prepared ui object.\n See http://jqueryui.com/demos/draggable/ for more info.", + "description": "prepared ui object.", "type": "Object" } ], @@ -516,7 +584,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 545, + "line": 555, "description": "Executes the callbacks passed as arguments when a column begins to be\noverlapped or stops being overlapped.", "params": [ { @@ -540,7 +608,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 585, + "line": 595, "description": "Executes the callbacks passed as arguments when a row starts to be\noverlapped or stops being overlapped.", "params": [ { @@ -564,7 +632,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 621, + "line": 631, "description": "Sets the current position of the player", "params": [ { @@ -588,7 +656,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 674, + "line": 684, "description": "See which of the widgets in the $widgets param collection can go to\na upper row and which not.", "itemtype": "method", "name": "widgets_contraints", @@ -607,7 +675,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 710, + "line": 720, "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in ascending way.", "itemtype": "method", "name": "sort_by_row_asc", @@ -626,7 +694,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 730, + "line": 740, "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) placing first the empty cells upper left.", "itemtype": "method", "name": "sort_by_row_asc", @@ -645,7 +713,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 750, + "line": 760, "description": "Sorts an Array of grid coords objects by column (representing the grid\ncoords of each widget) in ascending way.", "itemtype": "method", "name": "sort_by_row_asc", @@ -664,7 +732,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 770, + "line": 780, "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", "itemtype": "method", "name": "sort_by_row_desc", @@ -683,7 +751,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 789, + "line": 799, "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", "itemtype": "method", "name": "manage_movements", @@ -712,7 +780,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 835, + "line": 845, "description": "Determines if there is a widget in the row and col given. Or if the\nHTMLElement passed as first argument is the player.", "itemtype": "method", "name": "is_player", @@ -737,7 +805,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 852, + "line": 862, "description": "Determines if the widget that is being dragged is currently over the row\nand col given.", "itemtype": "method", "name": "is_player_in", @@ -761,7 +829,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 867, + "line": 877, "description": "Determines if the placeholder is currently over the row and col given.", "itemtype": "method", "name": "is_placeholder_in", @@ -785,7 +853,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 881, + "line": 891, "description": "Determines if the placeholder is currently over the column given.", "itemtype": "method", "name": "is_placeholder_in_col", @@ -804,7 +872,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 894, + "line": 904, "description": "Determines if the cell represented by col and row params is empty.", "itemtype": "method", "name": "is_empty", @@ -828,7 +896,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 913, + "line": 923, "description": "Determines if the cell represented by col and row params is occupied.", "itemtype": "method", "name": "is_occupied", @@ -852,7 +920,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 933, + "line": 943, "description": "Determines if there is a widget in the cell represented by col/row params.", "itemtype": "method", "name": "is_widget", @@ -876,7 +944,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 958, + "line": 968, "description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.", "itemtype": "method", "name": "is_widget_under_player", @@ -900,7 +968,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 975, + "line": 985, "description": "Get widgets overlapping with the player.", "itemtype": "method", "name": "get_widgets_under_player", @@ -912,7 +980,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 997, + "line": 1007, "description": "Put placeholder at the row and column specified.", "itemtype": "method", "name": "set_placeholder", @@ -936,7 +1004,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1048, + "line": 1056, "description": "Determines whether the player can move to a position above.", "itemtype": "method", "name": "can_go_player_up", @@ -955,7 +1023,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1097, + "line": 1105, "description": "Determines whether a widget can move to a position above.", "itemtype": "method", "name": "can_go_widget_up", @@ -974,7 +1042,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1148, + "line": 1158, "description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.", "itemtype": "method", "name": "get_valid_rows", @@ -1003,7 +1071,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1226, + "line": 1236, "description": "Get widgets overlapping with the player.", "itemtype": "method", "name": "get_widgets_overlapped", @@ -1015,7 +1083,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1259, + "line": 1269, "description": "This callback is executed when the player begins to collide with a column.", "itemtype": "method", "name": "on_start_overlapping_column", @@ -1034,7 +1102,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1271, + "line": 1281, "description": "A callback executed when the player begins to collide with a row.", "itemtype": "method", "name": "on_start_overlapping_row", @@ -1053,7 +1121,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1283, + "line": 1293, "description": "A callback executed when the the player ends to collide with a column.", "itemtype": "method", "name": "on_stop_overlapping_column", @@ -1072,7 +1140,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1301, + "line": 1311, "description": "This callback is executed when the player ends to collide with a row.", "itemtype": "method", "name": "on_stop_overlapping_row", @@ -1091,14 +1159,14 @@ }, { "file": "src/jquery.gridster.js", - "line": 1321, + "line": 1331, "description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.", "itemtype": "method", "name": "move_widget_to", "params": [ { "name": "$widget", - "description": "The jQuery wrapped HTMLElement of the widget is going to be moved.", + "description": "The jQuery wrapped HTMLElement of the\nwidget is going to be moved.", "type": "HTMLElement" } ], @@ -1110,7 +1178,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1364, + "line": 1375, "description": "Move up the specified widget and all below it.", "itemtype": "method", "name": "move_widget_up", @@ -1135,14 +1203,14 @@ }, { "file": "src/jquery.gridster.js", - "line": 1410, + "line": 1423, "description": "Move down the specified widget and all below it.", "itemtype": "method", "name": "move_widget_down", "params": [ { "name": "$widget", - "description": "The jQuery object representing the widget you want to move.", + "description": "The jQuery object representing the widget\n you want to move.", "type": "HTMLElement" }, { @@ -1159,7 +1227,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1455, + "line": 1469, "description": "Check if the widget can move to the specified row, else returns the\nupper row possible.", "itemtype": "method", "name": "can_go_up_to_row", @@ -1188,7 +1256,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1544, + "line": 1560, "description": "Get widgets below a widget.", "itemtype": "method", "name": "widgets_below", @@ -1207,7 +1275,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1573, + "line": 1589, "description": "Update the array of mapped positions with the new player position.", "itemtype": "method", "name": "set_cells_player_occupies", @@ -1231,7 +1299,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1590, + "line": 1606, "description": "Remove from the array of mapped positions the reference to the player.", "itemtype": "method", "name": "empty_cells_player_occupies", @@ -1243,8 +1311,8 @@ }, { "file": "src/jquery.gridster.js", - "line": 1627, - "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid coords\n object) the widget occupies.", + "line": 1644, + "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid\n coords object) the widget occupies.", "itemtype": "method", "name": "can_move_to", "params": [ @@ -1272,8 +1340,8 @@ }, { "file": "src/jquery.gridster.js", - "line": 1667, - "description": "Given the leftmost column returns all columns that are overlapping with the player.", + "line": 1684, + "description": "Given the leftmost column returns all columns that are overlapping\n with the player.", "itemtype": "method", "name": "get_targeted_columns", "params": [ @@ -1292,7 +1360,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1685, + "line": 1703, "description": "Given the upper row returns all rows that are overlapping with the player.", "itemtype": "method", "name": "get_targeted_rows", @@ -1312,7 +1380,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1702, + "line": 1720, "description": "Get all columns and rows that a widget occupies.", "itemtype": "method", "name": "get_cells_occupied", @@ -1331,7 +1399,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1730, + "line": 1748, "description": "Iterate over the cells occupied by a widget executing a function for\neach one.", "itemtype": "method", "name": "for_each_cell_occupied", @@ -1355,7 +1423,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1751, + "line": 1769, "description": "Iterate over the columns occupied by a widget executing a function for\neach one.", "itemtype": "method", "name": "for_each_column_occupied", @@ -1379,7 +1447,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1770, + "line": 1788, "description": "Iterate over the rows occupied by a widget executing a function for\neach one.", "itemtype": "method", "name": "for_each_row_occupied", @@ -1391,7 +1459,7 @@ }, { "name": "callback", - "description": "The function to execute on each column iteration. The row number is passed as first argument.", + "description": "The function to execute on each column\n iteration. The row number is passed as first argument.", "type": "Function" } ], @@ -1403,7 +1471,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1836, + "line": 1855, "description": "Iterate over each widget above the column and row specified.", "itemtype": "method", "name": "for_each_widget_above", @@ -1420,7 +1488,7 @@ }, { "name": "callback", - "description": "The function to execute on each widget\niteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.", + "description": "The function to execute on each widget\n iteration. The value of `this` inside the function is the jQuery\n wrapped HTMLElement.", "type": "Function" } ], @@ -1432,7 +1500,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1852, + "line": 1872, "description": "Iterate over each widget below the column and row specified.", "itemtype": "method", "name": "for_each_widget_below", @@ -1449,7 +1517,7 @@ }, { "name": "callback", - "description": "The function to execute on each widget\niteration. The value of `this` inside the function is the jQuery wrapped HTMLElement.", + "description": "The function to execute on each widget\n iteration. The value of `this` inside the function is the jQuery wrapped\n HTMLElement.", "type": "Function" } ], @@ -1461,7 +1529,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1868, + "line": 1889, "description": "Returns the highest occupied cell in the grid.", "itemtype": "method", "name": "get_highest_occupied_cell", @@ -1473,7 +1541,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1927, + "line": 1947, "description": "Set the current height of the parent grid.", "itemtype": "method", "name": "set_dom_grid_height", @@ -1485,7 +1553,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 1941, + "line": 1960, "description": "It generates the neccessary styles to position the widgets.", "itemtype": "method", "name": "generate_stylesheet", @@ -1509,7 +1577,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 2004, + "line": 2030, "description": "Injects the given CSS as string to the head of the document.", "itemtype": "method", "name": "add_style_tag", @@ -1528,7 +1596,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 2027, + "line": 2053, "description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.", "itemtype": "method", "name": "generate_faux_grid", @@ -1552,7 +1620,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 2063, + "line": 2089, "description": "Recalculates the offsets for the faux grid. You need to use it when\nthe browser is resized.", "itemtype": "method", "name": "recalculate_faux_grid", @@ -1564,7 +1632,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 2087, + "line": 2113, "description": "Get all widgets in the DOM and register them.", "itemtype": "method", "name": "get_widgets_from_DOM", @@ -1576,7 +1644,7 @@ }, { "file": "src/jquery.gridster.js", - "line": 2101, + "line": 2127, "description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...", "itemtype": "method", "name": "generate_grid_and_stylesheet", diff --git a/docs/files/src_jquery.collision.js.html b/docs/files/src_jquery.collision.js.html index 0d078d2bd7..6e0eeefb54 100644 --- a/docs/files/src_jquery.collision.js.html +++ b/docs/files/src_jquery.collision.js.html @@ -42,9 +42,25 @@
          -
        • Collision
        • +
        • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
        • -
        • Coords
        • +
        • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
        • Draggable
        • @@ -104,198 +120,216 @@ ;(function($, window, document, undefined){ var defaults = { - colliders_context: document.body, - on_overlap: function(collider_data){}, - on_overlap_start : function(collider_data){ - // console.log('the element START being a collider', collider_data); - }, - on_overlap_stop : function(collider_data){ - // console.log('the element STOP being a collider', collider_data); - } + colliders_context: document.body + // ,on_overlap: function(collider_data){}, + // on_overlap_start : function(collider_data){}, + // on_overlap_stop : function(collider_data){} }; + /** - * Collision - * * @class Collision + * + * Detects collisions between a DOM element against other DOM elements or + * Coords objects. + * * @uses Coords - * @param {HTMLElement} element An Attribute name or object property path - * @param {String|HTMLElement|Array} colliders An Attribute name or object property path - * @param {Object} [options] An Attribute name or object property path - * @param {Function} [options.on_overlap] An Attribute name or object property path - * @param {Function} [options.on_overlap_start] An Attribute name or object property path - * @param {Function} [options.on_overlap_stop] An Attribute name or object property path - * @return {Object} dasdasdadasd + * @param {HTMLElement} el The jQuery wrapped HTMLElement. + * @param {HTMLElement|Array} colliders Can be a jQuery collection + * of HTMLElements or an Array of Coords instances. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {Function} [options.on_overlap_start] Executes a function the first + * time each `collider ` is overlapped. + * @param {Function} [options.on_overlap_stop] Executes a function when a + * `collider` is no longer collided. + * @param {Function} [options.on_overlap] Executes a function when the + * mouse is moved during the collision. + * @return {Object} Collision instance. * @constructor */ - function Collision(element, colliders, options) { - this.options = $.extend(defaults, options); - this.$element = element; - this.last_colliders = []; - this.last_colliders_coords = []; - if (typeof colliders === 'string' || colliders instanceof jQuery) { - this.$colliders = $(colliders, - this.options.colliders_context).not(this.$element); - }else{ - this.colliders = $(colliders); - } + function Collision(el, colliders, options) { + this.options = $.extend(defaults, options); + this.$element = el; + this.last_colliders = []; + this.last_colliders_coords = []; + if (typeof colliders === 'string' || colliders instanceof jQuery) { + this.$colliders = $(colliders, + this.options.colliders_context).not(this.$element); + }else{ + this.colliders = $(colliders); + } - this.init(); + this.init(); } + var fn = Collision.prototype; + fn.init = function() { - this.find_collisions(); + this.find_collisions(); }; + fn.overlaps = function(a, b) { - var x = false; - var y = false; + var x = false; + var y = false; - if ((b.x1 >= a.x1 && b.x1 <= a.x2) || - (b.x2 >= a.x1 && b.x2 <= a.x2) || - (a.x1 >= b.x1 && a.x2 <= b.x2) - ) { x = true; } + if ((b.x1 >= a.x1 && b.x1 <= a.x2) || + (b.x2 >= a.x1 && b.x2 <= a.x2) || + (a.x1 >= b.x1 && a.x2 <= b.x2) + ) { x = true; } - if ((b.y1 >= a.y1 && b.y1 <= a.y2) || - (b.y2 >= a.y1 && b.y2 <= a.y2) || - (a.y1 >= b.y1 && a.y2 <= b.y2) - ) { y = true; } + if ((b.y1 >= a.y1 && b.y1 <= a.y2) || + (b.y2 >= a.y1 && b.y2 <= a.y2) || + (a.y1 >= b.y1 && a.y2 <= b.y2) + ) { y = true; } - return (x && y); + return (x && y); }; + fn.detect_overlapping_region = function(a, b){ - var regionX = ''; - var regionY = ''; + var regionX = ''; + var regionY = ''; - if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } - if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } - if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } - if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } + if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; } + if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; } + if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; } + if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; } - return (regionX + regionY) || 'C'; + return (regionX + regionY) || 'C'; }; + fn.calculate_overlapped_area_coords = function(a, b){ - var x1 = Math.max(a.x1, b.x1); - var y1 = Math.max(a.y1, b.y1); - var x2 = Math.min(a.x2, b.x2); - var y2 = Math.min(a.y2, b.y2); + var x1 = Math.max(a.x1, b.x1); + var y1 = Math.max(a.y1, b.y1); + var x2 = Math.min(a.x2, b.x2); + var y2 = Math.min(a.y2, b.y2); - return $({ - left: x1, - top: y1, - width : (x2 - x1), - height: (y2 - y1) - }).coords().get(); + return $({ + left: x1, + top: y1, + width : (x2 - x1), + height: (y2 - y1) + }).coords().get(); }; + fn.calculate_overlapped_area = function(coords){ - return (coords.width * coords.height); + return (coords.width * coords.height); }; + fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){ - var last = this.last_colliders_coords; + var last = this.last_colliders_coords; - for (var i = 0, il = last.length; i < il; i++) { - if ($.inArray(last[i], new_colliders_coords) === -1) { - start_callback.call(this, last[i]); - } - } + for (var i = 0, il = last.length; i < il; i++) { + if ($.inArray(last[i], new_colliders_coords) === -1) { + start_callback.call(this, last[i]); + } + } - for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { - if ($.inArray(new_colliders_coords[j], last) === -1) { - stop_callback.call(this, new_colliders_coords[j]); - } + for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) { + if ($.inArray(new_colliders_coords[j], last) === -1) { + stop_callback.call(this, new_colliders_coords[j]); + } - } + } }; + fn.find_collisions = function(player_data_coords){ - var self = this; - var colliders_coords = []; - var colliders_data = []; - var $colliders = (this.colliders || this.$colliders); - var count = $colliders.length; - var player_coords = self.$element.coords().update(player_data_coords || false).get(); + var self = this; + var colliders_coords = []; + var colliders_data = []; + var $colliders = (this.colliders || this.$colliders); + var count = $colliders.length; + var player_coords = self.$element.coords() + .update(player_data_coords || false).get(); - while(count--){ - var $collider = self.$colliders ? $($colliders[count]) : $colliders[count]; - var $collider_coords_ins = ($collider.isCoords) ? - $collider : $collider.coords(); - var collider_coords = $collider_coords_ins.get(); - var overlaps = self.overlaps(player_coords, collider_coords); + while(count--){ + var $collider = self.$colliders ? + $($colliders[count]) : $colliders[count]; + var $collider_coords_ins = ($collider.isCoords) ? + $collider : $collider.coords(); + var collider_coords = $collider_coords_ins.get(); + var overlaps = self.overlaps(player_coords, collider_coords); - if (!overlaps) { - continue; + if (!overlaps) { + continue; + } + + var region = self.detect_overlapping_region( + player_coords, collider_coords); + + //todo: make this an option + if (region === 'C'){ + var area_coords = self.calculate_overlapped_area_coords( + player_coords, collider_coords); + var area = self.calculate_overlapped_area(area_coords); + var collider_data = { + area: area, + area_coords : area_coords, + region: region, + coords: collider_coords, + player_coords: player_coords, + el: $collider + }; + + if (self.options.on_overlap) { + self.options.on_overlap.call(this, collider_data); + } + colliders_coords.push($collider_coords_ins); + colliders_data.push(collider_data); + } } - var region = self.detect_overlapping_region(player_coords, - collider_coords); - //todo: make this if customizable - if (region === 'C'){ - var area_coords = self.calculate_overlapped_area_coords( - player_coords, collider_coords); - var area = self.calculate_overlapped_area(area_coords); - var collider_data = { - area: area, - area_coords : area_coords, - region: region, - coords: collider_coords, - player_coords: player_coords, - el: $collider - }; - - self.options.on_overlap.call(this, collider_data); - colliders_coords.push($collider_coords_ins); - colliders_data.push(collider_data); + if (self.options.on_overlap_stop || self.options.on_overlap_start) { + this.manage_colliders_start_stop(colliders_coords, + self.options.on_overlap_stop, self.options.on_overlap_start); } - } + this.last_colliders_coords = colliders_coords; - this.manage_colliders_start_stop(colliders_coords, - self.options.on_overlap_stop, self.options.on_overlap_start); - - this.last_colliders_coords = colliders_coords; - - return colliders_data; + return colliders_data; }; fn.get_closest_colliders = function(player_data_coords){ - var colliders = this.find_collisions(player_data_coords); - var min_area = 100; - colliders.sort(function(a, b){ + var colliders = this.find_collisions(player_data_coords); + var min_area = 100; + colliders.sort(function(a, b){ + if (a.area <= min_area) { + return 1; + } - if (a.area <= min_area) { - return 1; - } + /* if colliders are being overlapped by the "C" (center) region, + * we have to set a lower index in the array to which they are placed + * above in the grid. */ + if (a.region === 'C' && b.region === 'C') { + if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { + return - 1; + }else{ + return 1; + } + } - /* if colliders are being overlapped by the "C" (center) region, - * we have to set a lower index in the array to which they are placed - * above in the grid. */ - if (a.region === 'C' && b.region === 'C') { - if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) { - return - 1; - }else{ + if (a.area < b.area){ return 1; } - } - if (a.area < b.area){ - return 1; - } - - return 1; - }); - return colliders; + return 1; + }); + return colliders; }; + //jQuery adapter $.fn.collision = function(collider, options) { - return new Collision( this, collider, options ); + return new Collision( this, collider, options ); }; diff --git a/docs/files/src_jquery.coords.js.html b/docs/files/src_jquery.coords.js.html index ef5dd34b99..a7fe8710dc 100644 --- a/docs/files/src_jquery.coords.js.html +++ b/docs/files/src_jquery.coords.js.html @@ -42,9 +42,25 @@
            -
          • Collision
          • +
          • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
          • -
          • Coords
          • +
          • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
          • Draggable
          • @@ -103,10 +119,16 @@ ;(function($, window, document, undefined){ /** - * Coords - * * @class Coords - * @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties. + * + * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) + * to simulate DOM elements on the screen. + * Coords is used by Gridster to create a faux grid with any DOM element can + * collide. + * + * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left, + * top, width and height properties. + * @return {Object} Coords instance. * @constructor */ function Coords(obj) { @@ -122,8 +144,10 @@ return this; } + var fn = Coords.prototype; + fn.init = function(){ this.set(); this.original_coords = this.get(); @@ -181,6 +205,7 @@ return this.coords; }; + //jQuery adapter $.fn.coords = function() { if (this.data('coords') ) { diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index 01b39af04c..c87d7bac27 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -42,9 +42,25 @@
              -
            • Collision
            • +
            • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
            • -
            • Coords
            • +
            • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
            • Draggable
            • @@ -107,24 +123,42 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0, - drag: function(e){}, - start : function(e, ui){}, - stop : function(e){} + offset_left: 0 + // ,drag: function(e){}, + // start : function(e, ui){}, + // stop : function(e){} }; var $body = $(document.body); /** - * Draggable - * * @class Draggable + * + * @param {HTMLElement} el The HTMLelement that contains all the widgets + * to be dragged. + * @param {Object} [options] An Object with all options you want to + * overwrite: + * @param {HTMLElement|String} [options.items] Define who will + * be the draggable items. Can be a CSS Selector String or a + * collection of HTMLElements. + * @param {Number} [options.distance] Distance in pixels after mousedown + * the mouse must move before dragging should start. + * @param {Boolean} [options.limit] Constrains dragging to the width of + * the container + * @param {offset_left} [options.offset_left] Offset added to the item + * that is being dragged. + * @param {Number} [options.drag] Executes a callback when the mouse is + * moved during the dragging. + * @param {Number} [options.start] Executes a callback when the drag + * starts. + * @param {Number} [options.stop] Executes a callback when the drag stops. + * @return {Object} Returns `el`. * @constructor */ - function Draggable(element, options) { - this.options = $.extend(defaults, options); - this.$container = $(element); + function Draggable(el, options) { + this.options = $.extend({}, defaults, options); + this.$container = $(el); this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; @@ -139,6 +173,7 @@ this.enable(); }; + fn.get_actual_pos = function($el) { var pos = $el.position(); return pos; @@ -154,6 +189,10 @@ fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + }; + var self = this; var first = true; this.$player = $(e.currentTarget); @@ -162,6 +201,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); $body.on('mousemove.draggable', function(mme){ + var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 4df4a9e481..42645e3f95 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -42,9 +42,25 @@
                -
              • Collision
              • +
              • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
              • -
              • Coords
              • +
              • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
              • Draggable
              • @@ -109,7 +125,7 @@ extra_rows: 0, extra_cols: 0, min_cols: 1, - min_rows: 10, + min_rows: 15, autogenerate_stylesheet: true, avoid_overlapped_widgets: true, serialize_params: function($w, wgd) { @@ -127,7 +143,7 @@ /** * @class Gridster - * @uses Coords + * @uses Draggable * @uses Collision * @param {HTMLElement} el The HTMLelement that contains all the widgets. * @param {Object} [options] An Object with all options you want to @@ -153,6 +169,9 @@ * `<head>` of the document. You can set this to false, and write * your own CSS targeting rows and cols via data-attributes like so: * `[data-col="1"] { left: 10px; }` + * @param {Boolean} [avoid_overlapped_widgets] Avoid that widgets loaded + * from the DOM can be overlapped. It is helpful if the positions were + * bad stored in the database or if there was any conflict. * @param {Function} [options.serialize_params] Return the data you want * for each widget in the serialization. Two arguments are passed: * `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid @@ -161,8 +180,8 @@ * Collision class you want to overwrite. See Collision docs for * more info. * @param {Object} [options.draggable] An Object with all options for - * jQuery UI Draggable you want to overwrite. See - * http://jqueryui.com/demos/draggable/ for more info. + * Draggable class you want to overwrite. See Draggable docs for more + * info. * * @constructor */ @@ -170,7 +189,7 @@ this.options = $.extend(true, defaults, options); this.$el = $(el); this.$wrapper = this.$el.parent(); - this.$widgets = this.$el.find(this.options.widget_selector).addClass('gs_w'); + this.$widgets = $(this.options.widget_selector, this.$el).addClass('gs_w'); this.widgets = []; this.$changed = $([]); this.wrapper_width = this.$wrapper.width(); @@ -203,7 +222,8 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.disable = function(){ + fn.disable = function() { + this.$wrapper.find('.player-revert').removeClass('player-revert'); this.drag_api.disable(); return this; } @@ -215,7 +235,7 @@ * @method enable * @return {Class} Returns the instance of the Gridster Class. */ - fn.enable = function(){ + fn.enable = function() { this.drag_api.enable(); return this; } @@ -304,15 +324,17 @@ var $el = el instanceof jQuery ? el : $(el); var wgd = $el.coords().grid; + this.cells_occupied_by_placeholder = {}; this.$widgets = this.$widgets.not($el); var $nexts = this.widgets_below($el); this.remove_from_gridmap(wgd); - $el.fadeOut($.proxy(function(){ + $el.fadeOut($.proxy(function() { $el.remove(); - $nexts.each($.proxy(function(i, widget){ + + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( $(widget), wgd.size_y ); }, this)); @@ -336,9 +358,9 @@ fn.serialize = function($widgets) { $widgets || ($widgets = this.$widgets); var result = []; - $widgets.each($.proxy(function(i, widget){ - result.push( this.options.serialize_params( - $(widget),$(widget).coords().grid ) ); + $widgets.each($.proxy(function(i, widget) { + result.push(this.options.serialize_params( + $(widget), $(widget).coords().grid ) ); }, this)); return result; @@ -346,7 +368,8 @@ /** - * Returns a serialized array of the widgets that have changed their position. + * Returns a serialized array of the widgets that have changed their + * position. * * @method serialize_changed * @return {Array} Returns an Array of Objects with the data specified in @@ -376,7 +399,7 @@ if (this.options.avoid_overlapped_widgets && !this.can_move_to( - { size_x: wgd.size_x, size_y: wgd.size_y }, wgd.col, wgd.row) + {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row) ) { wgd = this.next_position(wgd.size_x, wgd.size_y); wgd.el = $el; @@ -429,7 +452,7 @@ * to update in the mapped array. * @return {Class} Returns the instance of the Gridster Class. */ - fn.remove_from_gridmap = function(grid_data){ + fn.remove_from_gridmap = function(grid_data) { return this.update_widget_position(grid_data, false); }; @@ -444,12 +467,12 @@ * position . * @return {Class} Returns the instance of the Gridster Class. */ - fn.add_to_gridmap = function(grid_data, value){ + fn.add_to_gridmap = function(grid_data, value) { this.update_widget_position(grid_data, value || grid_data.el); if (grid_data.el) { var $widgets = this.widgets_below(grid_data.el); - $widgets.each($.proxy(function(i, widget){ + $widgets.each($.proxy(function(i, widget) { this.move_widget_up( $(widget)); }, this)); } @@ -457,8 +480,9 @@ /** - * Make widgets draggable. It Wraps the jQuery UI Draggable Plugin. + * Make widgets draggable. * + * @uses Draggable * @method draggable * @return {Class} Returns the instance of the Gridster Class. */ @@ -468,7 +492,9 @@ offset_left: this.options.widget_margins[0], items: '.gs_w', start: function(event, ui) { - self.$widgets.filter('.player-revert').removeClass('player-revert'); + self.$widgets.filter('.player-revert') + .removeClass('player-revert'); + self.$player = $(this); self.$helper = self.options.draggable.helper === 'clone' ? $(ui.helper) : self.$player; @@ -498,7 +524,6 @@ * @method on_start_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_start_drag = function(event, ui) { @@ -550,14 +575,15 @@ * @method on_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_drag = function(event, ui) { var abs_offset = { left: ui.position.left + this.baseX, top: ui.position.top + this.baseY } - this.colliders_data = this.collision_api.get_closest_colliders(abs_offset); + + this.colliders_data = this.collision_api.get_closest_colliders( + abs_offset); this.on_overlapped_column_change( this.on_start_overlapping_column, @@ -587,10 +613,10 @@ * @method on_stop_drag * @param {Event} The original browser event * @param {Object} A prepared ui object. - * See http://jqueryui.com/demos/draggable/ for more info. */ fn.on_stop_drag = function(event, ui) { - this.$helper.add(this.$player).add(this.$wrapper).removeClass('dragging'); + this.$helper.add(this.$player).add(this.$wrapper) + .removeClass('dragging'); ui.position.left = ui.position.left + this.baseX; ui.position.top = ui.position.top + this.baseY; @@ -606,14 +632,14 @@ this.on_stop_overlapping_row ); - this.$player - .addClass('player-revert').removeClass('player').attr({ - 'data-col': this.placeholder_grid_data.col, - 'data-row': this.placeholder_grid_data.row - }).css({ - 'left': '', - 'top': '' - }); + this.$player.addClass('player-revert').removeClass('player') + .attr({ + 'data-col': this.placeholder_grid_data.col, + 'data-row': this.placeholder_grid_data.row + }).css({ + 'left': '', + 'top': '' + }); this.$changed = this.$changed.add(this.$player); @@ -782,7 +808,7 @@ var wgd_can_go_up = []; var wgd_can_not_go_up = []; - $widgets.each($.proxy(function(i, w){ + $widgets.each($.proxy(function(i, w) { var $w = $(w); var wgd = $w.coords().grid; if (this.can_go_widget_up(wgd)) { @@ -811,7 +837,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row) { return 1; } @@ -831,7 +857,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_and_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.row > b.row || a.row == b.row && a.col > b.col) { return 1; } @@ -851,7 +877,7 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_col_asc = function(widgets) { - widgets = widgets.sort(function(a, b){ + widgets = widgets.sort(function(a, b) { if (a.col > b.col) { return 1; } @@ -871,8 +897,8 @@ * @return {Array} Returns the array sorted. */ fn.sort_by_row_desc = function(widgets) { - widgets = widgets.sort(function(a, b){ - if (a.row + a.size_y < b.row + b.size_y){ + widgets = widgets.sort(function(a, b) { + if (a.row + a.size_y < b.row + b.size_y) { return 1; } return -1; @@ -893,7 +919,7 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.manage_movements = function($widgets, to_col, to_row) { - $.each($widgets, $.proxy(function(i, w){ + $.each($widgets, $.proxy(function(i, w) { var wgd = w; var $w = wgd.el; @@ -968,7 +994,7 @@ * @return {Boolean} Returns true or false. */ fn.is_placeholder_in = function(col, row) { - var c = this.cells_occupied_by_placeholder || []; + var c = this.cells_occupied_by_placeholder || {}; return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0; }; @@ -1077,9 +1103,9 @@ var cells = this.cells_occupied_by_player; var $widgets = $([]); - $.each(cells.cols, $.proxy(function(i, col){ - $.each(cells.rows, $.proxy(function(i, row){ - if(this.is_widget(col, row)){ + $.each(cells.cols, $.proxy(function(i, col) { + $.each(cells.rows, $.proxy(function(i, row) { + if(this.is_widget(col, row)) { $widgets = $widgets.add(this.gridmap[col][row]); } }, this)); @@ -1120,8 +1146,6 @@ this.placeholder_grid_data.col = col; this.placeholder_grid_data.row = row; - - this.cells_occupied_by_placeholder = this.get_cells_occupied( this.placeholder_grid_data); @@ -1131,9 +1155,9 @@ }); if (moved_down || changed_column) { - $nexts.each($.proxy(function(i, widget){ + $nexts.each($.proxy(function(i, widget) { this.move_widget_up( - $(widget), this.placeholder_grid_data.col - col + phgd.size_y); + $(widget), this.placeholder_grid_data.col - col + phgd.size_y); }, this)); } @@ -1158,12 +1182,12 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; var r = p_bottom_row + 1; upper_rows[tcol] = []; - while (--r > 0){ + while (--r > 0) { if (this.is_empty(tcol, r) || this.is_player(tcol, r) || this.is_widget(tcol, r) && grid_col[r].is($widgets_under_player) @@ -1206,7 +1230,7 @@ /* generate an array with columns as index and array with upper rows * empty as value */ - this.for_each_column_occupied(widget_grid_data, function(tcol){ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = this.gridmap[tcol]; upper_rows[tcol] = []; @@ -1217,7 +1241,9 @@ break; } - if (!this.is_player(tcol, r) &&!this.is_placeholder_in(tcol, r)) { + if (!this.is_player(tcol, r) && + !this.is_placeholder_in(tcol, r) + ) { upper_rows[tcol].push(r); } @@ -1253,7 +1279,7 @@ * @return {Number|Boolean} Returns the upper row valid from the `upper_rows` * for the widget in question. */ - fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row){ + fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) { var p_top_row = widget_grid_data.row; var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1; var size_y = widget_grid_data.size_y; @@ -1262,7 +1288,7 @@ while (++r <= p_bottom_row ) { var common = true; - $.each(upper_rows, function(col, rows){ + $.each(upper_rows, function(col, rows) { if (rows && $.inArray(r, rows) === -1) { common = false; } @@ -1331,8 +1357,8 @@ var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0); rows_from_bottom.reverse(); - $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col){ - $.each(rows_from_bottom, $.proxy(function(i, row){ + $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col) { + $.each(rows_from_bottom, $.proxy(function(i, row) { // if there is a widget in the player position if (!this.gridmap[col]) { return true; } //next iteration var $w = this.gridmap[col][row]; @@ -1419,7 +1445,8 @@ * if they can. * * @method move_widget_to - * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the widget is going to be moved. + * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the + * widget is going to be moved. * @return {Class} Returns the instance of the Gridster Class. */ fn.move_widget_to = function($widget, row) { @@ -1442,12 +1469,12 @@ this.$changed = this.$changed.add($widget); - $next_widgets.each(function(i, widget){ + $next_widgets.each(function(i, widget) { var $w = $(widget); var wgd = $w.coords().grid; var can_go_up = self.can_go_widget_up(wgd); - if (can_go_up && can_go_up !== wgd.row){ + if (can_go_up && can_go_up !== wgd.row) { self.move_widget_to($w, can_go_up); } }); @@ -1473,12 +1500,14 @@ if (!this.can_go_up($widget)) { return false; } //break; - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { // can_go_up if ($.inArray($widget, moved) === -1) { var widget_grid_data = $widget.coords().grid; var next_row = actual_row - y_units; - next_row = this.can_go_up_to_row(widget_grid_data, col, next_row); + next_row = this.can_go_up_to_row( + widget_grid_data, col, next_row); + if (!next_row) { return true; } @@ -1493,7 +1522,7 @@ moved.push($widget); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { this.move_widget_up($(widget), y_units); }, this)); } @@ -1506,7 +1535,8 @@ * Move down the specified widget and all below it. * * @method move_widget_down - * @param {HTMLElement} $widget The jQuery object representing the widget you want to move. + * @param {HTMLElement} $widget The jQuery object representing the widget + * you want to move. * @param {Number} The number of cells that the widget has to move. * @return {Class} Returns the instance of the Gridster Class. */ @@ -1526,7 +1556,7 @@ this.remove_from_gridmap(widget_grid_data); - $next_widgets.each($.proxy(function(i, widget){ + $next_widgets.each($.proxy(function(i, widget) { var $w = $(widget); var wd = $w.coords().grid; var tmp_y = this.displacement_diff( @@ -1566,13 +1596,14 @@ var actual_row = widget_grid_data.row; var r; - //generate an array with columns as index and array with upper rows empty in the column - this.for_each_column_occupied(widget_grid_data, function(tcol){ + /* generate an array with columns as index and array with + * upper rows empty in the column */ + this.for_each_column_occupied(widget_grid_data, function(tcol) { var grid_col = ga[tcol]; urc[tcol] = []; r = actual_row; - while (r--){ + while (r--) { if (this.is_empty(tcol, r) && !this.is_placeholder_in(tcol, r) ) { @@ -1591,7 +1622,8 @@ if (!result) { return false; } - //get common rows starting from upper position in all the columns widget occupies + /* get common rows starting from upper position in all the columns + * that widget occupies */ r = row; for (r = 1; r < actual_row; r++) { var common = true; @@ -1617,7 +1649,7 @@ var diffs = []; var parent_max_y = parent_bgd.row + parent_bgd.size_y; - this.for_each_column_occupied(widget_grid_data, function(col){ + this.for_each_column_occupied(widget_grid_data, function(col) { var temp_y_units = 0; for (var r = parent_max_y; r < actual_row; r++) { @@ -1650,9 +1682,9 @@ var next_row = el_grid_data.row + el_grid_data.size_y - 1; var $nexts = $([]); - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { self.for_each_widget_below(col, next_row, - function(tcol, trow){ + function(tcol, trow) { if (!self.is_player(this) && $.inArray(this, $nexts) === -1) { $nexts = $nexts.add(this); @@ -1704,7 +1736,8 @@ var result = true; if (initial_row === 1) { return false; } - this.for_each_column_occupied(el_grid_data, function(col){ + this.for_each_column_occupied(el_grid_data, function(col) { + var $w = this.is_widget(col, prev_row); if (this.is_occupied(col, prev_row) || this.is_player(col, prev_row) || this.is_placeholder_in(col, prev_row) @@ -1721,8 +1754,8 @@ /** * Check if it's possible to move a widget to a specific col/row. It takes - * into account the dimensions (`size_y` and `size_x` attrs. of the grid coords - * object) the widget occupies. + * into account the dimensions (`size_y` and `size_x` attrs. of the grid + * coords object) the widget occupies. * * @method can_move_to * @param {Object} widget_grid_data The grid coords object that represents @@ -1748,7 +1781,7 @@ return false; }; - this.for_each_cell_occupied(future_wd, function(tcol, trow){ + this.for_each_cell_occupied(future_wd, function(tcol, trow) { var $tw = this.is_widget(tcol, trow); if ($tw && (!widget_grid_data.el || $tw.is($w))) { result = false; @@ -1760,7 +1793,8 @@ /** - * Given the leftmost column returns all columns that are overlapping with the player. + * Given the leftmost column returns all columns that are overlapping + * with the player. * * @method get_targeted_columns * @param {Number} [from_col] The leftmost column. @@ -1834,8 +1868,8 @@ * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_cell_occupied = function(grid_data, callback) { - this.for_each_column_occupied(grid_data, function(col){ - this.for_each_row_occupied(grid_data, function(row){ + this.for_each_column_occupied(grid_data, function(col) { + this.for_each_row_occupied(grid_data, function(row) { callback.call(this, col, row); }); }); @@ -1869,7 +1903,8 @@ * @method for_each_row_occupied * @param {Object} el_grid_data The grid coords object that represents * the widget. - * @param {Function} callback The function to execute on each column iteration. The row number is passed as first argument. + * @param {Function} callback The function to execute on each column + * iteration. The row number is passed as first argument. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_row_occupied = function(el_grid_data, callback) { @@ -1935,7 +1970,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery + * wrapped HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_above = function(col, row, callback) { @@ -1951,7 +1987,8 @@ * @param {Number} col The column to start iterating. * @param {Number} row The row to start iterating. * @param {Function} callback The function to execute on each widget - * iteration. The value of `this` inside the function is the jQuery wrapped HTMLElement. + * iteration. The value of `this` inside the function is the jQuery wrapped + * HTMLElement. * @return {Class} Returns the instance of the Gridster Class. */ fn.for_each_widget_below = function(col, row, callback) { @@ -1992,14 +2029,13 @@ }; - fn.get_widgets_from = function(col, row) { var ga = this.gridmap; var $widgets = $(); if (col) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var tcol = $(this).attr('data-col'); return (tcol == col || tcol > col); }) @@ -2008,7 +2044,7 @@ if (row) { $widgets = $widgets.add( - this.$widgets.filter(function(){ + this.$widgets.filter(function() { var trow = $(this).attr('data-row'); return (trow == row || trow > row); }) @@ -2028,7 +2064,6 @@ fn.set_dom_grid_height = function() { var r = this.get_highest_occupied_cell().row; this.$el.css('height', r * this.min_widget_height); - // this.$widgets.draggable("option", "containment", this.$el); return this; }; @@ -2053,11 +2088,14 @@ opts.cols || (opts.cols = this.cols); opts.rows || (opts.rows = this.rows); opts.namespace || (opts.namespace = ''); - opts.widget_base_dimensions || (opts.widget_base_dimensions = this.options.widget_base_dimensions); - opts.widget_margins || (opts.widget_margins = this.options.widget_margins); - - opts.min_widget_width = (opts.widget_margins[0] * 2) + opts.widget_base_dimensions[0]; - opts.min_widget_height = (opts.widget_margins[1] * 2) + opts.widget_base_dimensions[1]; + opts.widget_base_dimensions || + (opts.widget_base_dimensions = this.options.widget_base_dimensions); + opts.widget_margins || + (opts.widget_margins = this.options.widget_margins); + opts.min_widget_width = (opts.widget_margins[0] * 2) + + opts.widget_base_dimensions[0]; + opts.min_widget_height = (opts.widget_margins[1] * 2) + + opts.widget_base_dimensions[1]; var serialized_opts = $.param(opts); // don't duplicate stylesheets for the same configuration @@ -2069,27 +2107,31 @@ /* generate CSS styles for cols */ for (i = opts.cols + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-col="'+ (i + 1) +'"] { left: ' + - ((i * opts.widget_base_dimensions[0]) + (i *opts.widget_margins[0] ) + ((i+1) * opts.widget_margins[0])) + - 'px;} '; + styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' + + ((i * opts.widget_base_dimensions[0]) + + (i * opts.widget_margins[0]) + + ((i + 1) * opts.widget_margins[0])) + 'px;} '); } /* generate CSS styles for rows */ for (i = opts.rows + extra_cells; i >= 0; i--) { - styles += opts.namespace + ' [data-row="' + (i + 1) + '"] { top: ' + - ((i * opts.widget_base_dimensions[1]) + (i * opts.widget_margins[1]) + ((i+1) * opts.widget_margins[1]) ) + - 'px;} '; + styles += (opts.namespace + ' [data-row="' + (i + 1) + '"] { top:' + + ((i * opts.widget_base_dimensions[1]) + + (i * opts.widget_margins[1]) + + ((i + 1) * opts.widget_margins[1]) ) + 'px;} '); } for (var y = 1; y < max_size_y; y++) { - styles += opts.namespace + ' [data-sizey="' + (y) + '"] { height: ' + - (y * opts.widget_base_dimensions[1] + (y-1)*(opts.widget_margins[1]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizey="' + y + '"] { height:' + + (y * opts.widget_base_dimensions[1] + + (y - 1) * (opts.widget_margins[1] * 2)) + 'px;}'); } for (var x = 1; x < max_size_x; x++) { - styles += opts.namespace + ' [data-sizex="' + (x) + '"] { width: ' + - (x * opts.widget_base_dimensions[0] + (x-1)*(opts.widget_margins[0]*2)) + 'px;}'; + styles += (opts.namespace + ' [data-sizex="' + x + '"] { width:' + + (x * opts.widget_base_dimensions[0] + + (x - 1) * (opts.widget_margins[0] * 2)) + 'px;}'); } return this.add_style_tag(styles); @@ -2103,7 +2145,7 @@ * @param {String} css The styles to apply. * @return {Object} Returns the instance of the Gridster class. */ - fn.add_style_tag = function(css){ + fn.add_style_tag = function(css) { var d = document; var tag = d.createElement('style'); @@ -2167,7 +2209,7 @@ this.baseX = ($(window).width() - aw) / 2; this.baseY = this.$wrapper.offset().top; - $.each(this.faux_grid, $.proxy(function(i, coords){ + $.each(this.faux_grid, $.proxy(function(i, coords) { this.faux_grid[i] = coords.update({ left: this.baseX + (coords.data.col -1) * this.min_widget_width, top: this.baseY + (coords.data.row -1) * this.min_widget_height @@ -2186,7 +2228,7 @@ * @return {Object} Returns the instance of the Gridster class. */ fn.get_widgets_from_DOM = function() { - this.$widgets.each($.proxy(function(i, widget){ + this.$widgets.each($.proxy(function(i, widget) { this.register_widget($(widget)); }, this)); return this; diff --git a/docs/index.html b/docs/index.html index b51bc488fc..2b30280325 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,9 +42,25 @@
                  -
                • Collision
                • +
                • Collision + +Detects collisions between a DOM element against other DOM elements or +Coords objects.
                • -
                • Coords
                • +
                • Coords + +Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) +to simulate DOM elements on the screen. +Coords is used by Gridster to create a faux grid with any DOM element can +collide.
                • Draggable
                • From 4eb679fb78035c171f8388f8b08da279c32387f7 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 23 Jul 2012 22:51:04 +0200 Subject: [PATCH 037/248] documentation fixes --- dist/jquery.gridster.js | 12 ++-- docs/api.js | 4 +- .../classes/Collision.html | 43 +++---------- .../classes/Coords.html | 53 ++++------------ docs/classes/Draggable.html | 23 ++----- docs/classes/Gridster.html | 60 ++++++------------- docs/data.json | 39 +++++++----- docs/files/src_jquery.collision.js.html | 23 +------ docs/files/src_jquery.coords.js.html | 23 +------ docs/files/src_jquery.draggable.js.html | 24 ++------ docs/files/src_jquery.gridster.js.html | 22 +------ docs/index.html | 20 +------ index.html | 16 ++--- src/jquery.collision.js | 3 +- src/jquery.coords.js | 3 +- src/jquery.draggable.js | 4 +- src/jquery.gridster.js | 2 +- 17 files changed, 101 insertions(+), 273 deletions(-) rename "docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" => docs/classes/Collision.html (88%) rename "docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" => docs/classes/Coords.html (79%) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 2cc3b61937..769ba2b41d 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -4,13 +4,12 @@ ;(function($, window, document, undefined){ /** - * @class Coords - * * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) * to simulate DOM elements on the screen. * Coords is used by Gridster to create a faux grid with any DOM element can * collide. * + * @class Coords * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left, * top, width and height properties. * @return {Object} Coords instance. @@ -115,11 +114,10 @@ /** - * @class Collision - * * Detects collisions between a DOM element against other DOM elements or * Coords objects. * + * @class Collision * @uses Coords * @param {HTMLElement} el The jQuery wrapped HTMLElement. * @param {HTMLElement|Array} colliders Can be a jQuery collection @@ -380,8 +378,10 @@ /** - * @class Draggable + * Basic drag implementation for DOM elements inside a container. + * Provide start/stop/drag callbacks. * + * @class Draggable * @param {HTMLElement} el The HTMLelement that contains all the widgets * to be dragged. * @param {Object} [options] An Object with all options you want to @@ -657,7 +657,7 @@ * `` of the document. You can set this to false, and write * your own CSS targeting rows and cols via data-attributes like so: * `[data-col="1"] { left: 10px; }` - * @param {Boolean} [avoid_overlapped_widgets] Avoid that widgets loaded + * @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded * from the DOM can be overlapped. It is helpful if the positions were * bad stored in the database or if there was any conflict. * @param {Function} [options.serialize_params] Return the data you want diff --git a/docs/api.js b/docs/api.js index 47d6d2545a..8b7efa7acb 100644 --- a/docs/api.js +++ b/docs/api.js @@ -1,8 +1,8 @@ YUI.add("yuidoc-meta", function(Y) { Y.YUIDoc = { meta: { "classes": [ - "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", - "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", + "Collision", + "Coords", "Draggable", "Gridster" ], diff --git "a/docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" b/docs/classes/Collision.html similarity index 88% rename from "docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" rename to docs/classes/Collision.html index 7b89b6fc6c..50a0adafe5 100644 --- "a/docs/classes/Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects..html" +++ b/docs/classes/Collision.html @@ -2,10 +2,7 @@ - Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects. + Collision @@ -45,25 +42,9 @@ Coords objects.
                    -
                  • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                  • +
                  • Collision
                  • -
                  • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                  • +
                  • Coords
                  • Draggable
                  • @@ -108,10 +89,7 @@ collide.
                    -

                    Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects. Class

                    +

                    Collision Class

                    @@ -140,20 +118,15 @@ Coords objects. Class
                    - +

                    Detects collisions between a DOM element against other DOM elements or +Coords objects.

                    Constructor

                    -
                    -

                    Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.

                    +
                    +

                    Collision

                    diff --git "a/docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" b/docs/classes/Coords.html similarity index 79% rename from "docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" rename to docs/classes/Coords.html index eace6a44b7..cfa96b9082 100644 --- "a/docs/classes/Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide..html" +++ b/docs/classes/Coords.html @@ -2,12 +2,7 @@ - Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide. + Coords @@ -47,25 +42,9 @@ collide.
                    diff --git a/docs/data.json b/docs/data.json index b050d5dd75..59202ebe88 100644 --- a/docs/data.json +++ b/docs/data.json @@ -5,7 +5,7 @@ "name": "src/jquery.collision.js", "modules": {}, "classes": { - "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.": 1 + "Collision": 1 }, "fors": {}, "namespaces": {} @@ -14,7 +14,7 @@ "name": "src/jquery.coords.js", "modules": {}, "classes": { - "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.": 1 + "Coords": 1 }, "fors": {}, "namespaces": {} @@ -40,16 +40,19 @@ }, "modules": {}, "classes": { - "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.": { - "name": "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", - "shortname": "Collision\n\nDetects collisions between a DOM element against other DOM elements or\nCoords objects.", + "Collision": { + "name": "Collision", + "shortname": "Collision", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], - "extension_for": [], + "extension_for": [ + "Gridster" + ], "file": "src/jquery.collision.js", "line": 19, + "description": "Detects collisions between a DOM element against other DOM elements or\nCoords objects.", "uses": [ "Coords" ], @@ -97,16 +100,19 @@ }, "is_constructor": 1 }, - "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.": { - "name": "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", - "shortname": "Coords\n\nCreates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", + "Coords": { + "name": "Coords", + "shortname": "Coords", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], - "extension_for": [], + "extension_for": [ + "Collision" + ], "file": "src/jquery.coords.js", "line": 10, + "description": "Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", "params": [ { "name": "obj", @@ -132,6 +138,7 @@ ], "file": "src/jquery.draggable.js", "line": 24, + "description": "Basic drag implementation for DOM elements inside a container.\nProvide start/stop/drag callbacks.", "params": [ { "name": "el", @@ -269,6 +276,12 @@ "type": "Boolean", "optional": true }, + { + "name": "avoid_overlapped_widgets", + "description": "Avoid that widgets loaded\n from the DOM can be overlapped. It is helpful if the positions were\n bad stored in the database or if there was any conflict.", + "type": "Boolean", + "optional": true + }, { "name": "serialize_params", "description": "Return the data you want\n for each widget in the serialization. Two arguments are passed:\n `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid\n coords object (`col`, `row`, `size_x`, `size_y`).", @@ -288,12 +301,6 @@ "optional": true } ] - }, - { - "name": "avoid_overlapped_widgets", - "description": "Avoid that widgets loaded\n from the DOM can be overlapped. It is helpful if the positions were\n bad stored in the database or if there was any conflict.", - "type": "Boolean", - "optional": true } ], "is_constructor": 1 diff --git a/docs/files/src_jquery.collision.js.html b/docs/files/src_jquery.collision.js.html index 6e0eeefb54..c15c3c627c 100644 --- a/docs/files/src_jquery.collision.js.html +++ b/docs/files/src_jquery.collision.js.html @@ -42,25 +42,9 @@
                      -
                    • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                    • +
                    • Collision
                    • -
                    • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                    • +
                    • Coords
                    • Draggable
                    • @@ -128,11 +112,10 @@ collide. /** - * @class Collision - * * Detects collisions between a DOM element against other DOM elements or * Coords objects. * + * @class Collision * @uses Coords * @param {HTMLElement} el The jQuery wrapped HTMLElement. * @param {HTMLElement|Array} colliders Can be a jQuery collection diff --git a/docs/files/src_jquery.coords.js.html b/docs/files/src_jquery.coords.js.html index a7fe8710dc..ef71a741f0 100644 --- a/docs/files/src_jquery.coords.js.html +++ b/docs/files/src_jquery.coords.js.html @@ -42,25 +42,9 @@
                        -
                      • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                      • +
                      • Collision
                      • -
                      • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                      • +
                      • Coords
                      • Draggable
                      • @@ -119,13 +103,12 @@ collide. ;(function($, window, document, undefined){ /** - * @class Coords - * * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) * to simulate DOM elements on the screen. * Coords is used by Gridster to create a faux grid with any DOM element can * collide. * + * @class Coords * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left, * top, width and height properties. * @return {Object} Coords instance. diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index c87d7bac27..ada2dff3fb 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -42,25 +42,9 @@
                          -
                        • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                        • +
                        • Collision
                        • -
                        • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                        • +
                        • Coords
                        • Draggable
                        • @@ -133,8 +117,10 @@ collide. /** - * @class Draggable + * Basic drag implementation for DOM elements inside a container. + * Provide start/stop/drag callbacks. * + * @class Draggable * @param {HTMLElement} el The HTMLelement that contains all the widgets * to be dragged. * @param {Object} [options] An Object with all options you want to diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 42645e3f95..4f6b54bcd0 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -42,25 +42,9 @@
                            -
                          • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                          • +
                          • Collision
                          • -
                          • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                          • +
                          • Coords
                          • Draggable
                          • @@ -169,7 +153,7 @@ collide. * `<head>` of the document. You can set this to false, and write * your own CSS targeting rows and cols via data-attributes like so: * `[data-col="1"] { left: 10px; }` - * @param {Boolean} [avoid_overlapped_widgets] Avoid that widgets loaded + * @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded * from the DOM can be overlapped. It is helpful if the positions were * bad stored in the database or if there was any conflict. * @param {Function} [options.serialize_params] Return the data you want diff --git a/docs/index.html b/docs/index.html index 2b30280325..b51bc488fc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -42,25 +42,9 @@
                              -
                            • Collision - -Detects collisions between a DOM element against other DOM elements or -Coords objects.
                            • +
                            • Collision
                            • -
                            • Coords - -Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.
                            • +
                            • Coords
                            • Draggable
                            • diff --git a/index.html b/index.html index 296a890a0c..3ee9289fe4 100755 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@
                              - +

                              put a grid in your life

                              -
                              -

                              sort_by_row_asc

                              - - -
                              - (
                                - -
                              • - - widgets - -
                              • - -
                              ) -
                              - - - - - Array - - - - - - - - - - - - - - - -
                              - - - -

                              - - Defined in - - - - - src/jquery.gridster.js:720 - -

                              - - - - - -
                              - -
                              -

                              Sorts an Array of grid coords objects (representing the grid coords of -each widget) in ascending way.

                              -
                              - - -
                              -

                              Parameters:

                              - -
                                - -
                              • - - widgets - Array - - - - -
                                -

                                Array of grid coords objects

                                -
                                - - -
                              • - -
                              -
                              - - - -
                              -

                              Returns:

                              - -
                              - - - Array: - - Returns the array sorted. - -
                              -
                              - - - -
                              - - -
                              -

                              sort_by_row_asc

                              +
                              +

                              sort_by_col_asc

                              @@ -7664,8 +7559,8 @@ coords of each widget) in ascending way.

                              -
                              -

                              sort_by_row_asc

                              +
                              +

                              sort_by_row_and_col_asc

                              @@ -7766,6 +7661,111 @@ each widget) placing first the empty cells upper left.

                              +
                              + + +
                              +

                              sort_by_row_asc

                              + + +
                              + (
                                + +
                              • + + widgets + +
                              • + +
                              ) +
                              + + + + + Array + + + + + + + + + + + + + + + +
                              + + + +

                              + + Defined in + + + + + src/jquery.gridster.js:720 + +

                              + + + + + +
                              + +
                              +

                              Sorts an Array of grid coords objects (representing the grid coords of +each widget) in ascending way.

                              +
                              + + +
                              +

                              Parameters:

                              + +
                                + +
                              • + + widgets + Array + + + + +
                                +

                                Array of grid coords objects

                                +
                                + + +
                              • + +
                              +
                              + + + +
                              +

                              Returns:

                              + +
                              + + + Array: + + Returns the array sorted. + +
                              +
                              + + +
                              diff --git a/docs/data.json b/docs/data.json index 59202ebe88..80b2721731 100644 --- a/docs/data.json +++ b/docs/data.json @@ -704,7 +704,7 @@ "line": 740, "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) placing first the empty cells upper left.", "itemtype": "method", - "name": "sort_by_row_asc", + "name": "sort_by_row_and_col_asc", "params": [ { "name": "widgets", @@ -723,7 +723,7 @@ "line": 760, "description": "Sorts an Array of grid coords objects by column (representing the grid\ncoords of each widget) in ascending way.", "itemtype": "method", - "name": "sort_by_row_asc", + "name": "sort_by_col_asc", "params": [ { "name": "widgets", diff --git a/docs/files/src_jquery.coords.js.html b/docs/files/src_jquery.coords.js.html index ef71a741f0..d9957d937e 100644 --- a/docs/files/src_jquery.coords.js.html +++ b/docs/files/src_jquery.coords.js.html @@ -141,10 +141,10 @@ var el = this.el; if (el && !update) { - this.data = {} || el.offset(); + this.data = el.offset(); this.data.width = el.width(); this.data.height = el.height(); - }; + } if (el && update && !not_update_offsets) { var offset = el.offset(); diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index ada2dff3fb..c43dc5817e 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -150,7 +150,7 @@ this.player_min_left = 0 + this.options.offset_left; this.init(); - }; + } var fn = Draggable.prototype; @@ -177,7 +177,7 @@ fn.drag_handler = function(e) { if (e.which !== 1) { return false; - }; + } var self = this; var first = true; @@ -203,7 +203,7 @@ if (self.is_dragging == true) { throttle(self.on_dragmove.call(self, mme), 130); - }; + } return false; @@ -231,7 +231,7 @@ this.options.start.call(this.$player, e, { helper: this.helper ? this.$helper : this.$player }); - }; + } return false; }; @@ -251,12 +251,12 @@ }else if(left < this.player_min_left) { left = this.player_min_left; } - }; + } return { left: left, top: top - } + }; }; @@ -293,7 +293,7 @@ 'left': offset.left, 'top': offset.top } - } + }; if (this.options.stop) { this.options.stop.call(this.$player, e, ui); diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 4f6b54bcd0..3001318942 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -210,7 +210,7 @@ this.$wrapper.find('.player-revert').removeClass('player-revert'); this.drag_api.disable(); return this; - } + }; /** @@ -222,7 +222,7 @@ fn.enable = function() { this.drag_api.enable(); return this; - } + }; /** @@ -324,7 +324,7 @@ if (callback) { callback.apply(this, el); - }; + } }, this)); }; @@ -393,7 +393,7 @@ 'data-sizex': wgd.size_x, 'data-sizey': wgd.size_y }); - }; + } // attach Coord object to player data-coord attribute $el.data('coords', $el.coords()); @@ -564,7 +564,7 @@ var abs_offset = { left: ui.position.left + this.baseX, top: ui.position.top + this.baseY - } + }; this.colliders_data = this.collision_api.get_closest_colliders( abs_offset); @@ -836,7 +836,7 @@ * Sorts an Array of grid coords objects (representing the grid coords of * each widget) placing first the empty cells upper left. * - * @method sort_by_row_asc + * @method sort_by_row_and_col_asc * @param {Array} widgets Array of grid coords objects * @return {Array} Returns the array sorted. */ @@ -856,7 +856,7 @@ * Sorts an Array of grid coords objects by column (representing the grid * coords of each widget) in ascending way. * - * @method sort_by_row_asc + * @method sort_by_col_asc * @param {Array} widgets Array of grid coords objects * @return {Array} Returns the array sorted. */ @@ -1122,7 +1122,7 @@ var right_col = (col + phgd.size_x - 1); if (right_col > this.cols) { col = col - (right_col - col); - }; + } var moved_down = this.placeholder_grid_data.row < row; var changed_column = this.placeholder_grid_data.col !== col; @@ -2021,19 +2021,19 @@ $widgets = $widgets.add( this.$widgets.filter(function() { var tcol = $(this).attr('data-col'); - return (tcol == col || tcol > col); + return (tcol === col || tcol > col); }) ); - }; + } if (row) { $widgets = $widgets.add( this.$widgets.filter(function() { var trow = $(this).attr('data-row'); - return (trow == row || trow > row); + return (trow === row || trow > row); }) ); - }; + } return $widgets; } @@ -2085,7 +2085,7 @@ // don't duplicate stylesheets for the same configuration if ($.inArray(serialized_opts, Gridster.generated_stylesheets) >= 0) { return false; - }; + } Gridster.generated_stylesheets.push(serialized_opts); From 7e4fa9fcbe3543379b69c2f659884e1097d27477 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 10:51:03 +0200 Subject: [PATCH 040/248] updated remove_widget method in doc --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 3ee9289fe4..336254ad10 100755 --- a/index.html +++ b/index.html @@ -250,7 +250,7 @@
      -

      .remove_widget( el )

      +

      .remove_widget( el, [callback] )

      Remove a widget from the grid

      @@ -259,6 +259,8 @@
      el HTMLElement
      The jQuery wrapped HTMLElement representing the widget that you want to remove.
      +
      callback Function
      +
      Executes a callback when the widgets is removed.

      Returns

      From b5a2a2c4cd74e963e4568f9b272be2215e14bed9 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 15:40:32 +0200 Subject: [PATCH 041/248] scroll document when dragging up or down --- src/jquery.draggable.js | 200 ++++++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 69 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 2bae3b5054..0b59eb03aa 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -12,13 +12,15 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0 + offset_left: 0, + autoscroll: true // ,drag: function(e){}, // start : function(e, ui){}, // stop : function(e){} }; var $body = $(document.body); + var $window = $(window); /** @@ -53,15 +55,18 @@ this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; - this.init(); } var fn = Draggable.prototype; fn.init = function() { + this.calculate_positions(); this.$container.css('position', 'relative'); this.enable(); + + $(window).bind('resize', + throttle($.proxy(this.calculate_positions, this), 200)); }; @@ -79,76 +84,16 @@ }; - fn.drag_handler = function(e) { - if (e.which !== 1) { - return false; - } - - var self = this; - var first = true; - this.$player = $(e.currentTarget); - - this.el_init_pos = this.get_actual_pos(this.$player); - this.mouse_init_pos = this.get_mouse_pos(e); - - $body.on('mousemove.draggable', function(mme){ - - var mouse_actual_pos = self.get_mouse_pos(mme); - var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); - var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); - if (!(diff_x > self.options.distance || diff_y > self.options.distance)) { - return false; - } - - if (first) { - first = false; - self.on_dragstart.call(self, mme); - return false; - } - - if (self.is_dragging == true) { - throttle(self.on_dragmove.call(self, mme), 130); - } - - return false; - - }); - - return false; - }; - - - fn.on_dragstart = function(e) { - e.preventDefault(); - this.drag_start = true; - this.is_dragging = true; - this.$container_offset = this.$container.offset(); - if (this.options.helper === 'clone') { - this.$helper = this.$player.clone().appendTo(this.$container).addClass('helper'); - this.helper = true; - }else{ - this.helper = false; - } - this.el_init_offset = this.$player.offset(); - this.player_width = this.$player.width(); - this.player_max_left = this.$container.width() - this.player_width + this.options.offset_left; - if (this.options.start) { - this.options.start.call(this.$player, e, { - helper: this.helper ? this.$helper : this.$player - }); - } - return false; - }; - - fn.get_offset = function(e) { e.preventDefault(); var mouse_actual_pos = this.get_mouse_pos(e); - var diff_x = mouse_actual_pos.left - this.mouse_init_pos.left; - var diff_y = mouse_actual_pos.top - this.mouse_init_pos.top; + var diff_x = Math.round( + mouse_actual_pos.left - this.mouse_init_pos.left); + var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top); - var left = this.el_init_offset.left + diff_x - this.$container_offset.left; - var top = this.el_init_offset.top + diff_y - this.$container_offset.top; + var left = Math.round(this.el_init_offset.left + diff_x - this.baseX); + var top = Math.round( + this.el_init_offset.top + diff_y - this.baseY + this.scrollOffset); if (this.options.limit) { if (left > this.player_max_left) { @@ -165,9 +110,124 @@ }; + fn.manage_scroll = function(offset) { + /* scroll document */ + var nextScrollTop; + var scrollTop = $window.scrollTop(); + var min_window_y = scrollTop; + var max_window_y = min_window_y + this.window_height; + var player_top_y = this.baseY + offset.top; + var player_bottom_y = player_top_y + this.player_height; + var max_player_y = (this.doc_height - this.window_height + + this.player_height); + + if ( player_bottom_y > max_window_y) { + var diff = player_bottom_y - max_window_y; + nextScrollTop = scrollTop + diff; + if (nextScrollTop < max_player_y) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset + diff; + }; + }else if (player_top_y < min_window_y) { + + var diff = min_window_y - player_top_y; + nextScrollTop = scrollTop - diff; + if (nextScrollTop > 0) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset - diff; + }; + } + + } + + + fn.calculate_positions = function(e) { + this.window_height = $window.height(); + } + + + fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + } + + var self = this; + var first = true; + this.$player = $(e.currentTarget); + + this.el_init_pos = this.get_actual_pos(this.$player); + this.mouse_init_pos = this.get_mouse_pos(e); + this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; + this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; + + $body.on('mousemove.draggable', function(mme){ + + var mouse_actual_pos = self.get_mouse_pos(mme); + var diff_x = Math.abs( + mouse_actual_pos.left - self.mouse_init_pos.left); + var diff_y = Math.abs( + mouse_actual_pos.top - self.mouse_init_pos.top); + if (!(diff_x > self.options.distance || + diff_y > self.options.distance) + ) { + return false; + } + + if (first) { + first = false; + self.on_dragstart.call(self, mme); + return false; + } + + if (self.is_dragging == true) { + self.on_dragmove.call(self, mme); + } + + return false; + + }); + + return false; + }; + + + fn.on_dragstart = function(e) { + e.preventDefault(); + this.drag_start = true; + this.is_dragging = true; + var offset = this.$container.offset(); + this.baseX = Math.round(offset.left); + this.baseY = Math.round(offset.top); + this.doc_height = $(document).height(); + + if (this.options.helper === 'clone') { + this.$helper = this.$player.clone() + .appendTo(this.$container).addClass('helper'); + this.helper = true; + }else{ + this.helper = false; + } + this.scrollOffset = 0; + this.el_init_offset = this.$player.offset(); + this.player_width = this.$player.width(); + this.player_height = this.$player.height(); + this.player_max_left = (this.$container.width() - this.player_width + + this.options.offset_left); + + if (this.options.start) { + this.options.start.call(this.$player, e, { + helper: this.helper ? this.$helper : this.$player + }); + } + return false; + }; + + fn.on_dragmove = function(e) { var offset = this.get_offset(e); + this.options.autoscroll && this.manage_scroll(offset); + (this.helper ? this.$helper : this.$player).css({ 'position': 'absolute', 'left' : offset.left, @@ -213,7 +273,9 @@ fn.enable = function(){ - this.$container.on('mousedown.draggable', this.options.items, $.proxy(this.drag_handler, this)); + this.$container.on('mousedown.draggable', this.options.items, $.proxy( + this.drag_handler, this)); + $body.on('mouseup.draggable', $.proxy(function(e) { this.is_dragging = false; $body.off('mousemove.draggable'); From 3456aef4089192f41a7009b233694b37121d6879 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 15:40:49 +0200 Subject: [PATCH 042/248] trottling drag callback --- src/jquery.gridster.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 68b7c7cd5d..4622137acf 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -396,10 +396,10 @@ self.on_stop_drag.call(self, event, ui); self.$el.trigger('gridster:dragstop'); }, - drag: function(event, ui) { + drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - } + }, 130) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); From 5ab5ce95dc279148f9d9340fe5efbdf9490bc6bd Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 15:43:19 +0200 Subject: [PATCH 043/248] updated docs and dist --- dist/jquery.gridster.js | 204 +++++++++++++++--------- docs/classes/Draggable.html | 4 +- docs/data.json | 2 +- docs/files/src_jquery.draggable.js.html | 200 +++++++++++++++-------- docs/files/src_jquery.gridster.js.html | 4 +- 5 files changed, 269 insertions(+), 145 deletions(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index bda06f8871..cf09a1c588 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -368,13 +368,15 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0 + offset_left: 0, + autoscroll: true // ,drag: function(e){}, // start : function(e, ui){}, // stop : function(e){} }; var $body = $(document.body); + var $window = $(window); /** @@ -409,15 +411,18 @@ this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; - this.init(); } var fn = Draggable.prototype; fn.init = function() { + this.calculate_positions(); this.$container.css('position', 'relative'); this.enable(); + + $(window).bind('resize', + throttle($.proxy(this.calculate_positions, this), 200)); }; @@ -435,76 +440,16 @@ }; - fn.drag_handler = function(e) { - if (e.which !== 1) { - return false; - } - - var self = this; - var first = true; - this.$player = $(e.currentTarget); - - this.el_init_pos = this.get_actual_pos(this.$player); - this.mouse_init_pos = this.get_mouse_pos(e); - - $body.on('mousemove.draggable', function(mme){ - - var mouse_actual_pos = self.get_mouse_pos(mme); - var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); - var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); - if (!(diff_x > self.options.distance || diff_y > self.options.distance)) { - return false; - } - - if (first) { - first = false; - self.on_dragstart.call(self, mme); - return false; - } - - if (self.is_dragging == true) { - throttle(self.on_dragmove.call(self, mme), 130); - } - - return false; - - }); - - return false; - }; - - - fn.on_dragstart = function(e) { - e.preventDefault(); - this.drag_start = true; - this.is_dragging = true; - this.$container_offset = this.$container.offset(); - if (this.options.helper === 'clone') { - this.$helper = this.$player.clone().appendTo(this.$container).addClass('helper'); - this.helper = true; - }else{ - this.helper = false; - } - this.el_init_offset = this.$player.offset(); - this.player_width = this.$player.width(); - this.player_max_left = this.$container.width() - this.player_width + this.options.offset_left; - if (this.options.start) { - this.options.start.call(this.$player, e, { - helper: this.helper ? this.$helper : this.$player - }); - } - return false; - }; - - fn.get_offset = function(e) { e.preventDefault(); var mouse_actual_pos = this.get_mouse_pos(e); - var diff_x = mouse_actual_pos.left - this.mouse_init_pos.left; - var diff_y = mouse_actual_pos.top - this.mouse_init_pos.top; + var diff_x = Math.round( + mouse_actual_pos.left - this.mouse_init_pos.left); + var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top); - var left = this.el_init_offset.left + diff_x - this.$container_offset.left; - var top = this.el_init_offset.top + diff_y - this.$container_offset.top; + var left = Math.round(this.el_init_offset.left + diff_x - this.baseX); + var top = Math.round( + this.el_init_offset.top + diff_y - this.baseY + this.scrollOffset); if (this.options.limit) { if (left > this.player_max_left) { @@ -521,9 +466,124 @@ }; + fn.manage_scroll = function(offset) { + /* scroll document */ + var nextScrollTop; + var scrollTop = $window.scrollTop(); + var min_window_y = scrollTop; + var max_window_y = min_window_y + this.window_height; + var player_top_y = this.baseY + offset.top; + var player_bottom_y = player_top_y + this.player_height; + var max_player_y = (this.doc_height - this.window_height + + this.player_height); + + if ( player_bottom_y > max_window_y) { + var diff = player_bottom_y - max_window_y; + nextScrollTop = scrollTop + diff; + if (nextScrollTop < max_player_y) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset + diff; + }; + }else if (player_top_y < min_window_y) { + + var diff = min_window_y - player_top_y; + nextScrollTop = scrollTop - diff; + if (nextScrollTop > 0) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset - diff; + }; + } + + } + + + fn.calculate_positions = function(e) { + this.window_height = $window.height(); + } + + + fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + } + + var self = this; + var first = true; + this.$player = $(e.currentTarget); + + this.el_init_pos = this.get_actual_pos(this.$player); + this.mouse_init_pos = this.get_mouse_pos(e); + this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; + this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; + + $body.on('mousemove.draggable', function(mme){ + + var mouse_actual_pos = self.get_mouse_pos(mme); + var diff_x = Math.abs( + mouse_actual_pos.left - self.mouse_init_pos.left); + var diff_y = Math.abs( + mouse_actual_pos.top - self.mouse_init_pos.top); + if (!(diff_x > self.options.distance || + diff_y > self.options.distance) + ) { + return false; + } + + if (first) { + first = false; + self.on_dragstart.call(self, mme); + return false; + } + + if (self.is_dragging == true) { + self.on_dragmove.call(self, mme); + } + + return false; + + }); + + return false; + }; + + + fn.on_dragstart = function(e) { + e.preventDefault(); + this.drag_start = true; + this.is_dragging = true; + var offset = this.$container.offset(); + this.baseX = Math.round(offset.left); + this.baseY = Math.round(offset.top); + this.doc_height = $(document).height(); + + if (this.options.helper === 'clone') { + this.$helper = this.$player.clone() + .appendTo(this.$container).addClass('helper'); + this.helper = true; + }else{ + this.helper = false; + } + this.scrollOffset = 0; + this.el_init_offset = this.$player.offset(); + this.player_width = this.$player.width(); + this.player_height = this.$player.height(); + this.player_max_left = (this.$container.width() - this.player_width + + this.options.offset_left); + + if (this.options.start) { + this.options.start.call(this.$player, e, { + helper: this.helper ? this.$helper : this.$player + }); + } + return false; + }; + + fn.on_dragmove = function(e) { var offset = this.get_offset(e); + this.options.autoscroll && this.manage_scroll(offset); + (this.helper ? this.$helper : this.$player).css({ 'position': 'absolute', 'left' : offset.left, @@ -569,7 +629,9 @@ fn.enable = function(){ - this.$container.on('mousedown.draggable', this.options.items, $.proxy(this.drag_handler, this)); + this.$container.on('mousedown.draggable', this.options.items, $.proxy( + this.drag_handler, this)); + $body.on('mouseup.draggable', $.proxy(function(e) { this.is_dragging = false; $body.off('mousemove.draggable'); @@ -995,10 +1057,10 @@ self.on_stop_drag.call(self, event, ui); self.$el.trigger('gridster:dragstop'); }, - drag: function(event, ui) { + drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - } + }, 130) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); diff --git a/docs/classes/Draggable.html b/docs/classes/Draggable.html index f9d22f99fb..2f5fdcae80 100644 --- a/docs/classes/Draggable.html +++ b/docs/classes/Draggable.html @@ -97,7 +97,7 @@ @@ -168,7 +168,7 @@ Provide start/stop/drag callbacks.

      - src/jquery.draggable.js:24 + src/jquery.draggable.js:26

      diff --git a/docs/data.json b/docs/data.json index 80b2721731..c83bd743df 100644 --- a/docs/data.json +++ b/docs/data.json @@ -137,7 +137,7 @@ "Gridster" ], "file": "src/jquery.draggable.js", - "line": 24, + "line": 26, "description": "Basic drag implementation for DOM elements inside a container.\nProvide start/stop/drag callbacks.", "params": [ { diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index c43dc5817e..c7d747c5c2 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -107,13 +107,15 @@ items: '.gs_w', distance: 1, limit: true, - offset_left: 0 + offset_left: 0, + autoscroll: true // ,drag: function(e){}, // start : function(e, ui){}, // stop : function(e){} }; var $body = $(document.body); + var $window = $(window); /** @@ -148,15 +150,18 @@ this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; this.player_min_left = 0 + this.options.offset_left; - this.init(); } var fn = Draggable.prototype; fn.init = function() { + this.calculate_positions(); this.$container.css('position', 'relative'); this.enable(); + + $(window).bind('resize', + throttle($.proxy(this.calculate_positions, this), 200)); }; @@ -174,76 +179,16 @@ }; - fn.drag_handler = function(e) { - if (e.which !== 1) { - return false; - } - - var self = this; - var first = true; - this.$player = $(e.currentTarget); - - this.el_init_pos = this.get_actual_pos(this.$player); - this.mouse_init_pos = this.get_mouse_pos(e); - - $body.on('mousemove.draggable', function(mme){ - - var mouse_actual_pos = self.get_mouse_pos(mme); - var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left); - var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top); - if (!(diff_x > self.options.distance || diff_y > self.options.distance)) { - return false; - } - - if (first) { - first = false; - self.on_dragstart.call(self, mme); - return false; - } - - if (self.is_dragging == true) { - throttle(self.on_dragmove.call(self, mme), 130); - } - - return false; - - }); - - return false; - }; - - - fn.on_dragstart = function(e) { - e.preventDefault(); - this.drag_start = true; - this.is_dragging = true; - this.$container_offset = this.$container.offset(); - if (this.options.helper === 'clone') { - this.$helper = this.$player.clone().appendTo(this.$container).addClass('helper'); - this.helper = true; - }else{ - this.helper = false; - } - this.el_init_offset = this.$player.offset(); - this.player_width = this.$player.width(); - this.player_max_left = this.$container.width() - this.player_width + this.options.offset_left; - if (this.options.start) { - this.options.start.call(this.$player, e, { - helper: this.helper ? this.$helper : this.$player - }); - } - return false; - }; - - fn.get_offset = function(e) { e.preventDefault(); var mouse_actual_pos = this.get_mouse_pos(e); - var diff_x = mouse_actual_pos.left - this.mouse_init_pos.left; - var diff_y = mouse_actual_pos.top - this.mouse_init_pos.top; + var diff_x = Math.round( + mouse_actual_pos.left - this.mouse_init_pos.left); + var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top); - var left = this.el_init_offset.left + diff_x - this.$container_offset.left; - var top = this.el_init_offset.top + diff_y - this.$container_offset.top; + var left = Math.round(this.el_init_offset.left + diff_x - this.baseX); + var top = Math.round( + this.el_init_offset.top + diff_y - this.baseY + this.scrollOffset); if (this.options.limit) { if (left > this.player_max_left) { @@ -260,9 +205,124 @@ }; + fn.manage_scroll = function(offset) { + /* scroll document */ + var nextScrollTop; + var scrollTop = $window.scrollTop(); + var min_window_y = scrollTop; + var max_window_y = min_window_y + this.window_height; + var player_top_y = this.baseY + offset.top; + var player_bottom_y = player_top_y + this.player_height; + var max_player_y = (this.doc_height - this.window_height + + this.player_height); + + if ( player_bottom_y > max_window_y) { + var diff = player_bottom_y - max_window_y; + nextScrollTop = scrollTop + diff; + if (nextScrollTop < max_player_y) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset + diff; + }; + }else if (player_top_y < min_window_y) { + + var diff = min_window_y - player_top_y; + nextScrollTop = scrollTop - diff; + if (nextScrollTop > 0) { + $window.scrollTop(nextScrollTop); + this.scrollOffset = this.scrollOffset - diff; + }; + } + + } + + + fn.calculate_positions = function(e) { + this.window_height = $window.height(); + } + + + fn.drag_handler = function(e) { + if (e.which !== 1) { + return false; + } + + var self = this; + var first = true; + this.$player = $(e.currentTarget); + + this.el_init_pos = this.get_actual_pos(this.$player); + this.mouse_init_pos = this.get_mouse_pos(e); + this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; + this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; + + $body.on('mousemove.draggable', function(mme){ + + var mouse_actual_pos = self.get_mouse_pos(mme); + var diff_x = Math.abs( + mouse_actual_pos.left - self.mouse_init_pos.left); + var diff_y = Math.abs( + mouse_actual_pos.top - self.mouse_init_pos.top); + if (!(diff_x > self.options.distance || + diff_y > self.options.distance) + ) { + return false; + } + + if (first) { + first = false; + self.on_dragstart.call(self, mme); + return false; + } + + if (self.is_dragging == true) { + self.on_dragmove.call(self, mme); + } + + return false; + + }); + + return false; + }; + + + fn.on_dragstart = function(e) { + e.preventDefault(); + this.drag_start = true; + this.is_dragging = true; + var offset = this.$container.offset(); + this.baseX = Math.round(offset.left); + this.baseY = Math.round(offset.top); + this.doc_height = $(document).height(); + + if (this.options.helper === 'clone') { + this.$helper = this.$player.clone() + .appendTo(this.$container).addClass('helper'); + this.helper = true; + }else{ + this.helper = false; + } + this.scrollOffset = 0; + this.el_init_offset = this.$player.offset(); + this.player_width = this.$player.width(); + this.player_height = this.$player.height(); + this.player_max_left = (this.$container.width() - this.player_width + + this.options.offset_left); + + if (this.options.start) { + this.options.start.call(this.$player, e, { + helper: this.helper ? this.$helper : this.$player + }); + } + return false; + }; + + fn.on_dragmove = function(e) { var offset = this.get_offset(e); + this.options.autoscroll && this.manage_scroll(offset); + (this.helper ? this.$helper : this.$player).css({ 'position': 'absolute', 'left' : offset.left, @@ -308,7 +368,9 @@ fn.enable = function(){ - this.$container.on('mousedown.draggable', this.options.items, $.proxy(this.drag_handler, this)); + this.$container.on('mousedown.draggable', this.options.items, $.proxy( + this.drag_handler, this)); + $body.on('mouseup.draggable', $.proxy(function(e) { this.is_dragging = false; $body.off('mousemove.draggable'); diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 3001318942..0c45284042 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -491,10 +491,10 @@ self.on_stop_drag.call(self, event, ui); self.$el.trigger('gridster:dragstop'); }, - drag: function(event, ui) { + drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - } + }, 130) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); From 3460a436b2d9b3a10ffa2aab8a91cfcdebdf7125 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 16:25:43 +0200 Subject: [PATCH 044/248] scroll logic based on mouse position, not in items position --- src/jquery.draggable.js | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 0b59eb03aa..b448e7b0f4 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -105,7 +105,9 @@ return { left: left, - top: top + top: top, + mouse_left: mouse_actual_pos.left, + mouse_top: mouse_actual_pos.top }; }; @@ -116,28 +118,31 @@ var scrollTop = $window.scrollTop(); var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var player_top_y = this.baseY + offset.top; - var player_bottom_y = player_top_y + this.player_height; + + var mouse_down_zone = max_window_y - 10; + var mouse_up_zone = min_window_y + 10; + + var abs_mouse_left = offset.mouse_left; + var abs_mouse_top = min_window_y + offset.mouse_top; + var max_player_y = (this.doc_height - this.window_height + this.player_height); - if ( player_bottom_y > max_window_y) { - var diff = player_bottom_y - max_window_y; - nextScrollTop = scrollTop + diff; + if (abs_mouse_top >= mouse_down_zone) { + nextScrollTop = scrollTop + 10; if (nextScrollTop < max_player_y) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset + diff; - }; - }else if (player_top_y < min_window_y) { + this.scrollOffset = this.scrollOffset + 10; + } + }; - var diff = min_window_y - player_top_y; - nextScrollTop = scrollTop - diff; + if (abs_mouse_top <= mouse_up_zone) { + nextScrollTop = scrollTop - 10; if (nextScrollTop > 0) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset - diff; - }; - } - + this.scrollOffset = this.scrollOffset - 10; + } + }; } From bfe21a568dfc3781e7d1d4982f28baab51da9a97 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 16:25:55 +0200 Subject: [PATCH 045/248] updated docs and dist --- dist/jquery.gridster.js | 35 ++++++++++++++----------- dist/jquery.gridster.min.js | 2 +- docs/files/src_jquery.draggable.js.html | 35 ++++++++++++++----------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index cf09a1c588..ca31b85f8d 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -461,7 +461,9 @@ return { left: left, - top: top + top: top, + mouse_left: mouse_actual_pos.left, + mouse_top: mouse_actual_pos.top }; }; @@ -472,28 +474,31 @@ var scrollTop = $window.scrollTop(); var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var player_top_y = this.baseY + offset.top; - var player_bottom_y = player_top_y + this.player_height; + + var mouse_down_zone = max_window_y - 10; + var mouse_up_zone = min_window_y + 10; + + var abs_mouse_left = offset.mouse_left; + var abs_mouse_top = min_window_y + offset.mouse_top; + var max_player_y = (this.doc_height - this.window_height + this.player_height); - if ( player_bottom_y > max_window_y) { - var diff = player_bottom_y - max_window_y; - nextScrollTop = scrollTop + diff; + if (abs_mouse_top >= mouse_down_zone) { + nextScrollTop = scrollTop + 10; if (nextScrollTop < max_player_y) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset + diff; - }; - }else if (player_top_y < min_window_y) { + this.scrollOffset = this.scrollOffset + 10; + } + }; - var diff = min_window_y - player_top_y; - nextScrollTop = scrollTop - diff; + if (abs_mouse_top <= mouse_up_zone) { + nextScrollTop = scrollTop - 10; if (nextScrollTop > 0) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset - diff; - }; - } - + this.scrollOffset = this.scrollOffset - 10; + } + }; } diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 5b21058a4c..060b81452f 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-24 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&throttle(c.on_dragmove.call(c,a),130),!1):!1}),!1},h.on_dragstart=function(a){return a.preventDefault(),this.drag_start=!0,this.is_dragging=!0,this.$container_offset=this.$container.offset(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,a,{helper:this.helper?this.$helper:this.$player}),!1},h.get_offset=function(a){a.preventDefault();var b=this.get_mouse_pos(a),c=b.left-this.mouse_init_pos.left,d=b.top-this.mouse_init_pos.top,e=this.el_init_offset.left+c-this.$container_offset.left,f=this.el_init_offset.top+d-this.$container_offset.top;return this.options.limit&&(e>this.player_max_left?e=this.player_max_left:e li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetX=this.mouse_init_pos.left-this.el_init_pos.left,this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index c7d747c5c2..b2eba96899 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -200,7 +200,9 @@ return { left: left, - top: top + top: top, + mouse_left: mouse_actual_pos.left, + mouse_top: mouse_actual_pos.top }; }; @@ -211,28 +213,31 @@ var scrollTop = $window.scrollTop(); var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var player_top_y = this.baseY + offset.top; - var player_bottom_y = player_top_y + this.player_height; + + var mouse_down_zone = max_window_y - 10; + var mouse_up_zone = min_window_y + 10; + + var abs_mouse_left = offset.mouse_left; + var abs_mouse_top = min_window_y + offset.mouse_top; + var max_player_y = (this.doc_height - this.window_height + this.player_height); - if ( player_bottom_y > max_window_y) { - var diff = player_bottom_y - max_window_y; - nextScrollTop = scrollTop + diff; + if (abs_mouse_top >= mouse_down_zone) { + nextScrollTop = scrollTop + 10; if (nextScrollTop < max_player_y) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset + diff; - }; - }else if (player_top_y < min_window_y) { + this.scrollOffset = this.scrollOffset + 10; + } + }; - var diff = min_window_y - player_top_y; - nextScrollTop = scrollTop - diff; + if (abs_mouse_top <= mouse_up_zone) { + nextScrollTop = scrollTop - 10; if (nextScrollTop > 0) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset - diff; - }; - } - + this.scrollOffset = this.scrollOffset - 10; + } + }; } From 0016c99a617f55ebca15bbc562bccbb271747b83 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 16:55:53 +0200 Subject: [PATCH 046/248] offsetX is not needed --- src/jquery.draggable.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index b448e7b0f4..cdb442ae32 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -162,7 +162,6 @@ this.el_init_pos = this.get_actual_pos(this.$player); this.mouse_init_pos = this.get_mouse_pos(e); - this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; $body.on('mousemove.draggable', function(mme){ @@ -255,7 +254,6 @@ fn.on_dragstop = function(e) { var offset = this.get_offset(e); - this.drag_start = false; var ui = { From 06b53fdc192bff54cd5af80542d02de1263f24c4 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 16:56:16 +0200 Subject: [PATCH 047/248] throttling to 60ms to prevent overlapping --- src/jquery.gridster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 4622137acf..97c3ff1ba1 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -399,7 +399,7 @@ drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - }, 130) + }, 60) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); From cdf8e26c6488b1ca83e193d150e9f5ec909d1c81 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 16:56:37 +0200 Subject: [PATCH 048/248] updated docs and dist --- dist/jquery.gridster.js | 4 +--- dist/jquery.gridster.min.js | 2 +- docs/files/src_jquery.draggable.js.html | 2 -- docs/files/src_jquery.gridster.js.html | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index ca31b85f8d..4c6ec9b8a1 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -518,7 +518,6 @@ this.el_init_pos = this.get_actual_pos(this.$player); this.mouse_init_pos = this.get_mouse_pos(e); - this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; $body.on('mousemove.draggable', function(mme){ @@ -611,7 +610,6 @@ fn.on_dragstop = function(e) { var offset = this.get_offset(e); - this.drag_start = false; var ui = { @@ -1065,7 +1063,7 @@ drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - }, 130) + }, 60) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 060b81452f..1d6d07ed71 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-24 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetX=this.mouse_init_pos.left-this.el_init_pos.left,this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index b2eba96899..7e6b9a0d86 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -257,7 +257,6 @@ this.el_init_pos = this.get_actual_pos(this.$player); this.mouse_init_pos = this.get_mouse_pos(e); - this.offsetX = this.mouse_init_pos.left - this.el_init_pos.left; this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; $body.on('mousemove.draggable', function(mme){ @@ -350,7 +349,6 @@ fn.on_dragstop = function(e) { var offset = this.get_offset(e); - this.drag_start = false; var ui = { diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 0c45284042..17f95e77bf 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -494,7 +494,7 @@ drag: throttle(function(event, ui) { self.on_drag.call(self, event, ui); self.$el.trigger('gridster:drag'); - }, 130) + }, 60) }); this.drag_api = this.$el.draggable(draggable_options).data('draggable'); From f12cebb33ed56f5f129233394abd0b08525c7a06 Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 24 Jul 2012 17:03:42 +0200 Subject: [PATCH 049/248] increased the mouse area that triggers scroll --- dist/jquery.gridster.js | 4 ++-- src/jquery.draggable.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 4c6ec9b8a1..396a65d833 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -475,8 +475,8 @@ var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var mouse_down_zone = max_window_y - 10; - var mouse_up_zone = min_window_y + 10; + var mouse_down_zone = max_window_y - 30; + var mouse_up_zone = min_window_y + 20; var abs_mouse_left = offset.mouse_left; var abs_mouse_top = min_window_y + offset.mouse_top; diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index cdb442ae32..6b65d3c990 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -119,8 +119,8 @@ var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var mouse_down_zone = max_window_y - 10; - var mouse_up_zone = min_window_y + 10; + var mouse_down_zone = max_window_y - 30; + var mouse_up_zone = min_window_y + 20; var abs_mouse_left = offset.mouse_left; var abs_mouse_top = min_window_y + offset.mouse_top; From e4e06f4cde80e3f7a4094b4c30ddfd5ba2fe9557 Mon Sep 17 00:00:00 2001 From: vieron Date: Wed, 25 Jul 2012 17:58:18 +0200 Subject: [PATCH 050/248] gridster: passing Math (not null) as first argument in Math.max.apply() --- src/jquery.gridster.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 97c3ff1ba1..8d2fab8a16 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -228,7 +228,7 @@ }, this)); if (callback) { - callback.apply(this, el); + callback.call(this, el); } }, this)); }; @@ -1550,7 +1550,7 @@ diffs.push(temp_y_units); }); - var max_diff = Math.max.apply(null, diffs); + var max_diff = Math.max.apply(Math, diffs); y_units = (y_units - max_diff); return y_units > 0 ? y_units : 0; @@ -1907,7 +1907,7 @@ } } - var highest_row = Math.max.apply(null, rows); + var highest_row = Math.max.apply(Math, rows); this.highest_occupied_cell = { col: row_in_col[highest_row], @@ -2148,8 +2148,8 @@ return $(this).attr('data-row'); }); - var min_cols = Math.max.apply(null, actual_cols); - var min_rows = Math.max.apply(null, actual_rows); + var min_cols = Math.max.apply(Math, actual_cols); + var min_rows = Math.max.apply(Math, actual_rows); this.cols = Math.max(min_cols, cols, this.options.min_cols); this.rows = Math.max(min_rows, rows, this.options.min_rows); From c6e77dc66198f55756248cc64da3e99ef1911949 Mon Sep 17 00:00:00 2001 From: vieron Date: Wed, 25 Jul 2012 17:59:01 +0200 Subject: [PATCH 051/248] generated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 12 ++++++------ dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index c77088046a..b9adb1729f 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-24 +/*! gridster.js - v0.1.0 - 2012-07-25 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 396a65d833..d437fcc9b0 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-24 +/*! gridster.js - v0.1.0 - 2012-07-25 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ @@ -892,7 +892,7 @@ }, this)); if (callback) { - callback.apply(this, el); + callback.call(this, el); } }, this)); }; @@ -2214,7 +2214,7 @@ diffs.push(temp_y_units); }); - var max_diff = Math.max.apply(null, diffs); + var max_diff = Math.max.apply(Math, diffs); y_units = (y_units - max_diff); return y_units > 0 ? y_units : 0; @@ -2571,7 +2571,7 @@ } } - var highest_row = Math.max.apply(null, rows); + var highest_row = Math.max.apply(Math, rows); this.highest_occupied_cell = { col: row_in_col[highest_row], @@ -2812,8 +2812,8 @@ return $(this).attr('data-row'); }); - var min_cols = Math.max.apply(null, actual_cols); - var min_rows = Math.max.apply(null, actual_rows); + var min_cols = Math.max.apply(Math, actual_cols); + var min_rows = Math.max.apply(Math, actual_rows); this.cols = Math.max(min_cols, cols, this.options.min_cols); this.rows = Math.max(min_rows, rows, this.options.min_rows); diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index 195434aebd..5a43555bdb 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ -/*! gridster.js - v0.1.0 - 2012-07-24 +/*! gridster.js - v0.1.0 - 2012-07-25 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 1d6d07ed71..f74e4eaf08 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-24 +/*! gridster.js - v0.1.0 - 2012-07-25 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(null,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(null,g),j=Math.max.apply(null,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 341e1bbd4c035254577b5a119d3e6cdf69b533b6 Mon Sep 17 00:00:00 2001 From: vieron Date: Thu, 26 Jul 2012 09:58:39 +0200 Subject: [PATCH 052/248] prevent cols/rows from being empty arrays (needed to pass phantom tests) --- src/jquery.gridster.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 8d2fab8a16..bf6d789737 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -2143,10 +2143,14 @@ var actual_cols = this.$widgets.map(function() { return $(this).attr('data-col'); }); + //needed to pass tests with phantomjs + actual_cols.length || (actual_cols = [0]); var actual_rows = this.$widgets.map(function() { return $(this).attr('data-row'); }); + //needed to pass tests with phantomjs + actual_rows.length || (actual_rows = [0]); var min_cols = Math.max.apply(Math, actual_cols); var min_rows = Math.max.apply(Math, actual_rows); From cf4e876a84823cce1fdc9d8cb8fee66f898d07ec Mon Sep 17 00:00:00 2001 From: vieron Date: Thu, 26 Jul 2012 10:00:00 +0200 Subject: [PATCH 053/248] updated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 6 +++++- dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 4 ++-- docs/files/src_jquery.draggable.js.html | 4 ++-- docs/files/src_jquery.gridster.js.html | 14 +++++++++----- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index b9adb1729f..9c03f7954a 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-25 +/*! gridster.js - v0.1.0 - 2012-07-26 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index d437fcc9b0..2507a371cb 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-25 +/*! gridster.js - v0.1.0 - 2012-07-26 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ @@ -2807,10 +2807,14 @@ var actual_cols = this.$widgets.map(function() { return $(this).attr('data-col'); }); + //needed to pass tests with phantomjs + actual_cols.length || (actual_cols = [0]); var actual_rows = this.$widgets.map(function() { return $(this).attr('data-row'); }); + //needed to pass tests with phantomjs + actual_rows.length || (actual_rows = [0]); var min_cols = Math.max.apply(Math, actual_cols); var min_rows = Math.max.apply(Math, actual_rows); diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index 5a43555bdb..1d2dde3d55 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ -/*! gridster.js - v0.1.0 - 2012-07-25 +/*! gridster.js - v0.1.0 - 2012-07-26 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index f74e4eaf08..6221e40c43 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-25 +/*! gridster.js - v0.1.0 - 2012-07-26 * https://github.com/ducksboard/gridster.js * Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")}),h=this.$widgets.map(function(){return a(this).attr("data-row")}),i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html index 7e6b9a0d86..6eb57e1118 100644 --- a/docs/files/src_jquery.draggable.js.html +++ b/docs/files/src_jquery.draggable.js.html @@ -214,8 +214,8 @@ var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var mouse_down_zone = max_window_y - 10; - var mouse_up_zone = min_window_y + 10; + var mouse_down_zone = max_window_y - 30; + var mouse_up_zone = min_window_y + 20; var abs_mouse_left = offset.mouse_left; var abs_mouse_top = min_window_y + offset.mouse_top; diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html index 17f95e77bf..107d67ebe1 100644 --- a/docs/files/src_jquery.gridster.js.html +++ b/docs/files/src_jquery.gridster.js.html @@ -323,7 +323,7 @@ }, this)); if (callback) { - callback.apply(this, el); + callback.call(this, el); } }, this)); }; @@ -1645,7 +1645,7 @@ diffs.push(temp_y_units); }); - var max_diff = Math.max.apply(null, diffs); + var max_diff = Math.max.apply(Math, diffs); y_units = (y_units - max_diff); return y_units > 0 ? y_units : 0; @@ -2002,7 +2002,7 @@ } } - var highest_row = Math.max.apply(null, rows); + var highest_row = Math.max.apply(Math, rows); this.highest_occupied_cell = { col: row_in_col[highest_row], @@ -2238,13 +2238,17 @@ var actual_cols = this.$widgets.map(function() { return $(this).attr('data-col'); }); + //needed to pass tests with phantomjs + actual_cols.length || (actual_cols = [0]); var actual_rows = this.$widgets.map(function() { return $(this).attr('data-row'); }); + //needed to pass tests with phantomjs + actual_rows.length || (actual_rows = [0]); - var min_cols = Math.max.apply(null, actual_cols); - var min_rows = Math.max.apply(null, actual_rows); + var min_cols = Math.max.apply(Math, actual_cols); + var min_rows = Math.max.apply(Math, actual_rows); this.cols = Math.max(min_cols, cols, this.options.min_cols); this.rows = Math.max(min_rows, rows, this.options.min_rows); From fe1a536a31efa1bd803cea7cb3ccb084727ef6a2 Mon Sep 17 00:00:00 2001 From: vieron Date: Thu, 26 Jul 2012 12:34:48 +0200 Subject: [PATCH 054/248] modified grunt to generate docs in gh-pages folder --- grunt.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grunt.js b/grunt.js index aa31d6a54e..897aa29473 100644 --- a/grunt.js +++ b/grunt.js @@ -72,7 +72,7 @@ module.exports = function(grunt) { "logo": 'http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png', options: { paths: "src/", - outdir: "docs/" + outdir: "gh-pages/docs/" } } } @@ -81,6 +81,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib'); // Default task. - grunt.registerTask('default', 'lint qunit concat min mincss'); + grunt.registerTask('default', 'lint qunit concat min mincss yuidoc'); }; From c46c3482230f57407bff88537869e430f30b8ea2 Mon Sep 17 00:00:00 2001 From: vieron Date: Thu, 26 Jul 2012 12:35:39 +0200 Subject: [PATCH 055/248] removing docs from master --- docs/api.js | 12 - docs/assets/css/external-small.png | Bin 491 -> 0 bytes docs/assets/css/logo.png | Bin 6308 -> 0 bytes docs/assets/css/main.css | 782 -- docs/assets/favicon.png | Bin 740 -> 0 bytes docs/assets/img/spinner.gif | Bin 2685 -> 0 bytes docs/assets/index.html | 10 - docs/assets/js/api-filter.js | 52 - docs/assets/js/api-list.js | 251 - docs/assets/js/api-search.js | 98 - docs/assets/js/apidocs.js | 351 - docs/assets/js/yui-prettify.js | 17 - docs/assets/vendor/prettify/CHANGES.html | 130 - docs/assets/vendor/prettify/COPYING | 202 - docs/assets/vendor/prettify/README.html | 203 - docs/assets/vendor/prettify/prettify-min.css | 1 - docs/assets/vendor/prettify/prettify-min.js | 35 - docs/classes/Collision.html | 376 - docs/classes/Coords.html | 276 - docs/classes/Draggable.html | 406 - docs/classes/Gridster.html | 8243 ------------------ docs/classes/index.html | 10 - docs/data.json | 1665 ---- docs/files/index.html | 10 - docs/files/src_jquery.collision.js.html | 339 - docs/files/src_jquery.coords.js.html | 223 - docs/files/src_jquery.draggable.js.html | 429 - docs/files/src_jquery.gridster.js.html | 2299 ----- docs/index.html | 129 - docs/modules/index.html | 10 - 30 files changed, 16559 deletions(-) delete mode 100644 docs/api.js delete mode 100644 docs/assets/css/external-small.png delete mode 100644 docs/assets/css/logo.png delete mode 100644 docs/assets/css/main.css delete mode 100644 docs/assets/favicon.png delete mode 100644 docs/assets/img/spinner.gif delete mode 100644 docs/assets/index.html delete mode 100644 docs/assets/js/api-filter.js delete mode 100644 docs/assets/js/api-list.js delete mode 100644 docs/assets/js/api-search.js delete mode 100644 docs/assets/js/apidocs.js delete mode 100644 docs/assets/js/yui-prettify.js delete mode 100644 docs/assets/vendor/prettify/CHANGES.html delete mode 100644 docs/assets/vendor/prettify/COPYING delete mode 100644 docs/assets/vendor/prettify/README.html delete mode 100644 docs/assets/vendor/prettify/prettify-min.css delete mode 100644 docs/assets/vendor/prettify/prettify-min.js delete mode 100644 docs/classes/Collision.html delete mode 100644 docs/classes/Coords.html delete mode 100644 docs/classes/Draggable.html delete mode 100644 docs/classes/Gridster.html delete mode 100644 docs/classes/index.html delete mode 100644 docs/data.json delete mode 100644 docs/files/index.html delete mode 100644 docs/files/src_jquery.collision.js.html delete mode 100644 docs/files/src_jquery.coords.js.html delete mode 100644 docs/files/src_jquery.draggable.js.html delete mode 100644 docs/files/src_jquery.gridster.js.html delete mode 100644 docs/index.html delete mode 100644 docs/modules/index.html diff --git a/docs/api.js b/docs/api.js deleted file mode 100644 index 8b7efa7acb..0000000000 --- a/docs/api.js +++ /dev/null @@ -1,12 +0,0 @@ -YUI.add("yuidoc-meta", function(Y) { - Y.YUIDoc = { meta: { - "classes": [ - "Collision", - "Coords", - "Draggable", - "Gridster" - ], - "modules": [], - "allModules": [] -} }; -}); \ No newline at end of file diff --git a/docs/assets/css/external-small.png b/docs/assets/css/external-small.png deleted file mode 100644 index 759a1cdcb5b1697e5be290d98b830e279cd71f3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 491 zcmVDs{zR1^XE?tfB*h@ASKHAa7wwn{MEbP z7_^nS7{V*>+A}bS;P%45fB%Ai|Neasi2rl3{=EO;!w318%8Ovl7jArHc=P5Brfr~D z0AYimtss2w$hlYlfd>7*aO3TNzw875LBK0xAD9Np|A(oEVYnB*eE9~V6wP%78SXuL z&#-X)Er#`zY#Ce)^8hM>B_8 diff --git a/docs/assets/css/logo.png b/docs/assets/css/logo.png deleted file mode 100644 index 609b336c7cc5ef0c787a0068d221d9b8d69b1241..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6308 zcmV;V7+dFwP)EI3}K zJAc0RviDlMYT7$`hje!Kj@LB3B$v~Qd;9X^3|$AqFu>69Z0KMbrezvAWa@n&$tpT| zTCH{cyjdVi(gp+w@V^dOksB0A>WW6xhIlO6Tv?HM0X_i}I#y60{PpGwx9vPMtFtRN zzNw#+=Tj2u`-uL(#+a*U!Mhu zc*G(+@nj+A1708rA$uKO;<-VVr3MVYxhNW0pGl{-r;6j7{t5L6rgfY5PJ8CL9kUwu zbudgU8eg2Ex&np2&cRTd`wY)J^i1Ra5;fuU*mdm4tUfgDMK5-q{|m=*>K zmt0VX&YeBdQ=)fa$R^1smi%+SgBQrVaGN@ES(A;8iY#qZRr%H8m*V6T)hnK*O z|1pC?@pvK+BT#UNUrSjdWbFT{Dzm@;L_uBh$8ED$ zuiJfPTW9`aY$8*RdjnUUrlU^R+`03|hDm_i5Luwnq7j z3E6ba0VDwiwDHfNDd`afqMg z;ri!g_m!HW5oK|Cwq!YmyzwIm^+yk_|MHs+Eq9xyRnxCJok*4f#gVLpK`K!hOA`m7 zrXArDhy&z@@Nn!4VdiZ&EK2} z!>Wpb{OnM$1DNA}{p_I4v2VIXKZ_VEfRJY;Iuu1&R+5T8o=vA-I4+<*_iE$hMa%1N z?C8v0J+L~7s%)S@Ol>?uPErsk33`wuLuSY*+7vE48>%1a67ze?luG!wOC|%)EeI?C zwx8(O`zi;pKd^^yj)74>4y=|X<3)=q%hS&sGpIj(bkp1oZ|%Pi=bIBl)oF$l5s2@M zMR71BQ;7WmRiZH{$yVb?Qlg!quu66K@%K)LY$gGSZT&zB6I6^-H+0k^z+_eD?rXV0 z5L1qV!A8eorwW24lZ?>%SS-4rYDo5p4;AW7cfWM)yL&qBv%JW5V0Dtllaoax+#e8V zB$k8}28x_x5pbFwuF@G(hQL=Zo$NO}umKO_6oH2kR4wxSrWK}m#G&)Saemf6U$B$# zrk6{FSmir^W1qZLRh7qwRhQrMfkT~l``>=_UTe?oZtBgd(=tsiMRB8Ch$x^WV>B2V z2&ft>#tNPJ}C{6fYwxz@4|uh6E0@Tu_z>Hq6&SP$9h8q(!7amKNbU6FeVQ}e16NTW!wW&xj$800_2i8@Oqgl}( zBSw)>zyh$kWustb6XGlYV~&}Q<#hu4I2f+-v+5yb_Z=xziTz{6OS|eQ&>jY;WnVK< zC-H4sK93taZ#RBkqo1YXxB%3K83r_hfuO2dE_W1xNt zM0PXiOoA)J`RvVj-Ko>7p*$P6lX{8PUSW6R0a&^20BmcNVdIuIyv<@%guE030oxG( zo?N~Tw)_KN*^1o|jTX^uTeiLne_Xi>wrta2?JLbpT^KQ7kpLFMd+=F!t3ij~|9Kbg z?DqNBz4A8v^@Y9gWXeu*Dj4zq2_$oi{Sn_&7~dqZ!8iyBqiKY1-HN?Zbxp z%=7P#eQfF0WjMl}6i_FHX+zXqpqdRdnk@lERXCvF0o8ev8*_ky@1qUVbX2O_VCif! zOA{`dJI)8?n7Q8GJgo=&{!!u@9x-4gSFN;#Wx7XCFDZ2R-^B-`>$|$O;BgpV=&2U} z-Q8pFvun>G@B2G;?!_leayJd!-|j}>eA>jQmQBmt-)qs>p$50j1G}3J?B0K%?el|% zx@g(fW!SGx;?$}8e$6$vE>IHb7L}!O&LszcA`fWZ1BxUClIbB{7o-bn0SpGFZEjhm zo_0zNl$XUR7}31)&e3Uf$=!|^VBqa9R+|tCDKB!$WE+_&GKBtskbs5t>4?=n8%zm6 zT_c8sC>^X}`MkEYvAJbUOKbb5`h`00w$<0;#+>ZJ^wb$URR>Z?Vx4f)LgW^bpmC?862+ zeD`4UR^}Rb;~wIXya zx}t0;$f`{JW*AUX!*zWr@rlJ{c42`nT#(?%bnnhM{!~QV~&KNRZ#a{m5J7Kckw5%_+cXV&s z_uio&gqq*8PN}*Irw$#QI-SpXVs7&`+!!{wYCH6phTRT*q+&i zpen_P7awo-tl@TG#Be~I=>}f$d>RxuQqc6W0UN7Y z2%dwDv>`;fo++^0j!d_f;1u&G`}QAv`A}Qe6b|ZjS4`VDW<>GTE>JzsE0w4>l1e}n zr!I(zZbhK>-4+{Y0{c)>G4k?Ua8+t@zLb8}-E}t5Y-tgkb=pWH1T>gdk z4zzuPOKI+#f8NrHZ0ttjKdCwypmI?Z66I+ds8IkYGYmy7NCzAsGDz@>fAhQV0prFVph_Hz=*3y7?lo;8z0y7vcglvC70- z79pQygD(HHCAbZLffYNMD?Tjw`NcmQT9LTPg-K=-g{6j;4+zvAxsa#nL8@Z7N7Em( zXZa8rmHIGEFL*lVj8TsNl5Q-Ld#=|Q#%%}FJ zRJOwbmnK0dM8uU9fv;gBKDQ*^|7Tj zL+oDe0X2g_b=U0bP*OpBp$v$tn}nHN=Wk{`39L?;S_PHmNk3|Jf+JC}T;mBUMj+;^ zq2Z|=fQjqGT-O64g{DA-{49H`&X0T@Ul@Sx`{m&6L&O&-z=4Q`*WH`LId=}bO8wbX zDlv6Oc zF|f-^0Gr;}1G;fCsH$-9l*<-Fz$V5m`SIaEc4OfiB(Ie4sfB*2uYJSgA}MUn0uJF5E5f`SZN`Q@Aca6eYyMD{kC2-IMJ zD$zJZyTd+E%wI!*LgKd5E$g^gQgQu3i20i%lzrX4Azr%{ZY=-)GG_Pp?wJT@gfTbI92Oa;8JDdj#9Gc;WI2NX9I$xmh(wh8>uPK67)(Jw6zcMYm(2a*x1N5aqpkZI8))7Ks`Ef& zC1s$fMgGoQ!M;GmOP411_he#vy^FI=u>Eig_!n*YV9A#*|J*cq@(-I~*MT@a=ihg> z!}cAxg^dQg$77RbNqC#AdI}XMvNjfrz^&i;3_Sju*I~!*JY8SEy#?yG?ZuxMQJ^^W zrSW(KzVd~WVA6y%KCBsDHgwv+4R|c?dVEV^Im3dGW10NIg5`h(VtG~$t<2nr1EKmO zx=GHZHVZDfcHGGHJk!uRIG|ddQLPT?$`PR|^^5d+fpVb1r8Fl@EO&1ASzi0oo@-go zpbN{3q@7_HP(3sY-@Nh+xbVypNW|Qe<46bxP~MEE@nb6B*6YuPx{-1SQv3hm!^+{N z>rRKyoSlKvlBjbm)dA_uPPF@jo6doA&LU&j4Idt!5^=JhDUxM=JM$U*>oJ}6berXk zA8Jg-V_%$9H)8JL0PQzWBGZC9KKrXxFKv6}!AGC_c1ugo)gsVDX*np7B0nb;Ml<+D z1vb(({RodytZjN-^W=PTYuJpRMa)e|qS|OQ3g?|Q5$2qQ;J_gZE3E^%dUSe>qNoIQ zqtZ|_G>*@e!ySg0L)p)>EZ+o@kBMXgzIf?raPj9%IM8aqtFJYY@Qi-FvLXTF#$@m^ zj(@*Kuf>HUIlt}X>Eqz(KWxKkRvbnSE3w@Nt5oN=dlrc`$Bsq98#*G2{Mf|0kw-M@ z;jjjC|JS1D&V1tOHTQINbHOc-B&*w6MTiu`molOp4j)*Q{iGik72{Q6bry!7Iq=Fd89#@Nf_ zMao|#?58}SLgmQ4Ps$b-OrglYsfhqUZ?FFTsznFe`>qTh&7g-A9D>CL+Z1DeI;kQMSlA}X2`)^_Q>|!@#k7am zF$>th3Ouvk+S*AT?r_d!Ispk2j4>k%+4F!CpxH1aH(=$W@nBGA@go`N`TRRS^tVe= zVhj$J+ZnXK6*pY;Nz!2VR4E-ivgI_5N(FkF)X8|G&RN_)V4 z^8;SC9PEJBHiKUA@M>%sOoNFuc_40YuzXX%6a!2re+-FUo#?{itQUI++@fKWgrp{% za{YYL_>p&i5RY9P5!9DAHBZqrV*+2Ww}R=5DXNn#;@bh!n9&(Vp>AI0r#8qjscvIi zZq7Hzw8yf02CRO5Grn5;WgpY0)X-qZZFN6|KwjX($e)3WJd5BxpydTYY~YI6z{mS- zy+bVDweuVGUc&3TN%pbtIi&fOe4g(2(6d5JH*?bg`^pZNrCl)NzP zqd?lzy!RkHvSbY$?2u?(m{ydWi1Xhsp9wRkW$hFT|3LIL$0hB+3% zlAJISiP2|l=xwp1s6vIAV;uN&MpR{4CR4J!Zp`rG?p;d9!FTw&p&s> z6`4$o1K1x}=DlUX*WZX`JA{s+ycjgcc-a|IlvVLWY}H98j(Z4>k}&_nY<%rV8byJt0*nyoo@3wI~{SwW6$a{pgX^&%sA5cF)n9#9&GxwgR z{Zs0xV^FE`UP%o^P=X8QK;aQ!TAjwSMDZdq=Skc3kWr9qOVj$|TMUy@2RjU7Gg zIrtb)=y-bFI+?cA|6}%{w$5tu%FgzVo|%5E5)Kw8`kl#Syxx^LPA%$(R%SQBCwTgQ a0R{k+kX}`<%LV)Z0000
      - - -
      The original - Prettier -
      class Voila {
      -public:
      -  // Voila
      -  static const string VOILA = "Voila";
      -
      -  // will not interfere with embedded tags.
      -}
      - -
      class Voila {
      -public:
      -  // Voila
      -  static const string VOILA = "Voila";
      -
      -  // will not interfere with embedded tags.
      -}
      -
      - -

      FAQ

      -

      Which languages does it work for?

      -

      The comments in prettify.js are authoritative but the lexer - should work on a number of languages including C and friends, - Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. - It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl - and Ruby, but, because of commenting conventions, doesn't work on - Smalltalk, or CAML-like languages.

      - -

      LISPy languages are supported via an extension: - lang-lisp.js.

      -

      And similarly for - CSS, - Haskell, - Lua, - OCAML, SML, F#, - Visual Basic, - SQL, - Protocol Buffers, and - WikiText.. - -

      If you'd like to add an extension for your favorite language, please - look at src/lang-lisp.js and file an - issue including your language extension, and a testcase.

      - -

      How do I specify which language my code is in?

      -

      You don't need to specify the language since prettyprint() - will guess. You can specify a language by specifying the language extension - along with the prettyprint class like so:

      -
      <pre class="prettyprint lang-html">
      -  The lang-* class specifies the language file extensions.
      -  File extensions supported by default include
      -    "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
      -    "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
      -    "xhtml", "xml", "xsl".
      -</pre>
      - -

      It doesn't work on <obfuscated code sample>?

      -

      Yes. Prettifying obfuscated code is like putting lipstick on a pig - — i.e. outside the scope of this tool.

      - -

      Which browsers does it work with?

      -

      It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. - Look at the test page to see if it - works in your browser.

      - -

      What's changed?

      -

      See the change log

      - -

      Why doesn't Prettyprinting of strings work on WordPress?

      -

      Apparently wordpress does "smart quoting" which changes close quotes. - This causes end quotes to not match up with open quotes. -

      This breaks prettifying as well as copying and pasting of code samples. - See - WordPress's help center for info on how to stop smart quoting of code - snippets.

      - -

      How do I put line numbers in my code?

      -

      You can use the linenums class to turn on line - numbering. If your code doesn't start at line number 1, you can - add a colon and a line number to the end of that class as in - linenums:52. - -

      For example -

      <pre class="prettyprint linenums:4"
      ->// This is line 4.
      -foo();
      -bar();
      -baz();
      -boo();
      -far();
      -faz();
      -<pre>
      - produces -
      // This is line 4.
      -foo();
      -bar();
      -baz();
      -boo();
      -far();
      -faz();
      -
      - -

      How do I prevent a portion of markup from being marked as code?

      -

      You can use the nocode class to identify a span of markup - that is not code. -

      <pre class=prettyprint>
      -int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
      -  Continuation of comment */
      -int y = bar();
      -</pre>
      -produces -
      -int x = foo();  /* This is a comment  This is not code
      -  Continuation of comment */
      -int y = bar();
      -
      - -

      For a more complete example see the issue22 - testcase.

      - -

      I get an error message "a is not a function" or "opt_whenDone is not a function"

      -

      If you are calling prettyPrint via an event handler, wrap it in a function. - Instead of doing -

      - addEventListener('load', prettyPrint, false); -
      - wrap it in a closure like -
      - addEventListener('load', function (event) { prettyPrint() }, false); -
      - so that the browser does not pass an event object to prettyPrint which - will confuse it. - -


      - - - - diff --git a/docs/assets/vendor/prettify/prettify-min.css b/docs/assets/vendor/prettify/prettify-min.css deleted file mode 100644 index 9b554aac54..0000000000 --- a/docs/assets/vendor/prettify/prettify-min.css +++ /dev/null @@ -1 +0,0 @@ -.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}} \ No newline at end of file diff --git a/docs/assets/vendor/prettify/prettify-min.js b/docs/assets/vendor/prettify/prettify-min.js deleted file mode 100644 index 3dec9931c5..0000000000 --- a/docs/assets/vendor/prettify/prettify-min.js +++ /dev/null @@ -1,35 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y}; -(function(){function y(b){return b.replace(L,"&").replace(M,"<").replace(N,">")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name"); -for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1), -8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;eh[0]){h[1]+1>h[0]&&a.push("-"); -a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b, -f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, -null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, -null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, -null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("");j=null}if(!j&&q){j=q;n.push('')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1 ");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g, -d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?" \r\n":h===7?" 
      \r":" \r":" 
      ":"
      ";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'
    1. ';var F=g[1]&&g[1].length?g[1]-1:0;n.push('
      1. ");s=function(){var D=v[++F%10];return j?""+D+'':D}}else s=h; -for(;;)if(m");j=null}n.push(o[m+1]);m+=2}else if(t");g&&n.push("
      ");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja, -"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=", -"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=//g,X=/\"/g,ea=/</g,fa=/>/g,ga=/'/g,ha=/"/g,ja=/&/g,ia=/ /g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+| -

      - - -
      - API Docs for: -
      - -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      Collision Class

      -
      - -
      - Uses - -
      - - - - - -
      - Defined in: src/jquery.collision.js:19 -
      - - - - - -
      - - - -
      -

      Detects collisions between a DOM element against other DOM elements or -Coords objects.

      -
      - - -
      -

      Constructor

      -
      -

      Collision

      - - -
      - (
        - -
      • - - el - -
      • - -
      • - - colliders - -
      • - -
      • - - [options] - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.collision.js:19 - -

      - - - - - -
      - -
      - -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el - HTMLElement - - - - -
        -

        The jQuery wrapped HTMLElement.

        -
        - - -
      • - -
      • - - colliders - HTMLElement | Array - - - - -
        -

        Can be a jQuery collection - of HTMLElements or an Array of Coords instances.

        -
        - - -
      • - -
      • - - [options] - Object - optional - - - - -
        -

        An Object with all options you want to - overwrite:

        -
        - - -
          - -
        • - - [on_overlap_start] - Function - optional - - -
          -

          Executes a function the first - time each collider is overlapped.

          -
          - - -
        • - -
        • - - [on_overlap_stop] - Function - optional - - -
          -

          Executes a function when a - collider is no longer collided.

          -
          - - -
        • - -
        • - - [on_overlap] - Function - optional - - -
          -

          Executes a function when the -mouse is moved during the collision.

          -
          - - -
        • - -
        - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Collision instance. - -
      -
      - - - -
      - -
      - - -
      - - -
      -
      -

      Item Index

      - - - - - - - - -
      - - - - - - - - -
      -
      - -
      -
      -
      -
      -
      - - - - - - - - - - - diff --git a/docs/classes/Coords.html b/docs/classes/Coords.html deleted file mode 100644 index cfa96b9082..0000000000 --- a/docs/classes/Coords.html +++ /dev/null @@ -1,276 +0,0 @@ - - - - - Coords - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      Coords Class

      -
      - - - - - -
      - Defined in: src/jquery.coords.js:10 -
      - - - - - -
      - - - -
      -

      Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height) -to simulate DOM elements on the screen. -Coords is used by Gridster to create a faux grid with any DOM element can -collide.

      -
      - - -
      -

      Constructor

      -
      -

      Coords

      - - -
      - (
        - -
      • - - obj - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.coords.js:10 - -

      - - - - - -
      - -
      - -
      - - -
      -

      Parameters:

      - -
        - -
      • - - obj - HTMLElement | Object - - - - -
        -

        The jQuery HTMLElement or a object with: left, -top, width and height properties.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Coords instance. - -
      -
      - - - -
      - -
      - - -
      - - -
      -
      -

      Item Index

      - - - - - - - - -
      - - - - - - - - -
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/classes/Draggable.html b/docs/classes/Draggable.html deleted file mode 100644 index 2f5fdcae80..0000000000 --- a/docs/classes/Draggable.html +++ /dev/null @@ -1,406 +0,0 @@ - - - - - Draggable - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      Draggable Class

      -
      - - - - - -
      - Defined in: src/jquery.draggable.js:26 -
      - - - - - -
      - - - -
      -

      Basic drag implementation for DOM elements inside a container. -Provide start/stop/drag callbacks.

      -
      - - -
      -

      Constructor

      -
      -

      Draggable

      - - -
      - (
        - -
      • - - el - -
      • - -
      • - - [options] - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.draggable.js:26 - -

      - - - - - -
      - -
      - -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el - HTMLElement - - - - -
        -

        The HTMLelement that contains all the widgets - to be dragged.

        -
        - - -
      • - -
      • - - [options] - Object - optional - - - - -
        -

        An Object with all options you want to - overwrite:

        -
        - - -
          - -
        • - - [items] - HTMLElement | String - optional - - -
          -

          Define who will - be the draggable items. Can be a CSS Selector String or a - collection of HTMLElements.

          -
          - - -
        • - -
        • - - [distance] - Number - optional - - -
          -

          Distance in pixels after mousedown - the mouse must move before dragging should start.

          -
          - - -
        • - -
        • - - [limit] - Boolean - optional - - -
          -

          Constrains dragging to the width of - the container

          -
          - - -
        • - -
        • - - [offset_left] - Offset_left - optional - - -
          -

          Offset added to the item - that is being dragged.

          -
          - - -
        • - -
        • - - [drag] - Number - optional - - -
          -

          Executes a callback when the mouse is - moved during the dragging.

          -
          - - -
        • - -
        • - - [start] - Number - optional - - -
          -

          Executes a callback when the drag - starts.

          -
          - - -
        • - -
        • - - [stop] - Number - optional - - -
          -

          Executes a callback when the drag stops.

          -
          - - -
        • - -
        - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns el. - -
      -
      - - - -
      - -
      - - -
      - - -
      -
      -

      Item Index

      - - - - - - - - -
      - - - - - - - - -
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/classes/Gridster.html b/docs/classes/Gridster.html deleted file mode 100644 index 51266028a4..0000000000 --- a/docs/classes/Gridster.html +++ /dev/null @@ -1,8243 +0,0 @@ - - - - - Gridster - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      Gridster Class

      -
      - -
      - Uses - -
      - - - - - -
      - Defined in: src/jquery.gridster.js:33 -
      - - - - - -
      - - - -
      - -
      - - -
      -

      Constructor

      -
      -

      Gridster

      - - -
      - (
        - -
      • - - el - -
      • - -
      • - - [options] - -
      • - -
      ) -
      - - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:33 - -

      - - - - - -
      - -
      - -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el - HTMLElement - - - - -
        -

        The HTMLelement that contains all the widgets.

        -
        - - -
      • - -
      • - - [options] - Object - optional - - - - -
        -

        An Object with all options you want to - overwrite:

        -
        - - -
          - -
        • - - [widget_selector] - HTMLElement | String - optional - - -
          -

          Define who will - be the draggable widgets. Can be a CSS Selector String or a - collection of HTMLElements

          -
          - - -
        • - -
        • - - [widget_margins] - Array - optional - - -
          -

          Margin between widgets. - The first index for the horizontal margin (left, right) and - the second for the vertical margin (top, bottom).

          -
          - - -
        • - -
        • - - [widget_base_dimensions] - Array - optional - - -
          -

          Base widget dimensions - in pixels. The first index for the width and the second for the - height.

          -
          - - -
        • - -
        • - - [extra_cols] - Number - optional - - -
          -

          Add more columns in addition to - those that have been calculated.

          -
          - - -
        • - -
        • - - [extra_rows] - Number - optional - - -
          -

          Add more rows in addition to - those that have been calculated.

          -
          - - -
        • - -
        • - - [min_cols] - Number - optional - - -
          -

          The minimum required columns.

          -
          - - -
        • - -
        • - - [min_rows] - Number - optional - - -
          -

          The minimum required rows.

          -
          - - -
        • - -
        • - - [autogenerate_stylesheet] - Boolean - optional - - -
          -

          If true, all the - CSS required to position all widgets in their respective columns - and rows will be generated automatically and injected to the - <head> of the document. You can set this to false, and write - your own CSS targeting rows and cols via data-attributes like so: - [data-col="1"] { left: 10px; }

          -
          - - -
        • - -
        • - - [avoid_overlapped_widgets] - Boolean - optional - - -
          -

          Avoid that widgets loaded - from the DOM can be overlapped. It is helpful if the positions were - bad stored in the database or if there was any conflict.

          -
          - - -
        • - -
        • - - [serialize_params] - Function - optional - - -
          -

          Return the data you want - for each widget in the serialization. Two arguments are passed: - $w: the jQuery wrapped HTMLElement, and wgd: the grid - coords object (col, row, size_x, size_y).

          -
          - - -
        • - -
        • - - [collision] - Object - optional - - -
          -

          An Object with all options for - Collision class you want to overwrite. See Collision docs for - more info.

          -
          - - -
        • - -
        • - - [draggable] - Object - optional - - -
          -

          An Object with all options for - Draggable class you want to overwrite. See Draggable docs for more - info.

          -
          - - -
        • - -
        - -
      • - -
      -
      - - - - - -
      - -
      - - -
      - - -
      -
      -

      Item Index

      - - -
      -

      Methods

      - - -
      - - - - - - - -
      - - -
      -

      Methods

      - - -
      -

      add_style_tag

      - - -
      - (
        - -
      • - - css - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:2030 - -

      - - - - - -
      - -
      -

      Injects the given CSS as string to the head of the document.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - css - String - - - - -
        -

        The styles to apply.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      add_to_gridmap

      - - -
      - (
        - -
      • - - grid_data - -
      • - -
      • - - value - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:349 - -

      - - - - - -
      - -
      -

      Add a widget to the mapped array of positions.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - grid_data - Object - - - - -
        -

        The grid coords object representing the cells - to update in the mapped array.

        -
        - - -
      • - -
      • - - value - HTMLElement | Boolean - - - - -
        -

        The value to set in the specified - position .

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      add_widget

      - - -
      - (
        - -
      • - - html - -
      • - -
      • - - size_x - -
      • - -
      • - - size_y - -
      • - -
      ) -
      - - - - - HTMLElement - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:133 - -

      - - - - - -
      - -
      -

      Add a new widget to the grid.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - html - String - - - - -
        -

        The string representing the HTML of the widget.

        -
        - - -
      • - -
      • - - size_x - Number - - - - -
        -

        The nº of rows the widget occupies horizontally.

        -
        - - -
      • - -
      • - - size_y - Number - - - - -
        -

        The nº of columns the widget occupies vertically.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElement: - - Returns the jQuery wrapped HTMLElement representing. - the widget that was just created. - -
      -
      - - - -
      - - -
      -

      can_go_player_up

      - - -
      - (
        - -
      • - - widget_grid_data - -
      • - -
      ) -
      - - - - - Number | Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1056 - -

      - - - - - -
      - -
      -

      Determines whether the player can move to a position above.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widget_grid_data - Object - - - - -
        -

        The actual grid coords object of the - player.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Number | Boolean: - - If the player can be moved to an upper row - returns the row number, else returns false. - -
      -
      - - - -
      - - -
      -

      can_go_up_to_row

      - - -
      - (
        - -
      • - - widget_grid_data - -
      • - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean | Number - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1469 - -

      - - - - - -
      - -
      -

      Check if the widget can move to the specified row, else returns the -upper row possible.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widget_grid_data - Number - - - - -
        -

        The current grid coords object of the - widget.

        -
        - - -
      • - -
      • - - col - Number - - - - -
        -

        The target column.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The target row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean | Number: - - Returns the row number if the widget can move - to the target position, else returns false. - -
      -
      - - - -
      - - -
      -

      can_go_widget_up

      - - -
      - (
        - -
      • - - widget_grid_data - -
      • - -
      ) -
      - - - - - Number | Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1105 - -

      - - - - - -
      - -
      -

      Determines whether a widget can move to a position above.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widget_grid_data - Object - - - - -
        -

        The actual grid coords object of the - widget we want to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Number | Boolean: - - If the widget can be moved to an upper row - returns the row number, else returns false. - -
      -
      - - - -
      - - -
      -

      can_move_to

      - - -
      - (
        - -
      • - - widget_grid_data - -
      • - -
      • - - The - -
      • - -
      • - - The - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1644 - -

      - - - - - -
      - -
      -

      Check if it's possible to move a widget to a specific col/row. It takes -into account the dimensions (size_y and size_x attrs. of the grid - coords object) the widget occupies.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widget_grid_data - Object - - - - -
        -

        The grid coords object that represents - the widget.

        -
        - - -
      • - -
      • - - The - Object - - - - -
        -

        col target col.

        -
        - - -
      • - -
      • - - The - Object - - - - -
        -

        row target row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true if all cells are empty, else return false. - -
      -
      - - - -
      - - -
      -

      draggable

      - - - () - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:371 - -

      - - - - - -
      - -
      -

      Make widgets draggable.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      empty_cells_player_occupies

      - - - () - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1606 - -

      - - - - - -
      - -
      -

      Remove from the array of mapped positions the reference to the player.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      enable

      - - - () - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:108 - -

      - - - - - -
      - -
      -

      Disable dragging.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      enable

      - - - () - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:121 - -

      - - - - - -
      - -
      -

      Enable dragging.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      for_each_cell_occupied

      - - -
      - (
        - -
      • - - el_grid_data - -
      • - -
      • - - callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1748 - -

      - - - - - -
      - -
      -

      Iterate over the cells occupied by a widget executing a function for -each one.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el_grid_data - Object - - - - -
        -

        The grid coords object that represents the - widget.

        -
        - - -
      • - -
      • - - callback - Function - - - - -
        -

        The function to execute on each column - iteration. Column and row are passed as arguments.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      for_each_column_occupied

      - - -
      - (
        - -
      • - - el_grid_data - -
      • - -
      • - - callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1769 - -

      - - - - - -
      - -
      -

      Iterate over the columns occupied by a widget executing a function for -each one.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el_grid_data - Object - - - - -
        -

        The grid coords object that represents - the widget.

        -
        - - -
      • - -
      • - - callback - Function - - - - -
        -

        The function to execute on each column - iteration. The column number is passed as first argument.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      for_each_row_occupied

      - - -
      - (
        - -
      • - - el_grid_data - -
      • - -
      • - - callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1788 - -

      - - - - - -
      - -
      -

      Iterate over the rows occupied by a widget executing a function for -each one.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el_grid_data - Object - - - - -
        -

        The grid coords object that represents - the widget.

        -
        - - -
      • - -
      • - - callback - Function - - - - -
        -

        The function to execute on each column - iteration. The row number is passed as first argument.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      for_each_widget_above

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      • - - callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1855 - -

      - - - - - -
      - -
      -

      Iterate over each widget above the column and row specified.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to start iterating.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to start iterating.

        -
        - - -
      • - -
      • - - callback - Function - - - - -
        -

        The function to execute on each widget - iteration. The value of this inside the function is the jQuery - wrapped HTMLElement.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      for_each_widget_below

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      • - - callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1872 - -

      - - - - - -
      - -
      -

      Iterate over each widget below the column and row specified.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to start iterating.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to start iterating.

        -
        - - -
      • - -
      • - - callback - Function - - - - -
        -

        The function to execute on each widget - iteration. The value of this inside the function is the jQuery wrapped - HTMLElement.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      generate_faux_grid

      - - -
      - (
        - -
      • - - rows - -
      • - -
      • - - cols - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:2053 - -

      - - - - - -
      - -
      -

      Generates a faux grid to collide with it when a widget is dragged and -detect row or column that we want to go.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - rows - Number - - - - -
        -

        Number of columns.

        -
        - - -
      • - -
      • - - cols - Number - - - - -
        -

        Number of rows.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      generate_grid_and_stylesheet

      - - - () - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:2127 - -

      - - - - - -
      - -
      -

      Calculate columns and rows to be set based on the configuration - parameters, grid dimensions, etc ...

      -
      - - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      generate_stylesheet

      - - -
      - (
        - -
      • - - rows - -
      • - -
      • - - cols - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1960 - -

      - - - - - -
      - -
      -

      It generates the neccessary styles to position the widgets.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - rows - Number - - - - -
        -

        Number of columns.

        -
        - - -
      • - -
      • - - cols - Number - - - - -
        -

        Number of rows.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      get_cells_occupied

      - - -
      - (
        - -
      • - - el_grid_data - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1720 - -

      - - - - - -
      - -
      -

      Get all columns and rows that a widget occupies.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el_grid_data - Object - - - - -
        -

        The grid coords object of the widget.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns an object like { cols: [], rows: []}. - -
      -
      - - - -
      - - -
      -

      get_highest_occupied_cell

      - - - () - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1889 - -

      - - - - - -
      - -
      -

      Returns the highest occupied cell in the grid.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns an object with col and row numbers. - -
      -
      - - - -
      - - -
      -

      get_targeted_columns

      - - -
      - (
        - -
      • - - [from_col] - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1684 - -

      - - - - - -
      - -
      -

      Given the leftmost column returns all columns that are overlapping - with the player.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - [from_col] - Number - optional - - - - -
        -

        The leftmost column.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns an array with column numbers. - -
      -
      - - - -
      - - -
      -

      get_targeted_rows

      - - -
      - (
        - -
      • - - [from_row] - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1703 - -

      - - - - - -
      - -
      -

      Given the upper row returns all rows that are overlapping with the player.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - [from_row] - Number - optional - - - - -
        -

        The upper row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns an array with row numbers. - -
      -
      - - - -
      - - -
      -

      get_valid_rows

      - - -
      - (
        - -
      • - - widget_grid_data - -
      • - -
      • - - upper_rows - -
      • - -
      • - - min_row - -
      • - -
      ) -
      - - - - - Number | Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1158 - -

      - - - - - -
      - -
      -

      Search a valid row for the widget represented by widget_grid_data' in -theupperrowsarray. Iteration starts from row specified inminrow`.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widget_grid_data - Object - - - - -
        -

        The actual grid coords object of the - player.

        -
        - - -
      • - -
      • - - upper_rows - Array - - - - -
        -

        An array with columns as index and arrays - of valid rows as values.

        -
        - - -
      • - -
      • - - min_row - Number - - - - -
        -

        The upper row from which the iteration will start.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Number | Boolean: - - Returns the upper row valid from the upper_rows - for the widget in question. - -
      -
      - - - -
      - - -
      -

      get_widgets_from_DOM

      - - - () - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:2113 - -

      - - - - - -
      - -
      -

      Get all widgets in the DOM and register them.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      get_widgets_overlapped

      - - - () - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1236 - -

      - - - - - -
      - -
      -

      Get widgets overlapping with the player.

      -
      - - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - Returns a jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      get_widgets_under_player

      - - - () - - - - - HTMLElement - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:985 - -

      - - - - - -
      - -
      -

      Get widgets overlapping with the player.

      -
      - - - - -
      -

      Returns:

      - -
      - - - HTMLElement: - - Returns a jQuery collection of HTMLElements - -
      -
      - - - -
      - - -
      -

      is_empty

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:904 - -

      - - - - - -
      - -
      -

      Determines if the cell represented by col and row params is empty.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_occupied

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:923 - -

      - - - - - -
      - -
      -

      Determines if the cell represented by col and row params is occupied.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_placeholder_in

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:877 - -

      - - - - - -
      - -
      -

      Determines if the placeholder is currently over the row and col given.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_placeholder_in_col

      - - -
      - (
        - -
      • - - col - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:891 - -

      - - - - - -
      - -
      -

      Determines if the placeholder is currently over the column given.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_player

      - - -
      - (
        - -
      • - - col_or_el - -
      • - -
      • - - [row] - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:845 - -

      - - - - - -
      - -
      -

      Determines if there is a widget in the row and col given. Or if the -HTMLElement passed as first argument is the player.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col_or_el - Number | HTMLElement - - - - -
        -

        A jQuery wrapped collection of -HTMLElements.

        -
        - - -
      • - -
      • - - [row] - Number - optional - - - - -
        -

        The column to which we want to move the widgets.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_player_in

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:862 - -

      - - - - - -
      - -
      -

      Determines if the widget that is being dragged is currently over the row -and col given.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      is_widget

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean | HTMLElement - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:943 - -

      - - - - - -
      - -
      -

      Determines if there is a widget in the cell represented by col/row params.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean | HTMLElement: - - Returns false if there is no widget, -else returns the jQuery HTMLElement - -
      -
      - - - -
      - - -
      -

      is_widget_under_player

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Boolean - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:968 - -

      - - - - - -
      - -
      -

      Determines if there is a widget in the cell represented by col/row -params and if this is under the widget that is being dragged.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to check.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to check.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Boolean: - - Returns true or false. - -
      -
      - - - -
      - - -
      -

      manage_movements

      - - -
      - (
        - -
      • - - $widgets - -
      • - -
      • - - to_col - -
      • - -
      • - - to_row - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:799 - -

      - - - - - -
      - -
      -

      Sorts an Array of grid coords objects (representing the grid coords of -each widget) in descending way.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $widgets - HTMLElements - - - - -
        -

        A jQuery collection of HTMLElements - representing the widgets you want to move.

        -
        - - -
      • - -
      • - - to_col - Number - - - - -
        -

        The column to which we want to move the widgets.

        -
        - - -
      • - -
      • - - to_row - Number - - - - -
        -

        The row to which we want to move the widgets.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      move_widget_down

      - - -
      - (
        - -
      • - - $widget - -
      • - -
      • - - The - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1423 - -

      - - - - - -
      - -
      -

      Move down the specified widget and all below it.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $widget - HTMLElement - - - - -
        -

        The jQuery object representing the widget - you want to move.

        -
        - - -
      • - -
      • - - The - Number - - - - -
        -

        number of cells that the widget has to move.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      move_widget_to

      - - -
      - (
        - -
      • - - $widget - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1331 - -

      - - - - - -
      - -
      -

      Move a widget to a specific row. The cell or cells must be empty. -If the widget has widgets below, all of these widgets will be moved also -if they can.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $widget - HTMLElement - - - - -
        -

        The jQuery wrapped HTMLElement of the -widget is going to be moved.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      move_widget_up

      - - -
      - (
        - -
      • - - $widget - -
      • - -
      • - - [y_units] - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1375 - -

      - - - - - -
      - -
      -

      Move up the specified widget and all below it.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $widget - HTMLElement - - - - -
        -

        The widget you want to move.

        -
        - - -
      • - -
      • - - [y_units] - Number - optional - - - - -
        -

        The number of cells that the widget has to move.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      next_position

      - - -
      - (
        - -
      • - - size_x - -
      • - -
      • - - size_y - -
      • - -
      ) -
      - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:163 - -

      - - - - - -
      - -
      -

      Get the most left column below to add a new widget.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - size_x - Number - - - - -
        -

        The nº of rows the widget occupies horizontally.

        -
        - - -
      • - -
      • - - size_y - Number - - - - -
        -

        The nº of columns the widget occupies vertically.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns a grid coords object representing the future - widget coords. - -
      -
      - - - -
      - - -
      -

      on_drag

      - - -
      - (
        - -
      • - - The - -
      • - -
      • - - A - -
      • - -
      ) -
      - - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:461 - -

      - - - - - -
      - -
      -

      This function is executed when the player is being dragged.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - The - Event - - - - -
        -

        original browser event

        -
        - - -
      • - -
      • - - A - Object - - - - -
        -

        prepared ui object.

        -
        - - -
      • - -
      -
      - - - - - -
      - - -
      -

      on_overlapped_column_change

      - - -
      - (
        - -
      • - - start_callback - -
      • - -
      • - - stop_callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:555 - -

      - - - - - -
      - -
      -

      Executes the callbacks passed as arguments when a column begins to be -overlapped or stops being overlapped.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - start_callback - Function - - - - -
        -

        Function executed when a new column - begins to be overlapped. The column is passed as first argument.

        -
        - - -
      • - -
      • - - stop_callback - Function - - - - -
        -

        Function executed when a column stops - being overlapped. The column is passed as first argument.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      on_overlapped_row_change

      - - -
      - (
        - -
      • - - start_callback - -
      • - -
      • - - stop_callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:595 - -

      - - - - - -
      - -
      -

      Executes the callbacks passed as arguments when a row starts to be -overlapped or stops being overlapped.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - start_callback - Function - - - - -
        -

        Function executed when a new row begins - to be overlapped. The row is passed as first argument.

        -
        - - -
      • - -
      • - - stop_callback - Function - - - - -
        -

        Function executed when a row stops being - overlapped. The row is passed as first argument.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      on_start_drag

      - - -
      - (
        - -
      • - - The - -
      • - -
      • - - A - -
      • - -
      ) -
      - - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:410 - -

      - - - - - -
      - -
      -

      This function is executed when the player begins to be dragged.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - The - Event - - - - -
        -

        original browser event

        -
        - - -
      • - -
      • - - A - Object - - - - -
        -

        prepared ui object.

        -
        - - -
      • - -
      -
      - - - - - -
      - - -
      -

      on_start_overlapping_column

      - - -
      - (
        - -
      • - - col - -
      • - -
      ) -
      - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1269 - -

      - - - - - -
      - -
      -

      This callback is executed when the player begins to collide with a column.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The collided column.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - Returns a jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      on_start_overlapping_row

      - - -
      - (
        - -
      • - - col - -
      • - -
      ) -
      - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1281 - -

      - - - - - -
      - -
      -

      A callback executed when the player begins to collide with a row.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The collided row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - Returns a jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      on_stop_drag

      - - -
      - (
        - -
      • - - The - -
      • - -
      • - - A - -
      • - -
      ) -
      - - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:499 - -

      - - - - - -
      - -
      -

      This function is executed when the player stops being dragged.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - The - Event - - - - -
        -

        original browser event

        -
        - - -
      • - -
      • - - A - Object - - - - -
        -

        prepared ui object.

        -
        - - -
      • - -
      -
      - - - - - -
      - - -
      -

      on_stop_overlapping_column

      - - -
      - (
        - -
      • - - col - -
      • - -
      ) -
      - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1293 - -

      - - - - - -
      - -
      -

      A callback executed when the the player ends to collide with a column.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The collided row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - Returns a jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      on_stop_overlapping_row

      - - -
      - (
        - -
      • - - row - -
      • - -
      ) -
      - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1311 - -

      - - - - - -
      - -
      -

      This callback is executed when the player ends to collide with a row.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - row - Number - - - - -
        -

        The collided row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - Returns a jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      recalculate_faux_grid

      - - - () - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:2089 - -

      - - - - - -
      - -
      -

      Recalculates the offsets for the faux grid. You need to use it when -the browser is resized.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      register_widget

      - - - () - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:272 - -

      - - - - - -
      - -
      -

      Creates the grid coords object representing the widget a add it to the -mapped array of positions.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      remove_from_gridmap

      - - -
      - (
        - -
      • - - grid_data - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:336 - -

      - - - - - -
      - -
      -

      Remove a widget from the mapped array of positions.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - grid_data - Object - - - - -
        -

        The grid coords object representing the cells - to update in the mapped array.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      remove_widget

      - - -
      - (
        - -
      • - - el - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:205 - -

      - - - - - -
      - -
      -

      Remove a widget from the grid.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - el - HTMLElement - - - - -
        -

        The jQuery wrapped HTMLElement you want to remove.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      serialize

      - - -
      - (
        - -
      • - - [$widgets] - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:237 - -

      - - - - - -
      - -
      -

      Returns a serialized array of the widgets in the grid.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - [$widgets] - HTMLElement - optional - - - - -
        -

        The collection of jQuery wrapped - HTMLElements you want to serialize. If no argument is passed all widgets - will be serialized.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns an Array of Objects with the data specified in - the serialize_params option. - -
      -
      - - - -
      - - -
      -

      serialize_changed

      - - - () - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:259 - -

      - - - - - -
      - -
      -

      Returns a serialized array of the widgets that have changed their - position.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns an Array of Objects with the data specified in - the serialize_params option. - -
      -
      - - - -
      - - -
      -

      set_cells_player_occupies

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - col - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1589 - -

      - - - - - -
      - -
      -

      Update the array of mapped positions with the new player position.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The new player col.

        -
        - - -
      • - -
      • - - col - Number - - - - -
        -

        The new player row.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      set_dom_grid_height

      - - - () - - - - - Object - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1947 - -

      - - - - - -
      - -
      -

      Set the current height of the parent grid.

      -
      - - - - -
      -

      Returns:

      - -
      - - - Object: - - Returns the instance of the Gridster class. - -
      -
      - - - -
      - - -
      -

      set_placeholder

      - - -
      - (
        - -
      • - - col - -
      • - -
      • - - row - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1007 - -

      - - - - - -
      - -
      -

      Put placeholder at the row and column specified.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - col - Number - - - - -
        -

        The column to which we want to move the - placeholder.

        -
        - - -
      • - -
      • - - row - Number - - - - -
        -

        The row to which we want to move the - placeholder.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      set_player

      - - -
      - (
        - -
      • - - start_callback - -
      • - -
      • - - stop_callback - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:631 - -

      - - - - - -
      - -
      -

      Sets the current position of the player

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - start_callback - Function - - - - -
        -

        Function executed when a new row begins - to be overlapped. The row is passed as first argument.

        -
        - - -
      • - -
      • - - stop_callback - Function - - - - -
        -

        Function executed when a row stops being - overlapped. The row is passed as first argument.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      sort_by_col_asc

      - - -
      - (
        - -
      • - - widgets - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:760 - -

      - - - - - -
      - -
      -

      Sorts an Array of grid coords objects by column (representing the grid -coords of each widget) in ascending way.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widgets - Array - - - - -
        -

        Array of grid coords objects

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns the array sorted. - -
      -
      - - - -
      - - -
      -

      sort_by_row_and_col_asc

      - - -
      - (
        - -
      • - - widgets - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:740 - -

      - - - - - -
      - -
      -

      Sorts an Array of grid coords objects (representing the grid coords of -each widget) placing first the empty cells upper left.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widgets - Array - - - - -
        -

        Array of grid coords objects

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns the array sorted. - -
      -
      - - - -
      - - -
      -

      sort_by_row_asc

      - - -
      - (
        - -
      • - - widgets - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:720 - -

      - - - - - -
      - -
      -

      Sorts an Array of grid coords objects (representing the grid coords of -each widget) in ascending way.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widgets - Array - - - - -
        -

        Array of grid coords objects

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns the array sorted. - -
      -
      - - - -
      - - -
      -

      sort_by_row_desc

      - - -
      - (
        - -
      • - - widgets - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:780 - -

      - - - - - -
      - -
      -

      Sorts an Array of grid coords objects (representing the grid coords of -each widget) in descending way.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - widgets - Array - - - - -
        -

        Array of grid coords objects

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns the array sorted. - -
      -
      - - - -
      - - -
      -

      update_widget_position

      - - -
      - (
        - -
      • - - grid_data - -
      • - -
      • - - value - -
      • - -
      ) -
      - - - - - Class - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:315 - -

      - - - - - -
      - -
      -

      Update in the mapped array of positions the value of cells represented by -the grid coords object passed in the grid_data param.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - grid_data - Object - - - - -
        -

        The grid coords object representing the cells - to update in the mapped array.

        -
        - - -
      • - -
      • - - value - HTMLElement | Boolean - - - - -
        -

        Pass false or the jQuery wrapped - HTMLElement, depends if you want to delete an existing position or add - a new one.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Class: - - Returns the instance of the Gridster Class. - -
      -
      - - - -
      - - -
      -

      widgets_below

      - - -
      - (
        - -
      • - - $el - -
      • - -
      ) -
      - - - - - HTMLElements - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:1560 - -

      - - - - - -
      - -
      -

      Get widgets below a widget.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $el - HTMLElement - - - - -
        -

        The jQuery wrapped HTMLElement.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - HTMLElements: - - A jQuery collection of HTMLElements. - -
      -
      - - - -
      - - -
      -

      widgets_contraints

      - - -
      - (
        - -
      • - - $widgets - -
      • - -
      ) -
      - - - - - Array - - - - - - - - - - - - - - - -
      - - - -

      - - Defined in - - - - - src/jquery.gridster.js:684 - -

      - - - - - -
      - -
      -

      See which of the widgets in the $widgets param collection can go to -a upper row and which not.

      -
      - - -
      -

      Parameters:

      - -
        - -
      • - - $widgets - HTMLElements - - - - -
        -

        A jQuery wrapped collection of -HTMLElements.

        -
        - - -
      • - -
      -
      - - - -
      -

      Returns:

      - -
      - - - Array: - - Returns a literal Object with two keys: can_go_up & -can_not_go_up. Each contains a set of HTMLElements. - -
      -
      - - - -
      - - -
      - - - - - - - -
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/classes/index.html b/docs/classes/index.html deleted file mode 100644 index 487fe15b2a..0000000000 --- a/docs/classes/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - Redirector - - - - Click here to redirect - - diff --git a/docs/data.json b/docs/data.json deleted file mode 100644 index c83bd743df..0000000000 --- a/docs/data.json +++ /dev/null @@ -1,1665 +0,0 @@ -{ - "project": {}, - "files": { - "src/jquery.collision.js": { - "name": "src/jquery.collision.js", - "modules": {}, - "classes": { - "Collision": 1 - }, - "fors": {}, - "namespaces": {} - }, - "src/jquery.coords.js": { - "name": "src/jquery.coords.js", - "modules": {}, - "classes": { - "Coords": 1 - }, - "fors": {}, - "namespaces": {} - }, - "src/jquery.draggable.js": { - "name": "src/jquery.draggable.js", - "modules": {}, - "classes": { - "Draggable": 1 - }, - "fors": {}, - "namespaces": {} - }, - "src/jquery.gridster.js": { - "name": "src/jquery.gridster.js", - "modules": {}, - "classes": { - "Gridster": 1 - }, - "fors": {}, - "namespaces": {} - } - }, - "modules": {}, - "classes": { - "Collision": { - "name": "Collision", - "shortname": "Collision", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [ - "Gridster" - ], - "file": "src/jquery.collision.js", - "line": 19, - "description": "Detects collisions between a DOM element against other DOM elements or\nCoords objects.", - "uses": [ - "Coords" - ], - "params": [ - { - "name": "el", - "description": "The jQuery wrapped HTMLElement.", - "type": "HTMLElement" - }, - { - "name": "colliders", - "description": "Can be a jQuery collection\n of HTMLElements or an Array of Coords instances.", - "type": "HTMLElement|Array" - }, - { - "name": "options", - "description": "An Object with all options you want to\n overwrite:", - "type": "Object", - "optional": true, - "props": [ - { - "name": "on_overlap_start", - "description": "Executes a function the first\n time each `collider ` is overlapped.", - "type": "Function", - "optional": true - }, - { - "name": "on_overlap_stop", - "description": "Executes a function when a\n `collider` is no longer collided.", - "type": "Function", - "optional": true - }, - { - "name": "on_overlap", - "description": "Executes a function when the\nmouse is moved during the collision.", - "type": "Function", - "optional": true - } - ] - } - ], - "return": { - "description": "Collision instance.", - "type": "Object" - }, - "is_constructor": 1 - }, - "Coords": { - "name": "Coords", - "shortname": "Coords", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [ - "Collision" - ], - "file": "src/jquery.coords.js", - "line": 10, - "description": "Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)\nto simulate DOM elements on the screen.\nCoords is used by Gridster to create a faux grid with any DOM element can\ncollide.", - "params": [ - { - "name": "obj", - "description": "The jQuery HTMLElement or a object with: left,\ntop, width and height properties.", - "type": "HTMLElement|Object" - } - ], - "return": { - "description": "Coords instance.", - "type": "Object" - }, - "is_constructor": 1 - }, - "Draggable": { - "name": "Draggable", - "shortname": "Draggable", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [ - "Gridster" - ], - "file": "src/jquery.draggable.js", - "line": 26, - "description": "Basic drag implementation for DOM elements inside a container.\nProvide start/stop/drag callbacks.", - "params": [ - { - "name": "el", - "description": "The HTMLelement that contains all the widgets\n to be dragged.", - "type": "HTMLElement" - }, - { - "name": "options", - "description": "An Object with all options you want to\n overwrite:", - "type": "Object", - "optional": true, - "props": [ - { - "name": "items", - "description": "Define who will\n be the draggable items. Can be a CSS Selector String or a\n collection of HTMLElements.", - "type": "HTMLElement|String", - "optional": true - }, - { - "name": "distance", - "description": "Distance in pixels after mousedown\n the mouse must move before dragging should start.", - "type": "Number", - "optional": true - }, - { - "name": "limit", - "description": "Constrains dragging to the width of\n the container", - "type": "Boolean", - "optional": true - }, - { - "name": "offset_left", - "description": "Offset added to the item\n that is being dragged.", - "type": "Offset_left", - "optional": true - }, - { - "name": "drag", - "description": "Executes a callback when the mouse is\n moved during the dragging.", - "type": "Number", - "optional": true - }, - { - "name": "start", - "description": "Executes a callback when the drag\n starts.", - "type": "Number", - "optional": true - }, - { - "name": "stop", - "description": "Executes a callback when the drag stops.", - "type": "Number", - "optional": true - } - ] - } - ], - "return": { - "description": "Returns `el`.", - "type": "Object" - }, - "is_constructor": 1 - }, - "Gridster": { - "name": "Gridster", - "shortname": "Gridster", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "file": "src/jquery.gridster.js", - "line": 33, - "uses": [ - "Draggable", - "Collision" - ], - "params": [ - { - "name": "el", - "description": "The HTMLelement that contains all the widgets.", - "type": "HTMLElement" - }, - { - "name": "options", - "description": "An Object with all options you want to\n overwrite:", - "type": "Object", - "optional": true, - "props": [ - { - "name": "widget_selector", - "description": "Define who will\n be the draggable widgets. Can be a CSS Selector String or a\n collection of HTMLElements", - "type": "HTMLElement|String", - "optional": true - }, - { - "name": "widget_margins", - "description": "Margin between widgets.\n The first index for the horizontal margin (left, right) and\n the second for the vertical margin (top, bottom).", - "type": "Array", - "optional": true - }, - { - "name": "widget_base_dimensions", - "description": "Base widget dimensions\n in pixels. The first index for the width and the second for the\n height.", - "type": "Array", - "optional": true - }, - { - "name": "extra_cols", - "description": "Add more columns in addition to\n those that have been calculated.", - "type": "Number", - "optional": true - }, - { - "name": "extra_rows", - "description": "Add more rows in addition to\n those that have been calculated.", - "type": "Number", - "optional": true - }, - { - "name": "min_cols", - "description": "The minimum required columns.", - "type": "Number", - "optional": true - }, - { - "name": "min_rows", - "description": "The minimum required rows.", - "type": "Number", - "optional": true - }, - { - "name": "autogenerate_stylesheet", - "description": "If true, all the\n CSS required to position all widgets in their respective columns\n and rows will be generated automatically and injected to the\n `` of the document. You can set this to false, and write\n your own CSS targeting rows and cols via data-attributes like so:\n `[data-col=\"1\"] { left: 10px; }`", - "type": "Boolean", - "optional": true - }, - { - "name": "avoid_overlapped_widgets", - "description": "Avoid that widgets loaded\n from the DOM can be overlapped. It is helpful if the positions were\n bad stored in the database or if there was any conflict.", - "type": "Boolean", - "optional": true - }, - { - "name": "serialize_params", - "description": "Return the data you want\n for each widget in the serialization. Two arguments are passed:\n `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid\n coords object (`col`, `row`, `size_x`, `size_y`).", - "type": "Function", - "optional": true - }, - { - "name": "collision", - "description": "An Object with all options for\n Collision class you want to overwrite. See Collision docs for\n more info.", - "type": "Object", - "optional": true - }, - { - "name": "draggable", - "description": "An Object with all options for\n Draggable class you want to overwrite. See Draggable docs for more\n info.", - "type": "Object", - "optional": true - } - ] - } - ], - "is_constructor": 1 - } - }, - "classitems": [ - { - "file": "src/jquery.gridster.js", - "line": 108, - "description": "Disable dragging.", - "itemtype": "method", - "name": "enable", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 121, - "description": "Enable dragging.", - "itemtype": "method", - "name": "enable", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 133, - "description": "Add a new widget to the grid.", - "itemtype": "method", - "name": "add_widget", - "params": [ - { - "name": "html", - "description": "The string representing the HTML of the widget.", - "type": "String" - }, - { - "name": "size_x", - "description": "The nº of rows the widget occupies horizontally.", - "type": "Number" - }, - { - "name": "size_y", - "description": "The nº of columns the widget occupies vertically.", - "type": "Number" - } - ], - "return": { - "description": "Returns the jQuery wrapped HTMLElement representing.\n the widget that was just created.", - "type": "HTMLElement" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 163, - "description": "Get the most left column below to add a new widget.", - "itemtype": "method", - "name": "next_position", - "params": [ - { - "name": "size_x", - "description": "The nº of rows the widget occupies horizontally.", - "type": "Number" - }, - { - "name": "size_y", - "description": "The nº of columns the widget occupies vertically.", - "type": "Number" - } - ], - "return": { - "description": "Returns a grid coords object representing the future\n widget coords.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 205, - "description": "Remove a widget from the grid.", - "itemtype": "method", - "name": "remove_widget", - "params": [ - { - "name": "el", - "description": "The jQuery wrapped HTMLElement you want to remove.", - "type": "HTMLElement" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 237, - "description": "Returns a serialized array of the widgets in the grid.", - "itemtype": "method", - "name": "serialize", - "params": [ - { - "name": "$widgets", - "description": "The collection of jQuery wrapped\n HTMLElements you want to serialize. If no argument is passed all widgets\n will be serialized.", - "type": "HTMLElement", - "optional": true - } - ], - "return": { - "description": "Returns an Array of Objects with the data specified in\n the serialize_params option.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 259, - "description": "Returns a serialized array of the widgets that have changed their\n position.", - "itemtype": "method", - "name": "serialize_changed", - "return": { - "description": "Returns an Array of Objects with the data specified in\n the serialize_params option.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 272, - "description": "Creates the grid coords object representing the widget a add it to the\nmapped array of positions.", - "itemtype": "method", - "name": "register_widget", - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 315, - "description": "Update in the mapped array of positions the value of cells represented by\nthe grid coords object passed in the `grid_data` param.", - "params": [ - { - "name": "grid_data", - "description": "The grid coords object representing the cells\n to update in the mapped array.", - "type": "Object" - }, - { - "name": "value", - "description": "Pass `false` or the jQuery wrapped\n HTMLElement, depends if you want to delete an existing position or add\n a new one.", - "type": "HTMLElement|Boolean" - } - ], - "itemtype": "method", - "name": "update_widget_position", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 336, - "description": "Remove a widget from the mapped array of positions.", - "itemtype": "method", - "name": "remove_from_gridmap", - "params": [ - { - "name": "grid_data", - "description": "The grid coords object representing the cells\n to update in the mapped array.", - "type": "Object" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 349, - "description": "Add a widget to the mapped array of positions.", - "itemtype": "method", - "name": "add_to_gridmap", - "params": [ - { - "name": "grid_data", - "description": "The grid coords object representing the cells\n to update in the mapped array.", - "type": "Object" - }, - { - "name": "value", - "description": "The value to set in the specified\n position .", - "type": "HTMLElement|Boolean" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 371, - "description": "Make widgets draggable.", - "uses": [ - "Draggable" - ], - "itemtype": "method", - "name": "draggable", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 410, - "description": "This function is executed when the player begins to be dragged.", - "itemtype": "method", - "name": "on_start_drag", - "params": [ - { - "name": "The", - "description": "original browser event", - "type": "Event" - }, - { - "name": "A", - "description": "prepared ui object.", - "type": "Object" - } - ], - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 461, - "description": "This function is executed when the player is being dragged.", - "itemtype": "method", - "name": "on_drag", - "params": [ - { - "name": "The", - "description": "original browser event", - "type": "Event" - }, - { - "name": "A", - "description": "prepared ui object.", - "type": "Object" - } - ], - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 499, - "description": "This function is executed when the player stops being dragged.", - "itemtype": "method", - "name": "on_stop_drag", - "params": [ - { - "name": "The", - "description": "original browser event", - "type": "Event" - }, - { - "name": "A", - "description": "prepared ui object.", - "type": "Object" - } - ], - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 555, - "description": "Executes the callbacks passed as arguments when a column begins to be\noverlapped or stops being overlapped.", - "params": [ - { - "name": "start_callback", - "description": "Function executed when a new column\n begins to be overlapped. The column is passed as first argument.", - "type": "Function" - }, - { - "name": "stop_callback", - "description": "Function executed when a column stops\n being overlapped. The column is passed as first argument.", - "type": "Function" - } - ], - "itemtype": "method", - "name": "on_overlapped_column_change", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 595, - "description": "Executes the callbacks passed as arguments when a row starts to be\noverlapped or stops being overlapped.", - "params": [ - { - "name": "start_callback", - "description": "Function executed when a new row begins\n to be overlapped. The row is passed as first argument.", - "type": "Function" - }, - { - "name": "stop_callback", - "description": "Function executed when a row stops being\n overlapped. The row is passed as first argument.", - "type": "Function" - } - ], - "itemtype": "method", - "name": "on_overlapped_row_change", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 631, - "description": "Sets the current position of the player", - "params": [ - { - "name": "start_callback", - "description": "Function executed when a new row begins\n to be overlapped. The row is passed as first argument.", - "type": "Function" - }, - { - "name": "stop_callback", - "description": "Function executed when a row stops being\n overlapped. The row is passed as first argument.", - "type": "Function" - } - ], - "itemtype": "method", - "name": "set_player", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 684, - "description": "See which of the widgets in the $widgets param collection can go to\na upper row and which not.", - "itemtype": "method", - "name": "widgets_contraints", - "params": [ - { - "name": "$widgets", - "description": "A jQuery wrapped collection of\nHTMLElements.", - "type": "HTMLElements" - } - ], - "return": { - "description": "Returns a literal Object with two keys: `can_go_up` &\n`can_not_go_up`. Each contains a set of HTMLElements.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 720, - "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in ascending way.", - "itemtype": "method", - "name": "sort_by_row_asc", - "params": [ - { - "name": "widgets", - "description": "Array of grid coords objects", - "type": "Array" - } - ], - "return": { - "description": "Returns the array sorted.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 740, - "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) placing first the empty cells upper left.", - "itemtype": "method", - "name": "sort_by_row_and_col_asc", - "params": [ - { - "name": "widgets", - "description": "Array of grid coords objects", - "type": "Array" - } - ], - "return": { - "description": "Returns the array sorted.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 760, - "description": "Sorts an Array of grid coords objects by column (representing the grid\ncoords of each widget) in ascending way.", - "itemtype": "method", - "name": "sort_by_col_asc", - "params": [ - { - "name": "widgets", - "description": "Array of grid coords objects", - "type": "Array" - } - ], - "return": { - "description": "Returns the array sorted.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 780, - "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", - "itemtype": "method", - "name": "sort_by_row_desc", - "params": [ - { - "name": "widgets", - "description": "Array of grid coords objects", - "type": "Array" - } - ], - "return": { - "description": "Returns the array sorted.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 799, - "description": "Sorts an Array of grid coords objects (representing the grid coords of\neach widget) in descending way.", - "itemtype": "method", - "name": "manage_movements", - "params": [ - { - "name": "$widgets", - "description": "A jQuery collection of HTMLElements\n representing the widgets you want to move.", - "type": "HTMLElements" - }, - { - "name": "to_col", - "description": "The column to which we want to move the widgets.", - "type": "Number" - }, - { - "name": "to_row", - "description": "The row to which we want to move the widgets.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 845, - "description": "Determines if there is a widget in the row and col given. Or if the\nHTMLElement passed as first argument is the player.", - "itemtype": "method", - "name": "is_player", - "params": [ - { - "name": "col_or_el", - "description": "A jQuery wrapped collection of\nHTMLElements.", - "type": "Number|HTMLElement" - }, - { - "name": "row", - "description": "The column to which we want to move the widgets.", - "type": "Number", - "optional": true - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 862, - "description": "Determines if the widget that is being dragged is currently over the row\nand col given.", - "itemtype": "method", - "name": "is_player_in", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 877, - "description": "Determines if the placeholder is currently over the row and col given.", - "itemtype": "method", - "name": "is_placeholder_in", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 891, - "description": "Determines if the placeholder is currently over the column given.", - "itemtype": "method", - "name": "is_placeholder_in_col", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 904, - "description": "Determines if the cell represented by col and row params is empty.", - "itemtype": "method", - "name": "is_empty", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 923, - "description": "Determines if the cell represented by col and row params is occupied.", - "itemtype": "method", - "name": "is_occupied", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 943, - "description": "Determines if there is a widget in the cell represented by col/row params.", - "itemtype": "method", - "name": "is_widget", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns false if there is no widget,\nelse returns the jQuery HTMLElement", - "type": "Boolean|HTMLElement" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 968, - "description": "Determines if there is a widget in the cell represented by col/row\nparams and if this is under the widget that is being dragged.", - "itemtype": "method", - "name": "is_widget_under_player", - "params": [ - { - "name": "col", - "description": "The column to check.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to check.", - "type": "Number" - } - ], - "return": { - "description": "Returns true or false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 985, - "description": "Get widgets overlapping with the player.", - "itemtype": "method", - "name": "get_widgets_under_player", - "return": { - "description": "Returns a jQuery collection of HTMLElements", - "type": "HTMLElement" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1007, - "description": "Put placeholder at the row and column specified.", - "itemtype": "method", - "name": "set_placeholder", - "params": [ - { - "name": "col", - "description": "The column to which we want to move the\n placeholder.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to which we want to move the\n placeholder.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1056, - "description": "Determines whether the player can move to a position above.", - "itemtype": "method", - "name": "can_go_player_up", - "params": [ - { - "name": "widget_grid_data", - "description": "The actual grid coords object of the\n player.", - "type": "Object" - } - ], - "return": { - "description": "If the player can be moved to an upper row\n returns the row number, else returns false.", - "type": "Number|Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1105, - "description": "Determines whether a widget can move to a position above.", - "itemtype": "method", - "name": "can_go_widget_up", - "params": [ - { - "name": "widget_grid_data", - "description": "The actual grid coords object of the\n widget we want to check.", - "type": "Object" - } - ], - "return": { - "description": "If the widget can be moved to an upper row\n returns the row number, else returns false.", - "type": "Number|Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1158, - "description": "Search a valid row for the widget represented by `widget_grid_data' in\nthe `upper_rows` array. Iteration starts from row specified in `min_row`.", - "itemtype": "method", - "name": "get_valid_rows", - "params": [ - { - "name": "widget_grid_data", - "description": "The actual grid coords object of the\n player.", - "type": "Object" - }, - { - "name": "upper_rows", - "description": "An array with columns as index and arrays\n of valid rows as values.", - "type": "Array" - }, - { - "name": "min_row", - "description": "The upper row from which the iteration will start.", - "type": "Number" - } - ], - "return": { - "description": "Returns the upper row valid from the `upper_rows`\n for the widget in question.", - "type": "Number|Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1236, - "description": "Get widgets overlapping with the player.", - "itemtype": "method", - "name": "get_widgets_overlapped", - "return": { - "description": "Returns a jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1269, - "description": "This callback is executed when the player begins to collide with a column.", - "itemtype": "method", - "name": "on_start_overlapping_column", - "params": [ - { - "name": "col", - "description": "The collided column.", - "type": "Number" - } - ], - "return": { - "description": "Returns a jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1281, - "description": "A callback executed when the player begins to collide with a row.", - "itemtype": "method", - "name": "on_start_overlapping_row", - "params": [ - { - "name": "col", - "description": "The collided row.", - "type": "Number" - } - ], - "return": { - "description": "Returns a jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1293, - "description": "A callback executed when the the player ends to collide with a column.", - "itemtype": "method", - "name": "on_stop_overlapping_column", - "params": [ - { - "name": "col", - "description": "The collided row.", - "type": "Number" - } - ], - "return": { - "description": "Returns a jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1311, - "description": "This callback is executed when the player ends to collide with a row.", - "itemtype": "method", - "name": "on_stop_overlapping_row", - "params": [ - { - "name": "row", - "description": "The collided row.", - "type": "Number" - } - ], - "return": { - "description": "Returns a jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1331, - "description": "Move a widget to a specific row. The cell or cells must be empty.\nIf the widget has widgets below, all of these widgets will be moved also\nif they can.", - "itemtype": "method", - "name": "move_widget_to", - "params": [ - { - "name": "$widget", - "description": "The jQuery wrapped HTMLElement of the\nwidget is going to be moved.", - "type": "HTMLElement" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1375, - "description": "Move up the specified widget and all below it.", - "itemtype": "method", - "name": "move_widget_up", - "params": [ - { - "name": "$widget", - "description": "The widget you want to move.", - "type": "HTMLElement" - }, - { - "name": "y_units", - "description": "The number of cells that the widget has to move.", - "type": "Number", - "optional": true - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1423, - "description": "Move down the specified widget and all below it.", - "itemtype": "method", - "name": "move_widget_down", - "params": [ - { - "name": "$widget", - "description": "The jQuery object representing the widget\n you want to move.", - "type": "HTMLElement" - }, - { - "name": "The", - "description": "number of cells that the widget has to move.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1469, - "description": "Check if the widget can move to the specified row, else returns the\nupper row possible.", - "itemtype": "method", - "name": "can_go_up_to_row", - "params": [ - { - "name": "widget_grid_data", - "description": "The current grid coords object of the\n widget.", - "type": "Number" - }, - { - "name": "col", - "description": "The target column.", - "type": "Number" - }, - { - "name": "row", - "description": "The target row.", - "type": "Number" - } - ], - "return": { - "description": "Returns the row number if the widget can move\n to the target position, else returns false.", - "type": "Boolean|Number" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1560, - "description": "Get widgets below a widget.", - "itemtype": "method", - "name": "widgets_below", - "params": [ - { - "name": "$el", - "description": "The jQuery wrapped HTMLElement.", - "type": "HTMLElement" - } - ], - "return": { - "description": "A jQuery collection of HTMLElements.", - "type": "HTMLElements" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1589, - "description": "Update the array of mapped positions with the new player position.", - "itemtype": "method", - "name": "set_cells_player_occupies", - "params": [ - { - "name": "col", - "description": "The new player col.", - "type": "Number" - }, - { - "name": "col", - "description": "The new player row.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1606, - "description": "Remove from the array of mapped positions the reference to the player.", - "itemtype": "method", - "name": "empty_cells_player_occupies", - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1644, - "description": "Check if it's possible to move a widget to a specific col/row. It takes\ninto account the dimensions (`size_y` and `size_x` attrs. of the grid\n coords object) the widget occupies.", - "itemtype": "method", - "name": "can_move_to", - "params": [ - { - "name": "widget_grid_data", - "description": "The grid coords object that represents\n the widget.", - "type": "Object" - }, - { - "name": "The", - "description": "col target col.", - "type": "Object" - }, - { - "name": "The", - "description": "row target row.", - "type": "Object" - } - ], - "return": { - "description": "Returns true if all cells are empty, else return false.", - "type": "Boolean" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1684, - "description": "Given the leftmost column returns all columns that are overlapping\n with the player.", - "itemtype": "method", - "name": "get_targeted_columns", - "params": [ - { - "name": "from_col", - "description": "The leftmost column.", - "type": "Number", - "optional": true - } - ], - "return": { - "description": "Returns an array with column numbers.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1703, - "description": "Given the upper row returns all rows that are overlapping with the player.", - "itemtype": "method", - "name": "get_targeted_rows", - "params": [ - { - "name": "from_row", - "description": "The upper row.", - "type": "Number", - "optional": true - } - ], - "return": { - "description": "Returns an array with row numbers.", - "type": "Array" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1720, - "description": "Get all columns and rows that a widget occupies.", - "itemtype": "method", - "name": "get_cells_occupied", - "params": [ - { - "name": "el_grid_data", - "description": "The grid coords object of the widget.", - "type": "Object" - } - ], - "return": { - "description": "Returns an object like `{ cols: [], rows: []}`.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1748, - "description": "Iterate over the cells occupied by a widget executing a function for\neach one.", - "itemtype": "method", - "name": "for_each_cell_occupied", - "params": [ - { - "name": "el_grid_data", - "description": "The grid coords object that represents the\n widget.", - "type": "Object" - }, - { - "name": "callback", - "description": "The function to execute on each column\n iteration. Column and row are passed as arguments.", - "type": "Function" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1769, - "description": "Iterate over the columns occupied by a widget executing a function for\neach one.", - "itemtype": "method", - "name": "for_each_column_occupied", - "params": [ - { - "name": "el_grid_data", - "description": "The grid coords object that represents\n the widget.", - "type": "Object" - }, - { - "name": "callback", - "description": "The function to execute on each column\n iteration. The column number is passed as first argument.", - "type": "Function" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1788, - "description": "Iterate over the rows occupied by a widget executing a function for\neach one.", - "itemtype": "method", - "name": "for_each_row_occupied", - "params": [ - { - "name": "el_grid_data", - "description": "The grid coords object that represents\n the widget.", - "type": "Object" - }, - { - "name": "callback", - "description": "The function to execute on each column\n iteration. The row number is passed as first argument.", - "type": "Function" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1855, - "description": "Iterate over each widget above the column and row specified.", - "itemtype": "method", - "name": "for_each_widget_above", - "params": [ - { - "name": "col", - "description": "The column to start iterating.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to start iterating.", - "type": "Number" - }, - { - "name": "callback", - "description": "The function to execute on each widget\n iteration. The value of `this` inside the function is the jQuery\n wrapped HTMLElement.", - "type": "Function" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1872, - "description": "Iterate over each widget below the column and row specified.", - "itemtype": "method", - "name": "for_each_widget_below", - "params": [ - { - "name": "col", - "description": "The column to start iterating.", - "type": "Number" - }, - { - "name": "row", - "description": "The row to start iterating.", - "type": "Number" - }, - { - "name": "callback", - "description": "The function to execute on each widget\n iteration. The value of `this` inside the function is the jQuery wrapped\n HTMLElement.", - "type": "Function" - } - ], - "return": { - "description": "Returns the instance of the Gridster Class.", - "type": "Class" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1889, - "description": "Returns the highest occupied cell in the grid.", - "itemtype": "method", - "name": "get_highest_occupied_cell", - "return": { - "description": "Returns an object with `col` and `row` numbers.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1947, - "description": "Set the current height of the parent grid.", - "itemtype": "method", - "name": "set_dom_grid_height", - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 1960, - "description": "It generates the neccessary styles to position the widgets.", - "itemtype": "method", - "name": "generate_stylesheet", - "params": [ - { - "name": "rows", - "description": "Number of columns.", - "type": "Number" - }, - { - "name": "cols", - "description": "Number of rows.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 2030, - "description": "Injects the given CSS as string to the head of the document.", - "itemtype": "method", - "name": "add_style_tag", - "params": [ - { - "name": "css", - "description": "The styles to apply.", - "type": "String" - } - ], - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 2053, - "description": "Generates a faux grid to collide with it when a widget is dragged and\ndetect row or column that we want to go.", - "itemtype": "method", - "name": "generate_faux_grid", - "params": [ - { - "name": "rows", - "description": "Number of columns.", - "type": "Number" - }, - { - "name": "cols", - "description": "Number of rows.", - "type": "Number" - } - ], - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 2089, - "description": "Recalculates the offsets for the faux grid. You need to use it when\nthe browser is resized.", - "itemtype": "method", - "name": "recalculate_faux_grid", - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 2113, - "description": "Get all widgets in the DOM and register them.", - "itemtype": "method", - "name": "get_widgets_from_DOM", - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - }, - { - "file": "src/jquery.gridster.js", - "line": 2127, - "description": "Calculate columns and rows to be set based on the configuration\n parameters, grid dimensions, etc ...", - "itemtype": "method", - "name": "generate_grid_and_stylesheet", - "return": { - "description": "Returns the instance of the Gridster class.", - "type": "Object" - }, - "class": "Gridster" - } - ] -} \ No newline at end of file diff --git a/docs/files/index.html b/docs/files/index.html deleted file mode 100644 index 487fe15b2a..0000000000 --- a/docs/files/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - Redirector - - - - Click here to redirect - - diff --git a/docs/files/src_jquery.collision.js.html b/docs/files/src_jquery.collision.js.html deleted file mode 100644 index c15c3c627c..0000000000 --- a/docs/files/src_jquery.collision.js.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - src/jquery.collision.js - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      File: src/jquery.collision.js

      - -
      -
      -/*
      - * jquery.collision
      - * https://github.com/ducksboard/gridster.js
      - *
      - * Copyright (c) 2012 ducksboard
      - * Licensed under the MIT, GPL licenses.
      - */
      -
      -;(function($, window, document, undefined){
      -
      -    var defaults = {
      -        colliders_context: document.body
      -        // ,on_overlap: function(collider_data){},
      -        // on_overlap_start : function(collider_data){},
      -        // on_overlap_stop : function(collider_data){}
      -    };
      -
      -
      -    /**
      -    * Detects collisions between a DOM element against other DOM elements or
      -    * Coords objects.
      -    *
      -    * @class Collision
      -    * @uses Coords
      -    * @param {HTMLElement} el The jQuery wrapped HTMLElement.
      -    * @param {HTMLElement|Array} colliders Can be a jQuery collection
      -    *  of HTMLElements or an Array of Coords instances.
      -    * @param {Object} [options] An Object with all options you want to
      -    *        overwrite:
      -    *   @param {Function} [options.on_overlap_start] Executes a function the first
      -    *    time each `collider ` is overlapped.
      -    *   @param {Function} [options.on_overlap_stop] Executes a function when a
      -    *    `collider` is no longer collided.
      -    *   @param {Function} [options.on_overlap] Executes a function when the
      -    * mouse is moved during the collision.
      -    * @return {Object} Collision instance.
      -    * @constructor
      -    */
      -    function Collision(el, colliders, options) {
      -        this.options = $.extend(defaults, options);
      -        this.$element = el;
      -        this.last_colliders = [];
      -        this.last_colliders_coords = [];
      -        if (typeof colliders === 'string' || colliders instanceof jQuery) {
      -            this.$colliders = $(colliders,
      -                 this.options.colliders_context).not(this.$element);
      -        }else{
      -            this.colliders = $(colliders);
      -        }
      -
      -        this.init();
      -    }
      -
      -
      -    var fn = Collision.prototype;
      -
      -
      -    fn.init = function() {
      -        this.find_collisions();
      -    };
      -
      -
      -    fn.overlaps = function(a, b) {
      -        var x = false;
      -        var y = false;
      -
      -        if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
      -            (b.x2 >= a.x1 && b.x2 <= a.x2) ||
      -            (a.x1 >= b.x1 && a.x2 <= b.x2)
      -        ) { x = true; }
      -
      -        if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
      -            (b.y2 >= a.y1 && b.y2 <= a.y2) ||
      -            (a.y1 >= b.y1 && a.y2 <= b.y2)
      -        ) { y = true; }
      -
      -        return (x && y);
      -    };
      -
      -
      -    fn.detect_overlapping_region = function(a, b){
      -        var regionX = '';
      -        var regionY = '';
      -
      -        if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
      -        if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
      -        if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
      -        if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
      -
      -        return (regionX + regionY) || 'C';
      -    };
      -
      -
      -    fn.calculate_overlapped_area_coords = function(a, b){
      -        var x1 = Math.max(a.x1, b.x1);
      -        var y1 = Math.max(a.y1, b.y1);
      -        var x2 = Math.min(a.x2, b.x2);
      -        var y2 = Math.min(a.y2, b.y2);
      -
      -        return $({
      -            left: x1,
      -            top: y1,
      -             width : (x2 - x1),
      -            height: (y2 - y1)
      -          }).coords().get();
      -    };
      -
      -
      -    fn.calculate_overlapped_area = function(coords){
      -        return (coords.width * coords.height);
      -    };
      -
      -
      -    fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
      -        var last = this.last_colliders_coords;
      -
      -        for (var i = 0, il = last.length; i < il; i++) {
      -            if ($.inArray(last[i], new_colliders_coords) === -1) {
      -                start_callback.call(this, last[i]);
      -            }
      -        }
      -
      -        for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
      -            if ($.inArray(new_colliders_coords[j], last) === -1) {
      -                stop_callback.call(this, new_colliders_coords[j]);
      -            }
      -
      -        }
      -    };
      -
      -
      -    fn.find_collisions = function(player_data_coords){
      -        var self = this;
      -        var colliders_coords = [];
      -        var colliders_data = [];
      -        var $colliders = (this.colliders || this.$colliders);
      -        var count = $colliders.length;
      -        var player_coords = self.$element.coords()
      -                             .update(player_data_coords || false).get();
      -
      -        while(count--){
      -          var $collider = self.$colliders ?
      -                           $($colliders[count]) : $colliders[count];
      -          var $collider_coords_ins = ($collider.isCoords) ?
      -                  $collider : $collider.coords();
      -          var collider_coords = $collider_coords_ins.get();
      -          var overlaps = self.overlaps(player_coords, collider_coords);
      -
      -          if (!overlaps) {
      -            continue;
      -          }
      -
      -          var region = self.detect_overlapping_region(
      -              player_coords, collider_coords);
      -
      -            //todo: make this an option
      -            if (region === 'C'){
      -                var area_coords = self.calculate_overlapped_area_coords(
      -                    player_coords, collider_coords);
      -                var area = self.calculate_overlapped_area(area_coords);
      -                var collider_data = {
      -                    area: area,
      -                    area_coords : area_coords,
      -                    region: region,
      -                    coords: collider_coords,
      -                    player_coords: player_coords,
      -                    el: $collider
      -                };
      -
      -                if (self.options.on_overlap) {
      -                    self.options.on_overlap.call(this, collider_data);
      -                }
      -                colliders_coords.push($collider_coords_ins);
      -                colliders_data.push(collider_data);
      -            }
      -        }
      -
      -        if (self.options.on_overlap_stop || self.options.on_overlap_start) {
      -            this.manage_colliders_start_stop(colliders_coords,
      -                self.options.on_overlap_stop, self.options.on_overlap_start);
      -        }
      -
      -        this.last_colliders_coords = colliders_coords;
      -
      -        return colliders_data;
      -    };
      -
      -
      -    fn.get_closest_colliders = function(player_data_coords){
      -        var colliders = this.find_collisions(player_data_coords);
      -        var min_area = 100;
      -        colliders.sort(function(a, b){
      -            if (a.area <= min_area) {
      -              return 1;
      -            }
      -
      -            /* if colliders are being overlapped by the "C" (center) region,
      -             * we have to set a lower index in the array to which they are placed
      -             * above in the grid. */
      -            if (a.region === 'C' && b.region === 'C') {
      -                if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
      -                    return - 1;
      -                }else{
      -                    return 1;
      -                }
      -            }
      -
      -            if (a.area < b.area){
      -                return 1;
      -            }
      -
      -            return 1;
      -        });
      -        return colliders;
      -    };
      -
      -
      -    //jQuery adapter
      -    $.fn.collision = function(collider, options) {
      -          return new Collision( this, collider, options );
      -    };
      -
      -
      -}(jQuery, window, document));
      -
      -    
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/files/src_jquery.coords.js.html b/docs/files/src_jquery.coords.js.html deleted file mode 100644 index d9957d937e..0000000000 --- a/docs/files/src_jquery.coords.js.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - src/jquery.coords.js - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      File: src/jquery.coords.js

      - -
      -
      -/*
      - * jquery.coords
      - * https://github.com/ducksboard/gridster.js
      - *
      - * Copyright (c) 2012 ducksboard
      - * Licensed under the MIT, GPL licenses.
      - */
      -
      -;(function($, window, document, undefined){
      -    /**
      -    * Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
      -    * to simulate DOM elements on the screen.
      -    * Coords is used by Gridster to create a faux grid with any DOM element can
      -    * collide.
      -    *
      -    * @class Coords
      -    * @param {HTMLElement|Object} obj The jQuery HTMLElement or a object with: left,
      -    * top, width and height properties.
      -    * @return {Object} Coords instance.
      -    * @constructor
      -    */
      -    function Coords(obj) {
      -        if (obj[0] && $.isPlainObject(obj[0])) {
      -            this.data = obj[0];
      -        }else {
      -            this.el = obj;
      -        }
      -
      -        this.isCoords = true;
      -        this.coords = {};
      -        this.init();
      -        return this;
      -    }
      -
      -
      -    var fn = Coords.prototype;
      -
      -
      -    fn.init = function(){
      -        this.set();
      -        this.original_coords = this.get();
      -    };
      -
      -
      -    fn.set = function(update, not_update_offsets) {
      -        var el = this.el;
      -
      -        if (el && !update) {
      -            this.data = el.offset();
      -            this.data.width = el.width();
      -            this.data.height = el.height();
      -        }
      -
      -        if (el && update && !not_update_offsets) {
      -            var offset = el.offset();
      -            this.data.top = offset.top;
      -            this.data.left = offset.left;
      -        }
      -
      -        var d = this.data;
      -
      -        this.coords.x1 = d.left;
      -        this.coords.y1 = d.top;
      -        this.coords.x2 = d.left + d.width;
      -        this.coords.y2 = d.top + d.height;
      -        this.coords.cx = d.left + (d.width / 2);
      -        this.coords.cy = d.top + (d.height / 2);
      -        this.coords.width  = d.width;
      -        this.coords.height = d.height;
      -        this.coords.el  = el || false ;
      -
      -        return this;
      -    };
      -
      -
      -    fn.update = function(data){
      -        if (!data && !this.el) {
      -            return this;
      -        }
      -
      -        if (data) {
      -            var new_data = $.extend({}, this.data, data);
      -            this.data = new_data;
      -            return this.set(true, true);
      -        }
      -
      -        this.set(true);
      -        return this;
      -    };
      -
      -
      -    fn.get = function(){
      -        return this.coords;
      -    };
      -
      -
      -    //jQuery adapter
      -    $.fn.coords = function() {
      -        if (this.data('coords') ) {
      -            return this.data('coords');
      -        }
      -
      -        var ins = new Coords(this, arguments[0]);
      -        this.data('coords', ins);
      -        return ins;
      -    };
      -
      -}(jQuery, window, document));
      -
      -    
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/files/src_jquery.draggable.js.html b/docs/files/src_jquery.draggable.js.html deleted file mode 100644 index 6eb57e1118..0000000000 --- a/docs/files/src_jquery.draggable.js.html +++ /dev/null @@ -1,429 +0,0 @@ - - - - - src/jquery.draggable.js - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      File: src/jquery.draggable.js

      - -
      -
      -/*
      - * jquery.draggable
      - * https://github.com/ducksboard/gridster.js
      - *
      - * Copyright (c) 2012 ducksboard
      - * Licensed under the MIT, GPL licenses.
      - */
      -
      -;(function($, window, document, undefined){
      -
      -    var defaults = {
      -        items: '.gs_w',
      -        distance: 1,
      -        limit: true,
      -        offset_left: 0,
      -        autoscroll: true
      -        // ,drag: function(e){},
      -        // start : function(e, ui){},
      -        // stop : function(e){}
      -    };
      -
      -    var $body = $(document.body);
      -    var $window = $(window);
      -
      -
      -    /**
      -    * Basic drag implementation for DOM elements inside a container.
      -    * Provide start/stop/drag callbacks.
      -    *
      -    * @class Draggable
      -    * @param {HTMLElement} el The HTMLelement that contains all the widgets
      -    *  to be dragged.
      -    * @param {Object} [options] An Object with all options you want to
      -    *        overwrite:
      -    *    @param {HTMLElement|String} [options.items] Define who will
      -    *     be the draggable items. Can be a CSS Selector String or a
      -    *     collection of HTMLElements.
      -    *    @param {Number} [options.distance] Distance in pixels after mousedown
      -    *     the mouse must move before dragging should start.
      -    *    @param {Boolean} [options.limit] Constrains dragging to the width of
      -    *     the container
      -    *    @param {offset_left} [options.offset_left] Offset added to the item
      -    *     that is being dragged.
      -    *    @param {Number} [options.drag] Executes a callback when the mouse is
      -    *     moved during the dragging.
      -    *    @param {Number} [options.start] Executes a callback when the drag
      -    *     starts.
      -    *    @param {Number} [options.stop] Executes a callback when the drag stops.
      -    * @return {Object} Returns `el`.
      -    * @constructor
      -    */
      -    function Draggable(el, options) {
      -      this.options = $.extend({}, defaults, options);
      -      this.$container = $(el);
      -      this.$dragitems = $(this.options.items, this.$container);
      -      this.is_dragging = false;
      -      this.player_min_left = 0 + this.options.offset_left;
      -      this.init();
      -    }
      -
      -    var fn = Draggable.prototype;
      -
      -    fn.init = function() {
      -        this.calculate_positions();
      -        this.$container.css('position', 'relative');
      -        this.enable();
      -
      -        $(window).bind('resize',
      -            throttle($.proxy(this.calculate_positions, this), 200));
      -    };
      -
      -
      -    fn.get_actual_pos = function($el) {
      -        var pos = $el.position();
      -        return pos;
      -    };
      -
      -
      -    fn.get_mouse_pos = function(e) {
      -        return {
      -            left: e.clientX,
      -            top: e.clientY
      -        };
      -    };
      -
      -
      -    fn.get_offset = function(e) {
      -        e.preventDefault();
      -        var mouse_actual_pos = this.get_mouse_pos(e);
      -        var diff_x = Math.round(
      -            mouse_actual_pos.left - this.mouse_init_pos.left);
      -        var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);
      -
      -        var left = Math.round(this.el_init_offset.left + diff_x - this.baseX);
      -        var top = Math.round(
      -            this.el_init_offset.top + diff_y - this.baseY + this.scrollOffset);
      -
      -        if (this.options.limit) {
      -            if (left > this.player_max_left) {
      -                left = this.player_max_left;
      -            }else if(left < this.player_min_left) {
      -                left = this.player_min_left;
      -            }
      -        }
      -
      -        return {
      -            left: left,
      -            top: top,
      -            mouse_left: mouse_actual_pos.left,
      -            mouse_top: mouse_actual_pos.top
      -        };
      -    };
      -
      -
      -    fn.manage_scroll = function(offset) {
      -        /* scroll document */
      -        var nextScrollTop;
      -        var scrollTop = $window.scrollTop();
      -        var min_window_y = scrollTop;
      -        var max_window_y = min_window_y + this.window_height;
      -
      -        var mouse_down_zone = max_window_y - 30;
      -        var mouse_up_zone = min_window_y + 20;
      -
      -        var abs_mouse_left = offset.mouse_left;
      -        var abs_mouse_top = min_window_y + offset.mouse_top;
      -
      -        var max_player_y = (this.doc_height - this.window_height +
      -            this.player_height);
      -
      -        if (abs_mouse_top >= mouse_down_zone) {
      -            nextScrollTop = scrollTop + 10;
      -            if (nextScrollTop < max_player_y) {
      -                $window.scrollTop(nextScrollTop);
      -                this.scrollOffset = this.scrollOffset + 10;
      -            }
      -        };
      -
      -        if (abs_mouse_top <= mouse_up_zone) {
      -            nextScrollTop = scrollTop - 10;
      -            if (nextScrollTop > 0) {
      -                $window.scrollTop(nextScrollTop);
      -                this.scrollOffset = this.scrollOffset - 10;
      -            }
      -        };
      -    }
      -
      -
      -    fn.calculate_positions = function(e) {
      -        this.window_height = $window.height();
      -    }
      -
      -
      -    fn.drag_handler = function(e) {
      -        if (e.which !== 1) {
      -            return false;
      -        }
      -
      -        var self = this;
      -        var first = true;
      -        this.$player = $(e.currentTarget);
      -
      -        this.el_init_pos = this.get_actual_pos(this.$player);
      -        this.mouse_init_pos = this.get_mouse_pos(e);
      -        this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
      -
      -        $body.on('mousemove.draggable', function(mme){
      -
      -            var mouse_actual_pos = self.get_mouse_pos(mme);
      -            var diff_x = Math.abs(
      -                mouse_actual_pos.left - self.mouse_init_pos.left);
      -            var diff_y = Math.abs(
      -                mouse_actual_pos.top - self.mouse_init_pos.top);
      -            if (!(diff_x > self.options.distance ||
      -                diff_y > self.options.distance)
      -            ) {
      -                return false;
      -            }
      -
      -            if (first) {
      -                first = false;
      -                self.on_dragstart.call(self, mme);
      -                return false;
      -            }
      -
      -            if (self.is_dragging == true) {
      -                self.on_dragmove.call(self, mme);
      -            }
      -
      -            return false;
      -
      -        });
      -
      -        return false;
      -    };
      -
      -
      -    fn.on_dragstart = function(e) {
      -        e.preventDefault();
      -        this.drag_start = true;
      -        this.is_dragging = true;
      -        var offset = this.$container.offset();
      -        this.baseX = Math.round(offset.left);
      -        this.baseY = Math.round(offset.top);
      -        this.doc_height = $(document).height();
      -
      -        if (this.options.helper === 'clone') {
      -            this.$helper = this.$player.clone()
      -                .appendTo(this.$container).addClass('helper');
      -            this.helper = true;
      -        }else{
      -            this.helper = false;
      -        }
      -        this.scrollOffset = 0;
      -        this.el_init_offset = this.$player.offset();
      -        this.player_width = this.$player.width();
      -        this.player_height = this.$player.height();
      -        this.player_max_left = (this.$container.width() - this.player_width +
      -            this.options.offset_left);
      -
      -        if (this.options.start) {
      -            this.options.start.call(this.$player, e, {
      -                helper: this.helper ? this.$helper : this.$player
      -            });
      -        }
      -        return false;
      -    };
      -
      -
      -    fn.on_dragmove = function(e) {
      -        var offset = this.get_offset(e);
      -
      -        this.options.autoscroll && this.manage_scroll(offset);
      -
      -        (this.helper ? this.$helper : this.$player).css({
      -            'position': 'absolute',
      -            'left' : offset.left,
      -            'top' : offset.top
      -        });
      -
      -        var ui = {
      -            'position': {
      -                'left': offset.left,
      -                'top': offset.top
      -            }
      -        };
      -
      -        if (this.options.drag) {
      -            this.options.drag.call(this.$player, e, ui);
      -        }
      -        return false;
      -    };
      -
      -
      -    fn.on_dragstop = function(e) {
      -        var offset = this.get_offset(e);
      -        this.drag_start = false;
      -
      -        var ui = {
      -            'position': {
      -                'left': offset.left,
      -                'top': offset.top
      -            }
      -        };
      -
      -        if (this.options.stop) {
      -            this.options.stop.call(this.$player, e, ui);
      -        }
      -
      -        if (this.helper) {
      -            this.$helper.remove();
      -        }
      -
      -        return false;
      -    };
      -
      -
      -    fn.enable = function(){
      -        this.$container.on('mousedown.draggable', this.options.items, $.proxy(
      -            this.drag_handler, this));
      -
      -        $body.on('mouseup.draggable', $.proxy(function(e) {
      -            this.is_dragging = false;
      -            $body.off('mousemove.draggable');
      -            if (this.drag_start) {
      -                this.on_dragstop(e);
      -            }
      -        }, this));
      -    };
      -
      -
      -    fn.disable = function(){
      -        this.$container.off('mousedown.draggable');
      -        $body.off('mouseup.draggable');
      -    };
      -
      -
      -    fn.destroy = function(){
      -        this.disable();
      -        $.removeData(this.$container, 'draggable');
      -    };
      -
      -
      -    //jQuery adapter
      -    $.fn.draggable = function ( options ) {
      -        return this.each(function () {
      -            if (!$.data(this, 'draggable')) {
      -                $.data(this, 'draggable', new Draggable( this, options ));
      -            }
      -        });
      -    };
      -
      -
      -}(jQuery, window, document));
      -
      -    
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/files/src_jquery.gridster.js.html b/docs/files/src_jquery.gridster.js.html deleted file mode 100644 index 107d67ebe1..0000000000 --- a/docs/files/src_jquery.gridster.js.html +++ /dev/null @@ -1,2299 +0,0 @@ - - - - - src/jquery.gridster.js - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -

      File: src/jquery.gridster.js

      - -
      -
      -/*
      - * jquery.gridster
      - * https://github.com/ducksboard/gridster.js
      - *
      - * Copyright (c) 2012 ducksboard
      - * Licensed under the MIT, GPL licenses.
      - */
      -;(function($, window, document, undefined) {
      -
      -    var defaults = {
      -        widget_selector: '> li',
      -        widget_margins: [10, 10],
      -        widget_base_dimensions: [400, 225],
      -        extra_rows: 0,
      -        extra_cols: 0,
      -        min_cols: 1,
      -        min_rows: 15,
      -        autogenerate_stylesheet: true,
      -        avoid_overlapped_widgets: true,
      -        serialize_params: function($w, wgd) {
      -            return {
      -                col: wgd.col,
      -                row: wgd.row
      -            };
      -        },
      -        collision: {},
      -        draggable: {
      -            distance: 4
      -        }
      -    };
      -
      -
      -    /**
      -    * @class Gridster
      -    * @uses Draggable
      -    * @uses Collision
      -    * @param {HTMLElement} el The HTMLelement that contains all the widgets.
      -    * @param {Object} [options] An Object with all options you want to
      -    *        overwrite:
      -    *    @param {HTMLElement|String} [options.widget_selector] Define who will
      -    *     be the draggable widgets. Can be a CSS Selector String or a
      -    *     collection of HTMLElements
      -    *    @param {Array} [options.widget_margins] Margin between widgets.
      -    *     The first index for the horizontal margin (left, right) and
      -    *     the second for the vertical margin (top, bottom).
      -    *    @param {Array} [options.widget_base_dimensions] Base widget dimensions
      -    *     in pixels. The first index for the width and the second for the
      -    *     height.
      -    *    @param {Number} [options.extra_cols] Add more columns in addition to
      -    *     those that have been calculated.
      -    *    @param {Number} [options.extra_rows] Add more rows in addition to
      -    *     those that have been calculated.
      -    *    @param {Number} [options.min_cols] The minimum required columns.
      -    *    @param {Number} [options.min_rows] The minimum required rows.
      -    *    @param {Boolean} [options.autogenerate_stylesheet] If true, all the
      -    *     CSS required to position all widgets in their respective columns
      -    *     and rows will be generated automatically and injected to the
      -    *     `<head>` of the document. You can set this to false, and write
      -    *     your own CSS targeting rows and cols via data-attributes like so:
      -    *     `[data-col="1"] { left: 10px; }`
      -    *    @param {Boolean} [options.avoid_overlapped_widgets] Avoid that widgets loaded
      -    *     from the DOM can be overlapped. It is helpful if the positions were
      -    *     bad stored in the database or if there was any conflict.
      -    *    @param {Function} [options.serialize_params] Return the data you want
      -    *     for each widget in the serialization. Two arguments are passed:
      -    *     `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid
      -    *     coords object (`col`, `row`, `size_x`, `size_y`).
      -    *    @param {Object} [options.collision] An Object with all options for
      -    *     Collision class you want to overwrite. See Collision docs for
      -    *     more info.
      -    *    @param {Object} [options.draggable] An Object with all options for
      -    *     Draggable class you want to overwrite. See Draggable docs for more
      -    *     info.
      -    *
      -    * @constructor
      -    */
      -    function Gridster(el, options) {
      -      this.options = $.extend(true, defaults, options);
      -      this.$el = $(el);
      -      this.$wrapper = this.$el.parent();
      -      this.$widgets = $(this.options.widget_selector, this.$el).addClass('gs_w');
      -      this.widgets = [];
      -      this.$changed = $([]);
      -      this.wrapper_width = this.$wrapper.width();
      -      this.min_widget_width = (this.options.widget_margins[0] * 2) +
      -        this.options.widget_base_dimensions[0];
      -      this.min_widget_height = (this.options.widget_margins[1] * 2) +
      -        this.options.widget_base_dimensions[1];
      -      this.init();
      -    }
      -
      -    Gridster.generated_stylesheets = [];
      -
      -    var fn = Gridster.prototype;
      -
      -    fn.init = function() {
      -      this.generate_grid_and_stylesheet();
      -      this.get_widgets_from_DOM();
      -      this.set_dom_grid_height();
      -      this.$wrapper.addClass('ready');
      -      this.draggable();
      -
      -      $(window).bind(
      -        'resize', throttle($.proxy(this.recalculate_faux_grid, this), 200));
      -    };
      -
      -
      -    /**
      -    * Disable dragging.
      -    *
      -    * @method enable
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.disable = function() {
      -        this.$wrapper.find('.player-revert').removeClass('player-revert');
      -        this.drag_api.disable();
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Enable dragging.
      -    *
      -    * @method enable
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.enable = function() {
      -        this.drag_api.enable();
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Add a new widget to the grid.
      -    *
      -    * @method add_widget
      -    * @param {String} html The string representing the HTML of the widget.
      -    * @param {Number} size_x The nº of rows the widget occupies horizontally.
      -    * @param {Number} size_y The nº of columns the widget occupies vertically.
      -    * @return {HTMLElement} Returns the jQuery wrapped HTMLElement representing.
      -    *  the widget that was just created.
      -    */
      -    fn.add_widget = function(html, size_x, size_y) {
      -        var next_pos = this.next_position(size_x, size_y);
      -
      -        var $w = $(html).attr({
      -                'data-col': next_pos.col,
      -                'data-row': next_pos.row,
      -                'data-sizex' : next_pos.size_x,
      -                'data-sizey' : next_pos.size_y
      -            }).addClass('gs_w').appendTo(this.$el).hide();
      -
      -        this.$widgets = this.$widgets.add($w);
      -
      -        this.register_widget($w);
      -
      -        this.set_dom_grid_height();
      -
      -        return $w.fadeIn();
      -    };
      -
      -
      -    /**
      -    * Get the most left column below to add a new widget.
      -    *
      -    * @method next_position
      -    * @param {Number} size_x The nº of rows the widget occupies horizontally.
      -    * @param {Number} size_y The nº of columns the widget occupies vertically.
      -    * @return {Object} Returns a grid coords object representing the future
      -    *  widget coords.
      -    */
      -    fn.next_position = function(size_x, size_y) {
      -        size_x || (size_x = 1);
      -        size_y || (size_y = 1);
      -        var ga = this.gridmap;
      -        var cols_l = ga.length;
      -        var valid_pos = [];
      -
      -        for (var c = 1; c < cols_l; c++) {
      -            var rows_l = ga[c].length;
      -            for (var r = 1; r <= rows_l; r++) {
      -                var can_move_to = this.can_move_to({
      -                    size_x: size_x,
      -                    size_y: size_y
      -                }, c, r);
      -
      -                if (can_move_to) {
      -                    valid_pos.push({
      -                        col: c,
      -                        row: r,
      -                        size_y: size_y,
      -                        size_x: size_x
      -                    });
      -                }
      -            }
      -        }
      -
      -        if (valid_pos.length) {
      -            return this.sort_by_row_and_col_asc(valid_pos)[0];
      -        }
      -        return false;
      -    };
      -
      -
      -    /**
      -    * Remove a widget from the grid.
      -    *
      -    * @method remove_widget
      -    * @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.remove_widget = function(el, callback) {
      -        var $el = el instanceof jQuery ? el : $(el);
      -        var wgd = $el.coords().grid;
      -
      -        this.cells_occupied_by_placeholder = {};
      -        this.$widgets = this.$widgets.not($el);
      -
      -        var $nexts = this.widgets_below($el);
      -
      -        this.remove_from_gridmap(wgd);
      -
      -        $el.fadeOut($.proxy(function() {
      -            $el.remove();
      -
      -            $nexts.each($.proxy(function(i, widget) {
      -                this.move_widget_up( $(widget), wgd.size_y );
      -            }, this));
      -
      -            if (callback) {
      -                callback.call(this, el);
      -            }
      -        }, this));
      -    };
      -
      -
      -    /**
      -    * Returns a serialized array of the widgets in the grid.
      -    *
      -    * @method serialize
      -    * @param {HTMLElement} [$widgets] The collection of jQuery wrapped
      -    *  HTMLElements you want to serialize. If no argument is passed all widgets
      -    *  will be serialized.
      -    * @return {Array} Returns an Array of Objects with the data specified in
      -    *  the serialize_params option.
      -    */
      -    fn.serialize = function($widgets) {
      -        $widgets || ($widgets = this.$widgets);
      -        var result = [];
      -        $widgets.each($.proxy(function(i, widget) {
      -            result.push(this.options.serialize_params(
      -                $(widget), $(widget).coords().grid ) );
      -        }, this));
      -
      -        return result;
      -    };
      -
      -
      -    /**
      -    * Returns a serialized array of the widgets that have changed their
      -    *  position.
      -    *
      -    * @method serialize_changed
      -    * @return {Array} Returns an Array of Objects with the data specified in
      -    *  the serialize_params option.
      -    */
      -    fn.serialize_changed = function() {
      -        return this.serialize(this.$changed);
      -    };
      -
      -
      -    /**
      -    * Creates the grid coords object representing the widget a add it to the
      -    * mapped array of positions.
      -    *
      -    * @method register_widget
      -    * @return {Array} Returns the instance of the Gridster class.
      -    */
      -    fn.register_widget = function($el) {
      -
      -        var wgd = {
      -            'col': parseInt($el.attr('data-col'), 10),
      -            'row': parseInt($el.attr('data-row'), 10),
      -            'size_x': parseInt($el.attr('data-sizex'), 10),
      -            'size_y': parseInt($el.attr('data-sizey'), 10),
      -            'el': $el
      -        };
      -
      -        if (this.options.avoid_overlapped_widgets &&
      -            !this.can_move_to(
      -             {size_x: wgd.size_x, size_y: wgd.size_y}, wgd.col, wgd.row)
      -        ) {
      -            wgd = this.next_position(wgd.size_x, wgd.size_y);
      -            wgd.el = $el;
      -            $el.attr({
      -                'data-col': wgd.col,
      -                'data-row': wgd.row,
      -                'data-sizex': wgd.size_x,
      -                'data-sizey': wgd.size_y
      -            });
      -        }
      -
      -        // attach Coord object to player data-coord attribute
      -        $el.data('coords', $el.coords());
      -
      -        // Extend Coord object with grid position info
      -        $el.data('coords').grid = wgd;
      -
      -        this.add_to_gridmap(wgd, $el);
      -        this.widgets.push($el);
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Update in the mapped array of positions the value of cells represented by
      -    * the grid coords object passed in the `grid_data` param.
      -    *
      -    * @param {Object} grid_data The grid coords object representing the cells
      -    *  to update in the mapped array.
      -    * @param {HTMLElement|Boolean} value Pass `false` or the jQuery wrapped
      -    *  HTMLElement, depends if you want to delete an existing position or add
      -    *  a new one.
      -    * @method update_widget_position
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.update_widget_position = function(grid_data, value) {
      -        this.for_each_cell_occupied(grid_data, function(col, row) {
      -            if (!this.gridmap[col]) { return this; }
      -            this.gridmap[col][row] = value;
      -        });
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Remove a widget from the mapped array of positions.
      -    *
      -    * @method remove_from_gridmap
      -    * @param {Object} grid_data The grid coords object representing the cells
      -    *  to update in the mapped array.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.remove_from_gridmap = function(grid_data) {
      -        return this.update_widget_position(grid_data, false);
      -    };
      -
      -
      -    /**
      -    * Add a widget to the mapped array of positions.
      -    *
      -    * @method add_to_gridmap
      -    * @param {Object} grid_data The grid coords object representing the cells
      -    *  to update in the mapped array.
      -    * @param {HTMLElement|Boolean} value The value to set in the specified
      -    *  position .
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.add_to_gridmap = function(grid_data, value) {
      -        this.update_widget_position(grid_data, value || grid_data.el);
      -
      -        if (grid_data.el) {
      -            var $widgets = this.widgets_below(grid_data.el);
      -            $widgets.each($.proxy(function(i, widget) {
      -                this.move_widget_up( $(widget));
      -            }, this));
      -        }
      -    };
      -
      -
      -    /**
      -    * Make widgets draggable.
      -    *
      -    * @uses Draggable
      -    * @method draggable
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.draggable = function() {
      -        var self = this;
      -        var draggable_options = $.extend(true, {}, this.options.draggable, {
      -            offset_left: this.options.widget_margins[0],
      -            items: '.gs_w',
      -            start: function(event, ui) {
      -                self.$widgets.filter('.player-revert')
      -                    .removeClass('player-revert');
      -
      -                self.$player = $(this);
      -                self.$helper = self.options.draggable.helper === 'clone' ?
      -                    $(ui.helper) : self.$player;
      -                self.helper = !self.$helper.is(self.$player);
      -
      -                self.on_start_drag.call(self, event, ui);
      -                self.$el.trigger('gridster:dragstart');
      -            },
      -            stop: function(event, ui) {
      -                self.on_stop_drag.call(self, event, ui);
      -                self.$el.trigger('gridster:dragstop');
      -            },
      -            drag: throttle(function(event, ui) {
      -                self.on_drag.call(self, event, ui);
      -                self.$el.trigger('gridster:drag');
      -            }, 60)
      -          });
      -
      -        this.drag_api = this.$el.draggable(draggable_options).data('draggable');
      -        return this;
      -    };
      -
      -
      -    /**
      -    * This function is executed when the player begins to be dragged.
      -    *
      -    * @method on_start_drag
      -    * @param {Event} The original browser event
      -    * @param {Object} A prepared ui object.
      -    */
      -    fn.on_start_drag = function(event, ui) {
      -
      -        this.$helper.add(this.$player).add(this.$wrapper).addClass('dragging');
      -
      -        this.$player.addClass('player');
      -        this.player_grid_data = this.$player.coords().grid;
      -        this.placeholder_grid_data = $.extend({}, this.player_grid_data);
      -
      -        //set new grid height along the dragging period
      -        this.$el.css('height', this.$el.height() +
      -          (this.player_grid_data.size_y * this.min_widget_height));
      -
      -        var colliders = this.faux_grid;
      -        var coords = this.$player.data('coords').coords;
      -
      -        this.cells_occupied_by_player = this.get_cells_occupied(
      -            this.player_grid_data);
      -        this.cells_occupied_by_placeholder = this.get_cells_occupied(
      -            this.placeholder_grid_data);
      -
      -        this.last_cols = [];
      -        this.last_rows = [];
      -
      -
      -        // see jquery.collision.js
      -        this.collision_api = this.$helper.collision(
      -            colliders, this.options.collision);
      -
      -        this.$preview_holder = $('<li />', {
      -              'class': 'preview-holder',
      -              'data-row': this.$player.attr('data-row'),
      -              'data-col': this.$player.attr('data-col'),
      -              css: {
      -                  width: coords.width,
      -                  height: coords.height
      -              }
      -        }).appendTo(this.$el);
      -
      -        if (this.options.draggable.start) {
      -          this.options.draggable.start.call(this, event, ui);
      -        }
      -    };
      -
      -
      -    /**
      -    * This function is executed when the player is being dragged.
      -    *
      -    * @method on_drag
      -    * @param {Event} The original browser event
      -    * @param {Object} A prepared ui object.
      -    */
      -    fn.on_drag = function(event, ui) {
      -        var abs_offset = {
      -            left: ui.position.left + this.baseX,
      -            top: ui.position.top + this.baseY
      -        };
      -
      -        this.colliders_data = this.collision_api.get_closest_colliders(
      -            abs_offset);
      -
      -        this.on_overlapped_column_change(
      -            this.on_start_overlapping_column,
      -            this.on_stop_overlapping_column
      -        );
      -
      -        this.on_overlapped_row_change(
      -            this.on_start_overlapping_row,
      -            this.on_stop_overlapping_row
      -        );
      -
      -        if (this.helper && this.$player) {
      -            this.$player.css({
      -                'left': ui.position.left,
      -                'top': ui.position.top
      -            });
      -        }
      -
      -        if (this.options.draggable.drag) {
      -            this.options.draggable.drag.call(this, event, ui);
      -        }
      -    };
      -
      -    /**
      -    * This function is executed when the player stops being dragged.
      -    *
      -    * @method on_stop_drag
      -    * @param {Event} The original browser event
      -    * @param {Object} A prepared ui object.
      -    */
      -    fn.on_stop_drag = function(event, ui) {
      -        this.$helper.add(this.$player).add(this.$wrapper)
      -            .removeClass('dragging');
      -
      -        ui.position.left = ui.position.left + this.baseX;
      -        ui.position.top = ui.position.top + this.baseY;
      -        this.colliders_data = this.collision_api.get_closest_colliders(ui.position);
      -
      -        this.on_overlapped_column_change(
      -            this.on_start_overlapping_column,
      -            this.on_stop_overlapping_column
      -        );
      -
      -        this.on_overlapped_row_change(
      -            this.on_start_overlapping_row,
      -            this.on_stop_overlapping_row
      -        );
      -
      -        this.$player.addClass('player-revert').removeClass('player')
      -            .attr({
      -                'data-col': this.placeholder_grid_data.col,
      -                'data-row': this.placeholder_grid_data.row
      -            }).css({
      -                'left': '',
      -                'top': ''
      -            });
      -
      -        this.$changed = this.$changed.add(this.$player);
      -
      -        this.cells_occupied_by_player = this.get_cells_occupied(
      -            this.placeholder_grid_data);
      -        this.set_cells_player_occupies(
      -            this.placeholder_grid_data.col, this.placeholder_grid_data.row);
      -
      -        this.$player.coords().grid.row = this.placeholder_grid_data.row;
      -        this.$player.coords().grid.col = this.placeholder_grid_data.col;
      -
      -        this.$player = null;
      -
      -        this.$preview_holder.remove();
      -
      -        this.set_dom_grid_height();
      -
      -        if (this.options.draggable.stop) {
      -          this.options.draggable.stop.call(this, event, ui);
      -        }
      -    };
      -
      -
      -    /**
      -    * Executes the callbacks passed as arguments when a column begins to be
      -    * overlapped or stops being overlapped.
      -    *
      -    * @param {Function} start_callback Function executed when a new column
      -    *  begins to be overlapped. The column is passed as first argument.
      -    * @param {Function} stop_callback Function executed when a column stops
      -    *  being overlapped. The column is passed as first argument.
      -    * @method on_overlapped_column_change
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.on_overlapped_column_change = function(start_callback, stop_callback) {
      -        if (!this.colliders_data.length) {
      -            return;
      -        }
      -        var cols = this.get_targeted_columns(
      -            this.colliders_data[0].el.data.col);
      -
      -        var last_n_cols = this.last_cols.length;
      -        var n_cols = cols.length;
      -        var i;
      -
      -        for (i = 0; i < n_cols; i++) {
      -            if ($.inArray(cols[i], this.last_cols) === -1) {
      -                (start_callback || $.noop).call(this, cols[i]);
      -            }
      -        }
      -
      -        for (i = 0; i< last_n_cols; i++) {
      -            if ($.inArray(this.last_cols[i], cols) === -1) {
      -                (stop_callback || $.noop).call(this, this.last_cols[i]);
      -            }
      -        }
      -
      -        this.last_cols = cols;
      -
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Executes the callbacks passed as arguments when a row starts to be
      -    * overlapped or stops being overlapped.
      -    *
      -    * @param {Function} start_callback Function executed when a new row begins
      -    *  to be overlapped. The row is passed as first argument.
      -    * @param {Function} stop_callback Function executed when a row stops being
      -    *  overlapped. The row is passed as first argument.
      -    * @method on_overlapped_row_change
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.on_overlapped_row_change = function(start_callback, end_callback) {
      -        if (!this.colliders_data.length) {
      -            return;
      -        }
      -        var rows = this.get_targeted_rows(this.colliders_data[0].el.data.row);
      -        var last_n_rows = this.last_rows.length;
      -        var n_rows = rows.length;
      -        var i;
      -
      -        for (i = 0; i < n_rows; i++) {
      -            if ($.inArray(rows[i], this.last_rows) === -1) {
      -                (start_callback || $.noop).call(this, rows[i]);
      -            }
      -        }
      -
      -        for (i = 0; i < last_n_rows; i++) {
      -            if ($.inArray(this.last_rows[i], rows) === -1) {
      -                (end_callback || $.noop).call(this, this.last_rows[i]);
      -            }
      -        }
      -
      -        this.last_rows = rows;
      -    };
      -
      -
      -    /**
      -    * Sets the current position of the player
      -    *
      -    * @param {Function} start_callback Function executed when a new row begins
      -    *  to be overlapped. The row is passed as first argument.
      -    * @param {Function} stop_callback Function executed when a row stops being
      -    *  overlapped. The row is passed as first argument.
      -    * @method set_player
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.set_player = function(col, row) {
      -        this.empty_cells_player_occupies();
      -
      -        var self = this;
      -        var cell = self.colliders_data[0].el.data;
      -        var to_col = cell.col;
      -        var to_row = row || cell.row;
      -
      -        this.player_grid_data = {
      -            col: to_col,
      -            row: to_row,
      -            size_y : this.player_grid_data.size_y,
      -            size_x : this.player_grid_data.size_x
      -        };
      -
      -        this.cells_occupied_by_player = this.get_cells_occupied(
      -            this.player_grid_data);
      -
      -        var $overlapped_widgets = this.get_widgets_overlapped(
      -            this.player_grid_data);
      -
      -        var constraints = this.widgets_constraints($overlapped_widgets);
      -
      -        this.manage_movements(constraints.can_go_up, to_col, to_row);
      -        this.manage_movements(constraints.can_not_go_up, to_col, to_row);
      -
      -        /* if there is not widgets overlapping in the new player position,
      -         * update the new placeholder position. */
      -        if (!$overlapped_widgets.length) {
      -            var pp = this.can_go_player_up(this.player_grid_data);
      -            if (pp !== false) {
      -                to_row = pp;
      -            }
      -            this.set_placeholder(to_col, to_row);
      -        }
      -
      -        return {
      -            col: to_col,
      -            row: to_row
      -        };
      -    };
      -
      -
      -    /**
      -    * See which of the widgets in the $widgets param collection can go to
      -    * a upper row and which not.
      -    *
      -    * @method widgets_contraints
      -    * @param {HTMLElements} $widgets A jQuery wrapped collection of
      -    * HTMLElements.
      -    * @return {Array} Returns a literal Object with two keys: `can_go_up` &
      -    * `can_not_go_up`. Each contains a set of HTMLElements.
      -    */
      -    fn.widgets_constraints = function($widgets) {
      -        var $widgets_can_go_up = $([]);
      -        var $widgets_can_not_go_up;
      -        var wgd_can_go_up = [];
      -        var wgd_can_not_go_up = [];
      -
      -        $widgets.each($.proxy(function(i, w) {
      -            var $w = $(w);
      -            var wgd = $w.coords().grid;
      -            if (this.can_go_widget_up(wgd)) {
      -                $widgets_can_go_up = $widgets_can_go_up.add($w);
      -                wgd_can_go_up.push(wgd);
      -            }else{
      -                wgd_can_not_go_up.push(wgd);
      -            }
      -        }, this));
      -
      -        $widgets_can_not_go_up = $widgets.not($widgets_can_go_up);
      -
      -        return {
      -            can_go_up: this.sort_by_row_asc(wgd_can_go_up),
      -            can_not_go_up: this.sort_by_row_desc(wgd_can_not_go_up)
      -        };
      -    };
      -
      -
      -    /**
      -    * Sorts an Array of grid coords objects (representing the grid coords of
      -    * each widget) in ascending way.
      -    *
      -    * @method sort_by_row_asc
      -    * @param {Array} widgets Array of grid coords objects
      -    * @return {Array} Returns the array sorted.
      -    */
      -    fn.sort_by_row_asc = function(widgets) {
      -        widgets = widgets.sort(function(a, b) {
      -           if (a.row > b.row) {
      -               return 1;
      -           }
      -           return -1;
      -        });
      -
      -        return widgets;
      -    };
      -
      -
      -    /**
      -    * Sorts an Array of grid coords objects (representing the grid coords of
      -    * each widget) placing first the empty cells upper left.
      -    *
      -    * @method sort_by_row_and_col_asc
      -    * @param {Array} widgets Array of grid coords objects
      -    * @return {Array} Returns the array sorted.
      -    */
      -    fn.sort_by_row_and_col_asc = function(widgets) {
      -        widgets = widgets.sort(function(a, b) {
      -           if (a.row > b.row || a.row == b.row && a.col > b.col) {
      -               return 1;
      -           }
      -           return -1;
      -        });
      -
      -        return widgets;
      -    };
      -
      -
      -    /**
      -    * Sorts an Array of grid coords objects by column (representing the grid
      -    * coords of each widget) in ascending way.
      -    *
      -    * @method sort_by_col_asc
      -    * @param {Array} widgets Array of grid coords objects
      -    * @return {Array} Returns the array sorted.
      -    */
      -    fn.sort_by_col_asc = function(widgets) {
      -        widgets = widgets.sort(function(a, b) {
      -           if (a.col > b.col) {
      -               return 1;
      -           }
      -           return -1;
      -        });
      -
      -        return widgets;
      -    };
      -
      -
      -    /**
      -    * Sorts an Array of grid coords objects (representing the grid coords of
      -    * each widget) in descending way.
      -    *
      -    * @method sort_by_row_desc
      -    * @param {Array} widgets Array of grid coords objects
      -    * @return {Array} Returns the array sorted.
      -    */
      -    fn.sort_by_row_desc = function(widgets) {
      -        widgets = widgets.sort(function(a, b) {
      -            if (a.row + a.size_y < b.row + b.size_y) {
      -                return 1;
      -            }
      -           return -1;
      -        });
      -        return widgets;
      -    };
      -
      -
      -    /**
      -    * Sorts an Array of grid coords objects (representing the grid coords of
      -    * each widget) in descending way.
      -    *
      -    * @method manage_movements
      -    * @param {HTMLElements} $widgets A jQuery collection of HTMLElements
      -    *  representing the widgets you want to move.
      -    * @param {Number} to_col The column to which we want to move the widgets.
      -    * @param {Number} to_row The row to which we want to move the widgets.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.manage_movements = function($widgets, to_col, to_row) {
      -        $.each($widgets, $.proxy(function(i, w) {
      -            var wgd = w;
      -            var $w = wgd.el;
      -
      -            var can_go_widget_up = this.can_go_widget_up(wgd);
      -
      -            if (can_go_widget_up) {
      -                //target CAN go up
      -                //so move widget up
      -                this.move_widget_to($w, can_go_widget_up);
      -                this.set_placeholder(to_col, can_go_widget_up + wgd.size_y);
      -
      -            } else {
      -                //target can't go up
      -                var can_go_player_up = this.can_go_player_up(
      -                    this.player_grid_data);
      -
      -                if (!can_go_player_up) {
      -                    // target can't go up
      -                    // player cant't go up
      -                    // so we need to move widget down to a position that dont
      -                    // overlaps player
      -                    var y = (to_row + this.player_grid_data.size_y) - wgd.row;
      -
      -                    this.move_widget_down($w, y);
      -                    this.set_placeholder(to_col, to_row);
      -                }
      -            }
      -        }, this));
      -
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Determines if there is a widget in the row and col given. Or if the
      -    * HTMLElement passed as first argument is the player.
      -    *
      -    * @method is_player
      -    * @param {Number|HTMLElement} col_or_el A jQuery wrapped collection of
      -    * HTMLElements.
      -    * @param {Number} [row] The column to which we want to move the widgets.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_player = function(col_or_el, row) {
      -        if (row && !this.gridmap[col_or_el]) { return false; }
      -        var $w = row ? this.gridmap[col_or_el][row] : col_or_el;
      -        return $w && ($w.is(this.$player) || $w.is(this.$helper));
      -    };
      -
      -
      -    /**
      -    * Determines if the widget that is being dragged is currently over the row
      -    * and col given.
      -    *
      -    * @method is_player_in
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_player_in = function(col, row) {
      -        var c = this.cells_occupied_by_player;
      -        return $.inArray(col, c.cols) >= 0 && $.inArray(row, c.rows) >= 0;
      -    };
      -
      -
      -    /**
      -    * Determines if the placeholder is currently over the row and col given.
      -    *
      -    * @method is_placeholder_in
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_placeholder_in = function(col, row) {
      -        var c = this.cells_occupied_by_placeholder || {};
      -        return this.is_placeholder_in_col(col) && $.inArray(row, c.rows) >= 0;
      -    };
      -
      -
      -    /**
      -    * Determines if the placeholder is currently over the column given.
      -    *
      -    * @method is_placeholder_in_col
      -    * @param {Number} col The column to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_placeholder_in_col = function(col) {
      -        var c = this.cells_occupied_by_placeholder || [];
      -        return $.inArray(col, c.cols) >= 0;
      -    };
      -
      -
      -    /**
      -    * Determines if the cell represented by col and row params is empty.
      -    *
      -    * @method is_empty
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_empty = function(col, row) {
      -        if (typeof this.gridmap[col] !== 'undefined' &&
      -            typeof this.gridmap[col][row] !== 'undefined' &&
      -            this.gridmap[col][row] === false
      -        ) {
      -            return true;
      -        }
      -        return false;
      -    };
      -
      -
      -    /**
      -    * Determines if the cell represented by col and row params is occupied.
      -    *
      -    * @method is_occupied
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_occupied = function(col, row) {
      -        if (!this.gridmap[col]) {
      -            return false;
      -        }
      -
      -        if (this.gridmap[col][row]) {
      -            return true;
      -        }
      -        return false;
      -    };
      -
      -
      -    /**
      -    * Determines if there is a widget in the cell represented by col/row params.
      -    *
      -    * @method is_widget
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean|HTMLElement} Returns false if there is no widget,
      -    * else returns the jQuery HTMLElement
      -    */
      -    fn.is_widget = function(col, row) {
      -        var cell = this.gridmap[col];
      -        if (!cell) {
      -            return false;
      -        }
      -
      -        cell = cell[row];
      -
      -        if (cell) {
      -            return cell;
      -        }
      -
      -        return false;
      -    };
      -
      -
      -    /**
      -    * Determines if there is a widget in the cell represented by col/row
      -    * params and if this is under the widget that is being dragged.
      -    *
      -    * @method is_widget_under_player
      -    * @param {Number} col The column to check.
      -    * @param {Number} row The row to check.
      -    * @return {Boolean} Returns true or false.
      -    */
      -    fn.is_widget_under_player = function(col, row) {
      -        if (this.is_widget(col, row)) {
      -            return this.is_player_in(col, row);
      -        }
      -        return false;
      -    };
      -
      -
      -    /**
      -    * Get widgets overlapping with the player.
      -    *
      -    * @method get_widgets_under_player
      -    * @return {HTMLElement} Returns a jQuery collection of HTMLElements
      -    */
      -    fn.get_widgets_under_player = function() {
      -        var cells = this.cells_occupied_by_player;
      -        var $widgets = $([]);
      -
      -        $.each(cells.cols, $.proxy(function(i, col) {
      -            $.each(cells.rows, $.proxy(function(i, row) {
      -                if(this.is_widget(col, row)) {
      -                    $widgets = $widgets.add(this.gridmap[col][row]);
      -                }
      -            }, this));
      -        }, this));
      -
      -        return $widgets;
      -    };
      -
      -
      -    /**
      -    * Put placeholder at the row and column specified.
      -    *
      -    * @method set_placeholder
      -    * @param {Number} col The column to which we want to move the
      -    *  placeholder.
      -    * @param {Number} row The row to which we want to move the
      -    *  placeholder.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.set_placeholder = function(col, row) {
      -        var phgd = $.extend({}, this.placeholder_grid_data);
      -        var $nexts = this.widgets_below({
      -                col: phgd.col,
      -                row: phgd.row,
      -                size_y: phgd.size_y,
      -                size_x: phgd.size_x
      -            });
      -
      -        //Prevents widgets go out of the grid
      -        var right_col = (col + phgd.size_x - 1);
      -        if (right_col > this.cols) {
      -            col = col - (right_col - col);
      -        }
      -
      -        var moved_down = this.placeholder_grid_data.row < row;
      -        var changed_column = this.placeholder_grid_data.col !== col;
      -
      -        this.placeholder_grid_data.col = col;
      -        this.placeholder_grid_data.row = row;
      -
      -        this.cells_occupied_by_placeholder = this.get_cells_occupied(
      -            this.placeholder_grid_data);
      -
      -        this.$preview_holder.attr({
      -            'data-row' : row,
      -            'data-col' : col
      -        });
      -
      -        if (moved_down || changed_column) {
      -            $nexts.each($.proxy(function(i, widget) {
      -                this.move_widget_up(
      -                 $(widget), this.placeholder_grid_data.col - col + phgd.size_y);
      -            }, this));
      -        }
      -
      -    };
      -
      -
      -    /**
      -    * Determines whether the player can move to a position above.
      -    *
      -    * @method can_go_player_up
      -    * @param {Object} widget_grid_data The actual grid coords object of the
      -    *  player.
      -    * @return {Number|Boolean} If the player can be moved to an upper row
      -    *  returns the row number, else returns false.
      -    */
      -    fn.can_go_player_up = function(widget_grid_data) {
      -        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
      -        var result = true;
      -        var upper_rows = [];
      -        var min_row = 10000;
      -        var $widgets_under_player = this.get_widgets_under_player();
      -
      -        /* generate an array with columns as index and array with upper rows
      -         * empty as value */
      -        this.for_each_column_occupied(widget_grid_data, function(tcol) {
      -            var grid_col = this.gridmap[tcol];
      -            var r = p_bottom_row + 1;
      -            upper_rows[tcol] = [];
      -
      -            while (--r > 0) {
      -                if (this.is_empty(tcol, r) || this.is_player(tcol, r) ||
      -                    this.is_widget(tcol, r) &&
      -                    grid_col[r].is($widgets_under_player)
      -                ) {
      -                    upper_rows[tcol].push(r);
      -                    min_row = r < min_row ? r : min_row;
      -                }else{
      -                    break;
      -                }
      -            }
      -
      -            if (upper_rows[tcol].length === 0) {
      -                result = false;
      -                return true; //break
      -            }
      -
      -            upper_rows[tcol].sort();
      -        });
      -
      -        if (!result) { return false; }
      -
      -        return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
      -    };
      -
      -
      -    /**
      -    * Determines whether a widget can move to a position above.
      -    *
      -    * @method can_go_widget_up
      -    * @param {Object} widget_grid_data The actual grid coords object of the
      -    *  widget we want to check.
      -    * @return {Number|Boolean} If the widget can be moved to an upper row
      -    *  returns the row number, else returns false.
      -    */
      -    fn.can_go_widget_up = function(widget_grid_data) {
      -        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
      -        var result = true;
      -        var upper_rows = [];
      -        var min_row = 10000;
      -
      -        /* generate an array with columns as index and array with upper rows
      -         * empty as value */
      -        this.for_each_column_occupied(widget_grid_data, function(tcol) {
      -            var grid_col = this.gridmap[tcol];
      -            upper_rows[tcol] = [];
      -
      -            var r = p_bottom_row + 1;
      -
      -            while (--r > 0) {
      -                if (this.is_occupied(tcol, r) && !this.is_player(tcol, r)) {
      -                    break;
      -                }
      -
      -                if (!this.is_player(tcol, r) &&
      -                    !this.is_placeholder_in(tcol, r)
      -                ) {
      -                    upper_rows[tcol].push(r);
      -                }
      -
      -                if (r < min_row ) {
      -                    min_row = r;
      -                }
      -            }
      -
      -            if (upper_rows[tcol].length === 0) {
      -                result = false;
      -                return true; //break
      -            }
      -
      -            upper_rows[tcol].sort();
      -        });
      -
      -        if (!result) { return false; }
      -
      -        return this.get_valid_rows(widget_grid_data, upper_rows, min_row);
      -    };
      -
      -
      -    /**
      -    * Search a valid row for the widget represented by `widget_grid_data' in
      -    * the `upper_rows` array. Iteration starts from row specified in `min_row`.
      -    *
      -    * @method get_valid_rows
      -    * @param {Object} widget_grid_data The actual grid coords object of the
      -    *  player.
      -    * @param {Array} upper_rows An array with columns as index and arrays
      -    *  of valid rows as values.
      -    * @param {Number} min_row The upper row from which the iteration will start.
      -    * @return {Number|Boolean} Returns the upper row valid from the `upper_rows`
      -    *  for the widget in question.
      -    */
      -    fn.get_valid_rows = function(widget_grid_data, upper_rows, min_row) {
      -        var p_top_row = widget_grid_data.row;
      -        var p_bottom_row = widget_grid_data.row + widget_grid_data.size_y - 1;
      -        var size_y = widget_grid_data.size_y;
      -        var r = min_row - 1;
      -        var valid_rows = [];
      -
      -        while (++r <= p_bottom_row ) {
      -            var common = true;
      -            $.each(upper_rows, function(col, rows) {
      -                if (rows && $.inArray(r, rows) === -1) {
      -                    common = false;
      -                }
      -            });
      -
      -            if (common === true) {
      -                valid_rows.push(r);
      -                if (valid_rows.length === size_y) {
      -                    break;
      -                }
      -            }
      -        }
      -
      -        var new_row = false;
      -        if (size_y === 1) {
      -            if (valid_rows[0] !== p_top_row) {
      -                new_row = valid_rows[0] || false;
      -            }
      -        }else{
      -            if (valid_rows[0] !== p_top_row) {
      -                new_row = this.get_consecutive_numbers_index(
      -                    valid_rows, size_y);
      -            }
      -        }
      -
      -
      -        return new_row;
      -    };
      -
      -
      -    fn.get_consecutive_numbers_index = function(arr, size_y) {
      -        var max = arr.length;
      -        var result = [];
      -        var first = true;
      -        var prev = -1; // or null?
      -
      -        for (var i=0; i < max; i++) {
      -            if (first || arr[i] === prev + 1) {
      -                result.push(i);
      -                if (result.length === size_y) {
      -                    break;
      -                }
      -                first = false;
      -            }else{
      -                result = [];
      -                first = true;
      -            }
      -
      -            prev = arr[i];
      -        }
      -
      -        return result.length >= size_y ? arr[result[0]] : false;
      -    };
      -
      -
      -    /**
      -    * Get widgets overlapping with the player.
      -    *
      -    * @method get_widgets_overlapped
      -    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
      -    */
      -    fn.get_widgets_overlapped = function() {
      -        var $w;
      -        var $widgets = $([]);
      -        var used = [];
      -        var rows_from_bottom = this.cells_occupied_by_player.rows.slice(0);
      -        rows_from_bottom.reverse();
      -
      -        $.each(this.cells_occupied_by_player.cols, $.proxy(function(i, col) {
      -            $.each(rows_from_bottom, $.proxy(function(i, row) {
      -                // if there is a widget in the player position
      -                if (!this.gridmap[col]) { return true; } //next iteration
      -                var $w = this.gridmap[col][row];
      -
      -                if (this.is_occupied(col, row) && !this.is_player($w) &&
      -                    $.inArray($w, used) === -1
      -                ) {
      -                    $widgets = $widgets.add($w);
      -                    used.push($w);
      -                }
      -
      -            }, this));
      -        }, this));
      -
      -        return $widgets;
      -    };
      -
      -
      -    /**
      -    * This callback is executed when the player begins to collide with a column.
      -    *
      -    * @method on_start_overlapping_column
      -    * @param {Number} col The collided column.
      -    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
      -    */
      -    fn.on_start_overlapping_column = function(col) {
      -        this.set_player(col, false);
      -    };
      -
      -
      -    /**
      -    * A callback executed when the player begins to collide with a row.
      -    *
      -    * @method on_start_overlapping_row
      -    * @param {Number} col The collided row.
      -    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
      -    */
      -    fn.on_start_overlapping_row = function(row) {
      -        this.set_player(false, row);
      -    };
      -
      -
      -    /**
      -    * A callback executed when the the player ends to collide with a column.
      -    *
      -    * @method on_stop_overlapping_column
      -    * @param {Number} col The collided row.
      -    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
      -    */
      -    fn.on_stop_overlapping_column = function(col) {
      -        this.set_player();
      -
      -        var self = this;
      -        this.for_each_widget_below(col, this.cells_occupied_by_player.rows[0],
      -            function(tcol, trow) {
      -                self.move_widget_up(this, self.player_grid_data.size_y);
      -        });
      -    };
      -
      -
      -    /**
      -    * This callback is executed when the player ends to collide with a row.
      -    *
      -    * @method on_stop_overlapping_row
      -    * @param {Number} row The collided row.
      -    * @return {HTMLElements} Returns a jQuery collection of HTMLElements.
      -    */
      -    fn.on_stop_overlapping_row = function(row) {
      -        this.set_player();
      -
      -        var self = this;
      -        var cols = this.cells_occupied_by_player.cols;
      -        for (var c = 0, cl = cols.length; c < cl; c++) {
      -            this.for_each_widget_below(cols[c], row, function(tcol, trow) {
      -                self.move_widget_up(this, self.player_grid_data.size_y);
      -            });
      -        }
      -    };
      -
      -
      -    /**
      -    * Move a widget to a specific row. The cell or cells must be empty.
      -    * If the widget has widgets below, all of these widgets will be moved also
      -    * if they can.
      -    *
      -    * @method move_widget_to
      -    * @param {HTMLElement} $widget The jQuery wrapped HTMLElement of the
      -    * widget is going to be moved.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.move_widget_to = function($widget, row) {
      -        var self = this;
      -        var widget_grid_data = $widget.coords().grid;
      -        var diff = row - widget_grid_data.row;
      -        var $next_widgets = this.widgets_below($widget);
      -
      -        var can_move_to_new_cell = this.can_move_to(
      -            widget_grid_data, widget_grid_data.col, row, $widget);
      -
      -        if (can_move_to_new_cell === false) {
      -            return false;
      -        }
      -
      -        this.remove_from_gridmap(widget_grid_data);
      -        widget_grid_data.row = row;
      -        this.add_to_gridmap(widget_grid_data);
      -        $widget.attr('data-row', row);
      -        this.$changed = this.$changed.add($widget);
      -
      -
      -        $next_widgets.each(function(i, widget) {
      -            var $w = $(widget);
      -            var wgd = $w.coords().grid;
      -            var can_go_up = self.can_go_widget_up(wgd);
      -
      -            if (can_go_up && can_go_up !== wgd.row) {
      -                self.move_widget_to($w, can_go_up);
      -            }
      -        });
      -
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Move up the specified widget and all below it.
      -    *
      -    * @method move_widget_up
      -    * @param {HTMLElement} $widget The widget you want to move.
      -    * @param {Number} [y_units] The number of cells that the widget has to move.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.move_widget_up = function($widget, y_units) {
      -        var el_grid_data = $widget.coords().grid;
      -        var actual_row = el_grid_data.row;
      -        var moved = [];
      -        var can_go_up = true;
      -        y_units || (y_units = 1);
      -
      -        if (!this.can_go_up($widget)) { return false; } //break;
      -
      -        this.for_each_column_occupied(el_grid_data, function(col) {
      -            // can_go_up
      -            if ($.inArray($widget, moved) === -1) {
      -                var widget_grid_data = $widget.coords().grid;
      -                var next_row = actual_row - y_units;
      -                next_row = this.can_go_up_to_row(
      -                    widget_grid_data, col, next_row);
      -
      -                if (!next_row) {
      -                    return true;
      -                }
      -
      -                var $next_widgets = this.widgets_below($widget);
      -
      -                this.remove_from_gridmap(widget_grid_data);
      -                widget_grid_data.row = next_row;
      -                this.add_to_gridmap(widget_grid_data);
      -                $widget.attr('data-row', widget_grid_data.row);
      -                this.$changed = this.$changed.add($widget);
      -
      -                moved.push($widget);
      -
      -                $next_widgets.each($.proxy(function(i, widget) {
      -                    this.move_widget_up($(widget), y_units);
      -                }, this));
      -            }
      -        });
      -
      -    };
      -
      -
      -    /**
      -    * Move down the specified widget and all below it.
      -    *
      -    * @method move_widget_down
      -    * @param {HTMLElement} $widget The jQuery object representing the widget
      -    *  you want to move.
      -    * @param {Number} The number of cells that the widget has to move.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.move_widget_down = function($widget, y_units) {
      -        var el_grid_data = $widget.coords().grid;
      -        var actual_row = el_grid_data.row;
      -        var moved = [];
      -        var y_diff = y_units;
      -
      -        if (!$widget) { return false; }
      -
      -        if ($.inArray($widget, moved) === -1) {
      -
      -            var widget_grid_data = $widget.coords().grid;
      -            var next_row = actual_row + y_units;
      -            var $next_widgets = this.widgets_below($widget);
      -
      -            this.remove_from_gridmap(widget_grid_data);
      -
      -            $next_widgets.each($.proxy(function(i, widget) {
      -                var $w = $(widget);
      -                var wd = $w.coords().grid;
      -                var tmp_y = this.displacement_diff(
      -                             wd, widget_grid_data, y_diff);
      -
      -                if (tmp_y > 0) {
      -                    this.move_widget_down($w, tmp_y);
      -                }
      -            }, this));
      -
      -            widget_grid_data.row = next_row;
      -            this.update_widget_position(widget_grid_data, $widget);
      -            $widget.attr('data-row', widget_grid_data.row);
      -            this.$changed = this.$changed.add($widget);
      -
      -            moved.push($widget);
      -        }
      -    };
      -
      -
      -    /**
      -    * Check if the widget can move to the specified row, else returns the
      -    * upper row possible.
      -    *
      -    * @method can_go_up_to_row
      -    * @param {Number} widget_grid_data The current grid coords object of the
      -    *  widget.
      -    * @param {Number} col The target column.
      -    * @param {Number} row The target row.
      -    * @return {Boolean|Number} Returns the row number if the widget can move
      -    *  to the target position, else returns false.
      -    */
      -    fn.can_go_up_to_row = function(widget_grid_data, col, row) {
      -        var ga = this.gridmap;
      -        var result = true;
      -        var urc = []; // upper_rows_in_columns
      -        var actual_row = widget_grid_data.row;
      -        var r;
      -
      -        /* generate an array with columns as index and array with
      -         * upper rows empty in the column */
      -        this.for_each_column_occupied(widget_grid_data, function(tcol) {
      -            var grid_col = ga[tcol];
      -            urc[tcol] = [];
      -
      -            r = actual_row;
      -            while (r--) {
      -                if (this.is_empty(tcol, r) &&
      -                    !this.is_placeholder_in(tcol, r)
      -                ) {
      -                    urc[tcol].push(r);
      -                }else{
      -                    break;
      -                }
      -            }
      -
      -            if (!urc[tcol].length) {
      -                result = false;
      -                return true;
      -            }
      -
      -        });
      -
      -        if (!result) { return false; }
      -
      -        /* get common rows starting from upper position in all the columns
      -         * that widget occupies */
      -        r = row;
      -        for (r = 1; r < actual_row; r++) {
      -            var common = true;
      -
      -            for (var uc = 0, ucl = urc.length; uc < ucl; uc++) {
      -                if (urc[uc] && $.inArray(r, urc[uc]) === -1) {
      -                    common = false;
      -                }
      -            }
      -
      -            if (common === true) {
      -                result = r;
      -                break;
      -            }
      -        }
      -
      -        return result;
      -    };
      -
      -
      -    fn.displacement_diff = function(widget_grid_data, parent_bgd, y_units) {
      -        var actual_row = widget_grid_data.row;
      -        var diffs = [];
      -        var parent_max_y = parent_bgd.row + parent_bgd.size_y;
      -
      -        this.for_each_column_occupied(widget_grid_data, function(col) {
      -            var temp_y_units = 0;
      -
      -            for (var r = parent_max_y; r < actual_row; r++) {
      -                if (this.is_empty(col, r)) {
      -                    temp_y_units = temp_y_units + 1;
      -                }
      -            }
      -
      -            diffs.push(temp_y_units);
      -        });
      -
      -        var max_diff = Math.max.apply(Math, diffs);
      -        y_units = (y_units - max_diff);
      -
      -        return y_units > 0 ? y_units : 0;
      -    };
      -
      -
      -    /**
      -    * Get widgets below a widget.
      -    *
      -    * @method widgets_below
      -    * @param {HTMLElement} $el The jQuery wrapped HTMLElement.
      -    * @return {HTMLElements} A jQuery collection of HTMLElements.
      -    */
      -    fn.widgets_below = function($el) {
      -        var el_grid_data = $.isPlainObject($el) ? $el : $el.coords().grid;
      -        var self = this;
      -        var ga = this.gridmap;
      -        var next_row = el_grid_data.row + el_grid_data.size_y - 1;
      -        var $nexts = $([]);
      -
      -        this.for_each_column_occupied(el_grid_data, function(col) {
      -            self.for_each_widget_below(col, next_row,
      -                function(tcol, trow) {
      -                    if (!self.is_player(this) &&
      -                        $.inArray(this, $nexts) === -1) {
      -                            $nexts = $nexts.add(this);
      -                            return true; // break
      -                    }
      -                });
      -        });
      -
      -        return this.sort_by_row_asc($nexts);
      -    };
      -
      -
      -    /**
      -    * Update the array of mapped positions with the new player position.
      -    *
      -    * @method set_cells_player_occupies
      -    * @param {Number} col The new player col.
      -    * @param {Number} col The new player row.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.set_cells_player_occupies = function(col, row) {
      -        this.remove_from_gridmap(this.placeholder_grid_data);
      -        this.placeholder_grid_data.col = col;
      -        this.placeholder_grid_data.row = row;
      -        this.add_to_gridmap(this.placeholder_grid_data, this.$player);
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Remove from the array of mapped positions the reference to the player.
      -    *
      -    * @method empty_cells_player_occupies
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.empty_cells_player_occupies = function() {
      -        this.remove_from_gridmap(this.placeholder_grid_data);
      -        return this;
      -    };
      -
      -
      -    fn.can_go_up = function($el) {
      -        var el_grid_data = $el.coords().grid;
      -        var initial_row = el_grid_data.row;
      -        var prev_row = initial_row - 1;
      -        var ga = this.gridmap;
      -        var upper_rows_by_column = [];
      -
      -        var result = true;
      -        if (initial_row === 1) { return false; }
      -
      -        this.for_each_column_occupied(el_grid_data, function(col) {
      -            var $w = this.is_widget(col, prev_row);
      -            if (this.is_occupied(col, prev_row) ||
      -                this.is_player(col, prev_row) ||
      -                this.is_placeholder_in(col, prev_row)
      -            ) {
      -                result = false;
      -                return true; //break
      -            }
      -        });
      -
      -        return result;
      -    };
      -
      -
      -
      -    /**
      -    * Check if it's possible to move a widget to a specific col/row. It takes
      -    * into account the dimensions (`size_y` and `size_x` attrs. of the grid
      -    *  coords object) the widget occupies.
      -    *
      -    * @method can_move_to
      -    * @param {Object} widget_grid_data The grid coords object that represents
      -    *  the widget.
      -    * @param {Object} The col target col.
      -    * @param {Object} The row target row.
      -    * @return {Boolean} Returns true if all cells are empty, else return false.
      -    */
      -    fn.can_move_to = function(widget_grid_data, col, row) {
      -        var ga = this.gridmap;
      -        var $w = widget_grid_data.el;
      -        var future_wd = {
      -            size_y: widget_grid_data.size_y,
      -            size_x: widget_grid_data.size_x,
      -            col: col,
      -            row: row
      -        };
      -        var result = true;
      -
      -        //Prevents widgets go out of the grid
      -        var right_col = col + widget_grid_data.size_x - 1;
      -        if (right_col > this.cols) {
      -            return false;
      -        };
      -
      -        this.for_each_cell_occupied(future_wd, function(tcol, trow) {
      -            var $tw = this.is_widget(tcol, trow);
      -            if ($tw && (!widget_grid_data.el || $tw.is($w))) {
      -                result = false;
      -            }
      -        });
      -
      -        return result;
      -    };
      -
      -
      -    /**
      -    * Given the leftmost column returns all columns that are overlapping
      -    *  with the player.
      -    *
      -    * @method get_targeted_columns
      -    * @param {Number} [from_col] The leftmost column.
      -    * @return {Array} Returns an array with column numbers.
      -    */
      -    fn.get_targeted_columns = function(from_col) {
      -        var max = (from_col || this.player_grid_data.col) +
      -            (this.player_grid_data.size_x - 1);
      -        var cols = [];
      -        for (var col = from_col; col <= max; col++) {
      -            cols.push(col);
      -        }
      -        return cols;
      -    };
      -
      -
      -    /**
      -    * Given the upper row returns all rows that are overlapping with the player.
      -    *
      -    * @method get_targeted_rows
      -    * @param {Number} [from_row] The upper row.
      -    * @return {Array} Returns an array with row numbers.
      -    */
      -    fn.get_targeted_rows = function(from_row) {
      -        var max = (from_row || this.player_grid_data.row) +
      -            (this.player_grid_data.size_y - 1);
      -        var rows = [];
      -        for (var row = from_row; row <= max; row++) {
      -            rows.push(row);
      -        }
      -        return rows;
      -    };
      -
      -    /**
      -    * Get all columns and rows that a widget occupies.
      -    *
      -    * @method get_cells_occupied
      -    * @param {Object} el_grid_data The grid coords object of the widget.
      -    * @return {Object} Returns an object like `{ cols: [], rows: []}`.
      -    */
      -    fn.get_cells_occupied = function(el_grid_data) {
      -        var cells = { cols: [], rows: []};
      -        var i;
      -        if (arguments[1] instanceof jQuery) {
      -            el_grid_data = arguments[1].coords().grid;
      -        }
      -
      -        for (i = 0; i < el_grid_data.size_x; i++) {
      -            var col = el_grid_data.col + i;
      -            cells.cols.push(col);
      -        }
      -
      -        for (i = 0; i < el_grid_data.size_y; i++) {
      -            var row = el_grid_data.row + i;
      -            cells.rows.push(row);
      -        }
      -
      -        return cells;
      -    };
      -
      -
      -    /**
      -    * Iterate over the cells occupied by a widget executing a function for
      -    * each one.
      -    *
      -    * @method for_each_cell_occupied
      -    * @param {Object} el_grid_data The grid coords object that represents the
      -    *  widget.
      -    * @param {Function} callback The function to execute on each column
      -    *  iteration. Column and row are passed as arguments.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.for_each_cell_occupied = function(grid_data, callback) {
      -        this.for_each_column_occupied(grid_data, function(col) {
      -            this.for_each_row_occupied(grid_data, function(row) {
      -                callback.call(this, col, row);
      -            });
      -        });
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Iterate over the columns occupied by a widget executing a function for
      -    * each one.
      -    *
      -    * @method for_each_column_occupied
      -    * @param {Object} el_grid_data The grid coords object that represents
      -    *  the widget.
      -    * @param {Function} callback The function to execute on each column
      -    *  iteration. The column number is passed as first argument.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.for_each_column_occupied = function(el_grid_data, callback) {
      -        for (var i = 0; i < el_grid_data.size_x; i++) {
      -            var col = el_grid_data.col + i;
      -            callback.call(this, col, el_grid_data);
      -        }
      -    };
      -
      -
      -    /**
      -    * Iterate over the rows occupied by a widget executing a function for
      -    * each one.
      -    *
      -    * @method for_each_row_occupied
      -    * @param {Object} el_grid_data The grid coords object that represents
      -    *  the widget.
      -    * @param {Function} callback The function to execute on each column
      -    *  iteration. The row number is passed as first argument.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.for_each_row_occupied = function(el_grid_data, callback) {
      -        for (var i = 0; i < el_grid_data.size_y; i++) {
      -            var row = el_grid_data.row + i;
      -            callback.call(this, row, el_grid_data);
      -        }
      -    };
      -
      -
      -
      -    fn._traversing_widgets = function(type, direction, col, row, callback) {
      -        var ga = this.gridmap;
      -        if (!ga[col]) { return; }
      -
      -        var cr, max;
      -        var action = type + '/' + direction;
      -        if (arguments[2] instanceof jQuery) {
      -            var el_grid_data = arguments[2].coords().grid;
      -            col = el_grid_data.col;
      -            row = el_grid_data.row;
      -            callback = arguments[3];
      -        }
      -        var matched = [];
      -        var trow = row;
      -
      -
      -        var methods = {
      -            'for_each/above': function() {
      -                while (trow--) {
      -                    if (trow > 0 && this.is_widget(col, trow) &&
      -                        $.inArray(ga[col][trow], matched) === -1
      -                    ) {
      -                        cr = callback.call(ga[col][trow], col, trow);
      -                        matched.push(ga[col][trow]);
      -                        if (cr) { break; }
      -                    }
      -                }
      -            },
      -            'for_each/below': function() {
      -                for (trow = row + 1, max = ga[col].length; trow < max; trow++) {
      -                    if (this.is_widget(col, trow) &&
      -                        $.inArray(ga[col][trow], matched) === -1
      -                    ) {
      -                        cr = callback.call(ga[col][trow], col, trow);
      -                        matched.push(ga[col][trow]);
      -                        if (cr) { break; }
      -                    }
      -                }
      -            }
      -        };
      -
      -        if (methods[action]) {
      -            methods[action].call(this);
      -        }
      -    };
      -
      -
      -    /**
      -    * Iterate over each widget above the column and row specified.
      -    *
      -    * @method for_each_widget_above
      -    * @param {Number} col The column to start iterating.
      -    * @param {Number} row The row to start iterating.
      -    * @param {Function} callback The function to execute on each widget
      -    *  iteration. The value of `this` inside the function is the jQuery
      -    *  wrapped HTMLElement.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.for_each_widget_above = function(col, row, callback) {
      -        this._traversing_widgets('for_each', 'above', col, row, callback);
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Iterate over each widget below the column and row specified.
      -    *
      -    * @method for_each_widget_below
      -    * @param {Number} col The column to start iterating.
      -    * @param {Number} row The row to start iterating.
      -    * @param {Function} callback The function to execute on each widget
      -    *  iteration. The value of `this` inside the function is the jQuery wrapped
      -    *  HTMLElement.
      -    * @return {Class} Returns the instance of the Gridster Class.
      -    */
      -    fn.for_each_widget_below = function(col, row, callback) {
      -        this._traversing_widgets('for_each', 'below', col, row, callback);
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Returns the highest occupied cell in the grid.
      -    *
      -    * @method get_highest_occupied_cell
      -    * @return {Object} Returns an object with `col` and `row` numbers.
      -    */
      -    fn.get_highest_occupied_cell = function() {
      -        var r;
      -        var gm = this.gridmap;
      -        var rows = [];
      -        var row_in_col = [];
      -        for (var c = gm.length - 1; c >= 1; c--) {
      -            for (r = gm[c].length - 1; r >= 1; r--) {
      -                if (this.is_widget(c, r)) {
      -                    rows.push(r);
      -                    row_in_col[r] = c;
      -                    break;
      -                }
      -            }
      -        }
      -
      -        var highest_row = Math.max.apply(Math, rows);
      -
      -        this.highest_occupied_cell = {
      -            col: row_in_col[highest_row],
      -            row: highest_row
      -        };
      -
      -        return this.highest_occupied_cell;
      -    };
      -
      -
      -    fn.get_widgets_from = function(col, row) {
      -        var ga = this.gridmap;
      -        var $widgets = $();
      -
      -        if (col) {
      -            $widgets = $widgets.add(
      -                this.$widgets.filter(function() {
      -                    var tcol = $(this).attr('data-col');
      -                    return (tcol === col || tcol > col);
      -                })
      -            );
      -        }
      -
      -        if (row) {
      -            $widgets = $widgets.add(
      -                this.$widgets.filter(function() {
      -                    var trow = $(this).attr('data-row');
      -                    return (trow === row || trow > row);
      -                })
      -            );
      -        }
      -
      -        return $widgets;
      -    }
      -
      -
      -    /**
      -    * Set the current height of the parent grid.
      -    *
      -    * @method set_dom_grid_height
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.set_dom_grid_height = function() {
      -        var r = this.get_highest_occupied_cell().row;
      -        this.$el.css('height', r * this.min_widget_height);
      -        return this;
      -    };
      -
      -
      -    /**
      -    * It generates the neccessary styles to position the widgets.
      -    *
      -    * @method generate_stylesheet
      -    * @param {Number} rows Number of columns.
      -    * @param {Number} cols Number of rows.
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.generate_stylesheet = function(opts) {
      -        var styles = '';
      -        var extra_cells = 10;
      -        var max_size_y = 6;
      -        var max_size_x = 6;
      -        var i;
      -        var rules;
      -
      -        opts || (opts = {});
      -        opts.cols || (opts.cols = this.cols);
      -        opts.rows || (opts.rows = this.rows);
      -        opts.namespace || (opts.namespace = '');
      -        opts.widget_base_dimensions ||
      -            (opts.widget_base_dimensions = this.options.widget_base_dimensions);
      -        opts.widget_margins ||
      -            (opts.widget_margins = this.options.widget_margins);
      -        opts.min_widget_width = (opts.widget_margins[0] * 2) +
      -            opts.widget_base_dimensions[0];
      -        opts.min_widget_height = (opts.widget_margins[1] * 2) +
      -            opts.widget_base_dimensions[1];
      -
      -        var serialized_opts = $.param(opts);
      -        // don't duplicate stylesheets for the same configuration
      -        if ($.inArray(serialized_opts, Gridster.generated_stylesheets) >= 0) {
      -            return false;
      -        }
      -
      -        Gridster.generated_stylesheets.push(serialized_opts);
      -
      -        /* generate CSS styles for cols */
      -        for (i = opts.cols + extra_cells; i >= 0; i--) {
      -            styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' +
      -                ((i * opts.widget_base_dimensions[0]) +
      -                (i * opts.widget_margins[0]) +
      -                ((i + 1) * opts.widget_margins[0])) + 'px;} ');
      -        }
      -
      -        /* generate CSS styles for rows */
      -        for (i = opts.rows + extra_cells; i >= 0; i--) {
      -            styles += (opts.namespace + ' [data-row="' + (i + 1) + '"] { top:' +
      -                ((i * opts.widget_base_dimensions[1]) +
      -                (i * opts.widget_margins[1]) +
      -                ((i + 1) * opts.widget_margins[1]) ) + 'px;} ');
      -        }
      -
      -
      -        for (var y = 1; y < max_size_y; y++) {
      -            styles += (opts.namespace + ' [data-sizey="' + y + '"] { height:' +
      -                (y * opts.widget_base_dimensions[1] +
      -                (y - 1) * (opts.widget_margins[1] * 2)) + 'px;}');
      -        }
      -
      -        for (var x = 1; x < max_size_x; x++) {
      -            styles += (opts.namespace + ' [data-sizex="' + x + '"] { width:' +
      -                (x * opts.widget_base_dimensions[0] +
      -                (x - 1) * (opts.widget_margins[0] * 2)) + 'px;}');
      -        }
      -
      -        return this.add_style_tag(styles);
      -    };
      -
      -
      -    /**
      -    * Injects the given CSS as string to the head of the document.
      -    *
      -    * @method add_style_tag
      -    * @param {String} css The styles to apply.
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.add_style_tag = function(css) {
      -      var d = document;
      -      var tag = d.createElement('style');
      -
      -      d.getElementsByTagName('head')[0].appendChild(tag);
      -      tag.setAttribute('type', 'text/css');
      -
      -      if (tag.styleSheet) {
      -        tag.styleSheet.cssText = css;
      -      }else{
      -        tag.appendChild(document.createTextNode(css));
      -      }
      -      return this;
      -    };
      -
      -
      -    /**
      -    * Generates a faux grid to collide with it when a widget is dragged and
      -    * detect row or column that we want to go.
      -    *
      -    * @method generate_faux_grid
      -    * @param {Number} rows Number of columns.
      -    * @param {Number} cols Number of rows.
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.generate_faux_grid = function(rows, cols) {
      -        this.faux_grid = [];
      -        this.gridmap = [];
      -        var col;
      -        var row;
      -        for (col = cols; col > 0; col--) {
      -            this.gridmap[col] = [];
      -            for (row = rows; row > 0; row--) {
      -                var coords = $({
      -                        left: this.baseX + ((col - 1) * this.min_widget_width),
      -                        top: this.baseY + (row -1) * this.min_widget_height,
      -                        width: this.min_widget_width,
      -                        height: this.min_widget_height,
      -                        col: col,
      -                        row: row,
      -                        original_col: col,
      -                        original_row: row
      -                    }).coords();
      -
      -                this.gridmap[col][row] = false;
      -                this.faux_grid.push(coords);
      -            }
      -        }
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Recalculates the offsets for the faux grid. You need to use it when
      -    * the browser is resized.
      -    *
      -    * @method recalculate_faux_grid
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.recalculate_faux_grid = function() {
      -        var aw = this.$wrapper.width();
      -        this.baseX = ($(window).width() - aw) / 2;
      -        this.baseY = this.$wrapper.offset().top;
      -
      -        $.each(this.faux_grid, $.proxy(function(i, coords) {
      -            this.faux_grid[i] = coords.update({
      -                left: this.baseX + (coords.data.col -1) * this.min_widget_width,
      -                top: this.baseY + (coords.data.row -1) * this.min_widget_height
      -            });
      -
      -        }, this));
      -
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Get all widgets in the DOM and register them.
      -    *
      -    * @method get_widgets_from_DOM
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.get_widgets_from_DOM = function() {
      -        this.$widgets.each($.proxy(function(i, widget) {
      -            this.register_widget($(widget));
      -        }, this));
      -        return this;
      -    };
      -
      -
      -    /**
      -    * Calculate columns and rows to be set based on the configuration
      -    *  parameters, grid dimensions, etc ...
      -    *
      -    * @method generate_grid_and_stylesheet
      -    * @return {Object} Returns the instance of the Gridster class.
      -    */
      -    fn.generate_grid_and_stylesheet = function() {
      -        var aw = this.$wrapper.width();
      -        var ah = this.$wrapper.height();
      -
      -        var cols = Math.floor(aw / this.min_widget_width) +
      -                   this.options.extra_cols;
      -        var rows = Math.floor(ah / this.min_widget_height) +
      -                   this.options.extra_rows;
      -
      -        var actual_cols = this.$widgets.map(function() {
      -            return $(this).attr('data-col');
      -        });
      -        //needed to pass tests with phantomjs
      -        actual_cols.length || (actual_cols = [0]);
      -
      -        var actual_rows = this.$widgets.map(function() {
      -            return $(this).attr('data-row');
      -        });
      -        //needed to pass tests with phantomjs
      -        actual_rows.length || (actual_rows = [0]);
      -
      -        var min_cols = Math.max.apply(Math, actual_cols);
      -        var min_rows = Math.max.apply(Math, actual_rows);
      -
      -        this.cols = Math.max(min_cols, cols, this.options.min_cols);
      -        this.rows = Math.max(min_rows, rows, this.options.min_rows);
      -
      -        this.baseX = ($(window).width() - aw) / 2;
      -        this.baseY = this.$wrapper.offset().top;
      -
      -        if (this.options.autogenerate_stylesheet) {
      -            this.generate_stylesheet();
      -        }
      -
      -        /* more faux rows that needed are created so that there are cells
      -         * where drag beyond the limits */
      -        return this.generate_faux_grid(this.rows, this.cols);
      -    };
      -
      -
      -    //jQuery adapter
      -    $.fn.gridster = function(options) {
      -     return this.each(function() {
      -       if (!$(this).data('gridster')) {
      -         $(this).data('gridster', new Gridster( this, options ));
      -       }
      -     });
      -    };
      -
      -
      -}(jQuery, window, document));
      -
      -    
      -
      - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index b51bc488fc..0000000000 --- a/docs/index.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - -
      -
      -
      - - -

      - -
      -
      - API Docs for: -
      -
      -
      - -
      - -
      -
      -
      - Show: - - - - - - - -
      - - -
      -
      -
      -
      -
      -

      - Browse to a module or class using the sidebar to view its API documentation. -

      - -

      Keyboard Shortcuts

      - -
        -
      • Press s to focus the API search box.

      • - -
      • Use Up and Down to select classes, modules, and search results.

      • - -
      • With the API search box or sidebar focused, use -Left or -Right to switch sidebar tabs.

      • - -
      • With the API search box or sidebar focused, use Ctrl+Left and Ctrl+Right to switch sidebar tabs.

      • -
      -
      -
      - - - -
      -
      -
      -
      -
      -
      - - - - - - - - - - diff --git a/docs/modules/index.html b/docs/modules/index.html deleted file mode 100644 index 487fe15b2a..0000000000 --- a/docs/modules/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - Redirector - - - - Click here to redirect - - From a993008afbcff4aab1d6d362dae66031005e559c Mon Sep 17 00:00:00 2001 From: vieron Date: Thu, 26 Jul 2012 12:37:02 +0200 Subject: [PATCH 056/248] removing also demo site from master --- index.html | 405 -------------------------- www/css/style.css | 437 ----------------------------- www/css/untitled | 4 - www/img/sprite.png | Bin 21203 -> 0 bytes www/js/libs/jquery-1.7.2.min.js | 4 - www/js/libs/modernizr-2.5.3.min.js | 4 - www/js/script.js | 10 - 7 files changed, 864 deletions(-) delete mode 100755 index.html delete mode 100755 www/css/style.css delete mode 100644 www/css/untitled delete mode 100644 www/img/sprite.png delete mode 100755 www/js/libs/jquery-1.7.2.min.js delete mode 100755 www/js/libs/modernizr-2.5.3.min.js delete mode 100755 www/js/script.js diff --git a/index.html b/index.html deleted file mode 100755 index 336254ad10..0000000000 --- a/index.html +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - gridster.js - - - - - - - - - - - - - - - -
      -
      - -

      put a grid in your life

      - - -
      -
      - - -
      - -
      -
      -

      Try it now!

      -

      Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.

      -
      - - -
      - - -
      - -
      -
        -
      • -
      • -
      • - -
      • -
      • - -
      • -
      • -
      • - -
      • -
      • - -
      • -
      • -
      -
      - -
      - -
      -
      -
      -

      Usage

      -
      - -
      -

      Setup

      -

      Nowadays griddable.js depends on jQuery, so you need to include it in the head of your document.

      - -

      Include dependencies

      -

      Download the latest release at jQuery.

      - - - -

      HTML Structure

      -

      The HTML required to make gridster works. Class names and tags are customizable but is needed to follow the structure below:

      - - - -

      Let's go run gridster.js!

      -

      Gridster only accepts one argument with configuration options. Take a look at the documentation.

      - - - -
      - -
      -

      Playing with the API

      -

      The API can be accesed as in most jQuery plugins via the jQuery data method like so:

      - - - -

      Add a new widget to the grid


      - - -

      Remove a widget from the grid


      - - -

      Get serialized array with the elements positions

      -

      Creates a JavaScript array of objects, ready to be encoded as a JSON string.

      - - - - -
      - -
      -
      - - -
      -
      -
      -

      Documentation

      - -

      Options

      -

      - -
      -

      Methods

      -

      The methods listed here are the most common. If this is never enough take a look to the documentation generated from source.

      -
      - - -
      - - -
      -
      -

      Options

      -

      gridder configuration object.

      - -

      widget_selector: "> li"

      -

      Define who are the widgets. Can be a CSS Selector string or a jQuery collection of HTMLElement

      - -

      widget_margins: [10, 10]

      -

      Horizontal and vertical margins respectively for widgets.

      - -

      widget_base_dimensions: [140, 140]

      -

      Base widget dimensions in pixels. The first index for the width and the second for the height.

      - -

      extra_rows: 0

      -

      Add more rows in addition to those that have been calculated.

      - -

      extra_cols: 0

      -

      Add more rows in addition to those that have been calculated.

      - -

      min_cols: 1

      -

      The minimum required columns.

      - -

      min_rows: 15

      -

      The minimum required rows.

      - -

      autogenerate_stylesheet: true

      -

      If true, all the CSS required to position all widgets in their respective columns and rows will be generated automatically and injected to the <head> of the document. You can set this to false, and write your own CSS targeting rows and cols via data-attributes like so: [data-col="1"] { left: 10px; }

      - -

      avoid_overlapped_widgets: true

      -

      Avoid that widgets loaded from the DOM can be overlapped. It is helpful if the positions were bad stored in the database or if there was any conflict.

      - -

      serialize_params: function($w, wgd) { return { col: wgd.col, row: wgd.row } }

      -

      Return the data you want for each widget in the serialize method. Two arguments are passed: `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid coords object (`col`, `row`, `size_x`, `size_y`).

      - -

      draggable.start: function(event, ui){}

      -

      Executes a function when dragging starts.

      - -

      draggable.drag: function(event, ui){}

      -

      Executes a function when the mouse is moved during the dragging.

      - -

      draggable.stop: function(event, ui){}

      -

      Executes a function when dragging stops.

      - -

      collision.on_overlap_start: function(collider_data) { }

      -

      Executes a function first time a widget overlaps with a "faux" grid cell.

      - -

      collision.on_overlap: function(collider_data) { }

      -

      Executes a function each time a widget overlaps with a "faux" grid cell.

      - -

      collision.on_overlap_stop: function(collider_data) { }

      -

      Executes a function last time a widget overlaps with a "faux" grid cell.

      -
      -
      - - -
      -

      .add_widget( html, [size_x], [size_y] )

      - -
      -

      Create a new widget with the given html and add it to the grid.

      - -

      Parameters

      -
      -
      html String
      -
      The string that represents the HTML of the widget.
      -
      size_x Number
      -
      The number of rows that the widget occupies. Default is 1.
      -
      size_y Number
      -
      The number of columns that the widget occupies. Default is 1.
      -
      - -

      Returns

      -

      Returns the jQuery wrapped HTMLElement representing the widget that was just created.

      -
      -
      - -
      -

      .remove_widget( el, [callback] )

      - -
      -

      Remove a widget from the grid

      - -

      Parameters

      -
      -
      el HTMLElement
      -
      The jQuery wrapped HTMLElement representing the widget that you want to remove.
      -
      callback Function
      -
      Executes a callback when the widgets is removed.
      -
      - -

      Returns

      -

      Returns the instance of the Gridster Class.

      -
      -
      - -
      -

      .serialize( [$widgets] )

      - -
      -

      Creates an array of objects representing the current position of all widgets in the grid.

      - -

      Parameters

      -
      -
      $widgets HTMLElement
      -
      The collection of jQuery wrapped HTMLElements you want to serialize. If no argument is passed all widgets will be serialized.
      -
      - -

      Returns

      -

      Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.

      - -
      -
      - -
      -

      .serialize_changed( )

      - -
      -

      Creates an array of objects representing the current position of the widgets who have changed position.

      -

      Returns

      -

      Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.

      -
      -
      - -
      -
      - - - -
      -
      -
      -

      Download

      -
      - - - -
      -
      - -
      -
      -
      -

      Browser support

      -
      - -
      -

      Gridster supports Internet Explorer 9+, Firefox, Chrome, Safari and Opera.

      -
      - -
      -
      - - - - -
      - - - - - - - - - - - - - - diff --git a/www/css/style.css b/www/css/style.css deleted file mode 100755 index 9d9394170c..0000000000 --- a/www/css/style.css +++ /dev/null @@ -1,437 +0,0 @@ -/* ============================================================================= - NORMALIZATION -========================================================================== */ - -* { - margin: 0; - padding: 0; -} - -article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } -[hidden] { display: none; } - -ul, ol { - list-style: none; -} - - -/* ============================================================================= - COMMONS -========================================================================== */ - -* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } - -body { - background-color: #EEEEEE; - font-family: 'Helvetica Neue', Arial, sans-serif; - -webkit-font-smoothing: antialiased; - font-size: x-small; - color: #666666; -} - -a { - color: #004756; - text-decoration: underline; - font-weight: bold; -} - -.wrapper { - margin: 0 auto; - width: 960px; -} - - -[role='header'] { - padding-top: 78px; - text-align: center; - background: #FFF; -} - -.logo, -.logo-small, -.ducksboard-logo { - display: inline-block; - text-indent: -999em; - background-image: url(../img/sprite.png); - background-repeat: no-repeat; -} - -.ducksboard-logo { - width: 120px; - height: 18px; - background-position: right bottom; - margin:0 5px; -} - -.logo { - width: 300px; - height: 100px; - background-position:20px top; -} - - -.logo-small { - width: 200px; - height: 60px; - background-position: 14px -110px; -} - -.i_download { - background: #FFF; - padding: 1.8em 2.5em; - color: #333; -} - -.i_download, -.i_download:before, -.i_download span { - display: inline-block; - vertical-align: middle; -} - -.i_download:before { - content: ''; - background: url(../img/sprite.png) no-repeat -216px -198px; - height: 50px; - width: 50px; - margin-right: 15px; -} - -.i_download:hover { - background-color: #004756; - color: #FFF; -} - -.i_download:hover:before { - background-position: -158px -198px; -} - -.i_download span { - font-size: 2em; -} - -.claim { - font-family: 'Rancho', cursive; - font-weight: normal; -} - -[role='header'] .claim { - font-size: 2em; - font-style: italic; - font-weight: normal; - - margin-top: -20px; - padding-bottom: 60px; -} - -[role='header'] nav li, -[role='header'] nav a { - display: inline-block; -} - -[role='header'] nav a { - padding: .6em 1.3em; - background: #F6F6F6; - font-size: 2em; - text-decoration: none; - color: #666666; - background-color: #F6F6F6; - font-weight: bold; - background-color: #EEEEEE; - -webkit-transition: color .3s; - transition: color .3s; -} - -[role='header'] nav a:hover { - color: #333; -} - -[role='header'] nav .active { - background-color: #EEEEEE; -} - -[role='header'] nav .active a { - color: #333333; -} - - - - -footer { - margin-top: 70px; - background: #004756; - padding-top: 3.3em; - text-align: center; -} - -footer .claim { - font-size: 1.6em; - font-style: italic; - color: #FFF; - margin-top: -16px; -} - -footer > p{ - margin-top: 2.6em; - background: #FFF; - padding: .8em 0; - color: #333333; - font-weight: bold; - font-size: 1.3em; -} - - -section header, -.scoped { - margin: 0 38px; -} - -.ttr { - text-align: right; -} - -section header .m_txt{ - margin-top: -2.5em; - padding: 0 0 25px 0; -} - - - - -/* Headings */ -.heading-xl, -.heading-l, -.heading-m { - color: #333333; - text-shadow: 1px 0 0 #FFF; - padding-bottom: .5em; -} - -.heading-xl { - font-size: 3em; - padding:2em 0 1em; -} - -.heading-l { - font-size: 2.6em; -} - -.heading-m { - font-size: 2.2em; - color: #999999; -} - -.heading-m em { - color: #666; - font-weight: normal; - font-size: .8em; -} - - - -/* Mod text */ -.m_txt { - padding: 38px; -} - -.m_txt p, -.m_txt ul, -.m_txt ol, -.m_txt dl { - font-size: 1.6em; - text-shadow: 1px 0 0 #FFF; - padding-bottom: 2em; - line-height: 1.4em; -} - -.m_txt :last-child:not(a) { - padding-bottom: 0; -} - -.m_txt .gist { - margin-top: -10px; - margin-bottom: 40px; - font-size: 1.4em; - line-height: 1.3em; -} - -.m_txt .heading-xl { - padding-top: 1em; -} - -.m_txt dl { - padding-top: 10px; - padding-left: 30px; -} - -.m_txt dt { - color: #333; - font-weight: bold; - padding-bottom:.4em; -} - -.m_txt dt em{ - color: #666666; - font-weight: normal; - font-style: italic; -} - -.m_txt dd { - padding-bottom: 1em; -} - -.m_txt hr { - margin-bottom: 30px; - border-width: 1px 0 0 0 0; - border-top: 1px solid #CCC; -} - - -/* tags */ - -.m_tags { - margin-bottom: 30px; -} - -.m_tags li { - padding-bottom:4px; -} - -.m_tags li, -.m_tags a { - display: inline-block; -} - -.m_tags li { - margin-right: 4px; -} - -.m_tags a { - color: #666666; - font-size: 1.6em; - background: #FFF; - padding: .3em .6em; - text-decoration: none; -} - -.m_tags a:hover { - color: #FFF; - background-color: #004756; -} - - - - - - - - - - -/* Gridster styles */ -.demo { - margin: 3em 0; - padding: 7.5em 0 5.5em; - background: #004756; -} - -.demo:hover .gridster { - opacity: 1; -} - -.gridster { - width: 940px; - margin: 0 auto; - - opacity: .8; - - -webkit-transition: opacity .6s; - -moz-transition: opacity .6s; - -o-transition: opacity .6s; - -ms-transition: opacity .6s; - transition: opacity .6s; -} - -.gridster .gs_w { - background: #FFF; - cursor: pointer; - -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3); - box-shadow: 0 0 5px rgba(0,0,0,0.3); -} - -.gridster .player { - -webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3); - box-shadow: 3px 3px 5px rgba(0,0,0,0.3); -} - - -.gridster .gs_w.try { - background-image: url(../img/sprite.png); - background-repeat: no-repeat; - background-position: 37px -169px; - -} - -.gridster .preview-holder { - border: none!important; - border-radius: 0!important; - background: rgba(255,255,255,.2)!important; -} - - - - - - - - - - - -article, -.m_doc_method { - background: #FFF; -} - -article:not(:last-child), -.m_doc_method:not(:last-child) { - margin-bottom: 50px; -} - - -.m_doc_method > h3 { - background-color: #E5E5E5; - padding: 1.4em 2em; - color: #333333; - font-size: 1.8em; -} - - -.m_doc_method .heading-m { - color: #333333; -} - - - - -#intro { - overflow: hidden; -} - -#intro .i_download { - margin-top: 100px; -} - -#intro > div{ - width: 65%; - float: left; -} - -#intro { - padding-right: 0; -} - -#intro > div:last-child{ - width: 32%; - float: right; -} diff --git a/www/css/untitled b/www/css/untitled deleted file mode 100644 index 01348d39eb..0000000000 --- a/www/css/untitled +++ /dev/null @@ -1,4 +0,0 @@ -{ - -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3); - box-shadow: 0 0 5px rgba(0,0,0,0.3); -} diff --git a/www/img/sprite.png b/www/img/sprite.png deleted file mode 100644 index 8f2bfc17eb30c39d770132cf54d73721c9b7eff5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21203 zcmdRWWmgl!QCym1h?QWK?ZjZFa&o9!9BQ#;KAM9o!S2Fp8W>@ zeX(;+4?W%0Jynm~d!MQvB2|@TFi=TQK_C!@oUEie2n2@?Y?LTSz>%mbCc3_({QqM^E7p_0Db!6WM)AjZR29$ z>EvSPN+F@av)}$J253j{UpomG3sW~6Cr1iR8wU#zJ1;9QD?7)(v+j5hhyo-h`AO3& z`y|KHi$LpjV6BCwg9;8Il>TD`YIkD84?A5ce5MH8w$O$kdJ;|hHhD9BM8i!LH8=%T zNyHQr{cc1So~StLkMtB7LDy*sQ2pJz!LjAB97TSOQ>7m0#MSb07H5gy#8|dxXUQ0P z@0AceK57_(jy|bao~i(*CL8dP{eSA63}gbP{g~N>i-K)+?9p}tHl?jnGiX~XkkS_o z|6S@Qc-#NWv2ZYcTZp0|iyCU1ZNgTX>5)H(m;6E-h=A04)m{+%i3*peuluySk&(%P zh7eadn_^O6INM%Gd-Kh0Ts+=h46g7~Lt}&BMnsee_$^|dYzB9qa=~1*mAgJyd)Bfw!?szjC7_a(yhP>E{9CM#*jsydmx z)E$SyD|_KX%y8`{ze=*%ql7I$?4{g}QPj8$H0W%iYtb1oy6yc&U;J?B;#9a;aV}9lpVJdu57#=SE%t>V8fcv z<{L3XJ}{&^$Fb?epNn^JU0yXIb9ui!prbBP}M znN&9MQpZkllF+hX%ignCl3CQqO0XtkkiKWz8H948IRU5~fem=Bz#p|yoxl~8OehxATDM5fT1H4hTwV3wp7u4x>Gm3C@yLJCPR&zj|KhK=PDg0HrKola*S9y z9t<;*-D9xJXY-FFX$T==OfdnByGiB$sm-=eBE|WpdTfdjVW0CTgvC5s*?l%FM|gVV*x9EOWQEWL z8#6DkWm}bf#PfE8?G{Wm;|QsVXgSS*oz-SU%|@F@$VM|{>BLezFJUX+RG#e}E*f(l zn}C>hSg&Hn>~rkp&k(4f!uPcLCzH^X(?}ums*2*|Rmj4Nicc-42JHbjfv_-t@}qJ3 zs73KRDtio{;L43;zbrKmLB|4yjr)LE&*5&d1m_m2y_|k{IMDv;Q}gcW!r(*0C7Wq@ z()sYk#?e))_txgK&T^9HZ%Jb5f-?{HL;d7pEy0a(FVYbq*-@>0Z_I#~hd{iS*C2he zg%b~{?db-qyWIf(5^lTg3fdsOSfg=e&X7E{{y38i0<JRZDlIzBg(2s_hocTO{tm_w!VQ^jtbr{mFaaT+<~+g*+ZwWGAHX zJ@v=Slg-vn3{9&JP~yDho{T6D(j`DI=?kW2vElb=EHic2|03DF#CBznsO_yn;yx-A zsBvWi-NS3ZZ3&%q_t^n+>y;=|RhZ?~cb9&m@7=b38%i+IyZ=mCPWs^;`3`>>?K;Hp zZO%^~B8-w&YHca;lfeCFtYEezSVPa4JrNZ#@0VU7`0>}|o4z+71IMQ5AMZMnCGE0o zLty^BP8Y_3ozKmNse;OUF3sgm8s^iHua>a4o+7WmGp3RDxOAB`Mitm_(W=~}p@?$5 zYJxhltOD`|s!doQJ@yv{Kq#NuUiE_U+$VohfvI%@I@SvFKT%=pA*V^Q#Wa3y`Nfx1 zqRda-Q%HyY-H*e`be^CHmbvM4d-oRU%|f2)KDfcFTkLni&)z86;U=3{tMk8(Oe4)6 zB*m*v()Z?mXQ9VJs?ilR5w^E-W*h2$N8ax2q|q4zMl?rEtF7NtAEfzvc zp=u9a$VQ6peq^{dzaFe&p`>vf#ijdi=cOPcIC00CTbowr3&Sdlap$NH`ZrjRY*#g&Siya zyK;|JmL&&Bs6lc{Do@m4blNwI8089gj#-nfr_wvp3T%ZA#l7J4=pot=h-s+aoy21m z4TaANZoyY(N;Qciv%bQ@lGl=!vWN6@=~P!r&Z7)+>;;<1ORsHrngvgv!OtpO+ZKWl zJVRXO^f*cCN*@xRwUIT;h#~Vw-@1~+6iS)ZpzBZt;pJs8T{58wU%1~V9^`QLIXVrG?gXIuzLG5aAR)PsulDb_mf?*PDI&CTWZU!*s%8zKK1A%|M}NA-iE~1S!by*_>m7-ii5JmAf+-{BrniR(n7GFvw#3{9xa;7Fev8$&!Bb zcNqS0jrU<;u+!VDCxyMO@$9}N&0qMJukhVJ#%aPgzxxt-D^V}N@{l2i&rpM}svvOpTL()G;>)O#D=tL-?q}hUn`@6vxT~VKKf}Qswj&!b6joq_S zvY!vSh&nGQKtgWQId|Ic`7}WXUL1-ib};X*T(yV4IMHo2%`IHm=edRHe8QYpIeV-A z?yXD_$U*UIMt}Xi5B5~J=6JV**YCYLjH<6{4UPS`VbE755lYI4q3*v4n}IDE<&apb zjG#}M5Z!>yG^CODmH4>KwO>29{Vj7F7`t9mur3btGQ-95l)F-2F6Ro&&seH!szx^? z+AZOCCGxy#(L?W5e`zl-9)1W!LwIv4PIf>NE>@u z&rzjM$xGz{qkC+2>b-m%G8~OykC}&hZ7lzqU7Mh=*;juAeDSHP3g-QHyJFD62M9Wy z@ZfHQ0)deY2|xAwrf8LK`KL;;vDI|6iY<4)q5fMbOV`%6_GVoVX8oJvqE63u$xiKj z$caYq6Co;-zv}X;U(EvRU>o6%+2?MCN+%c})nck6e2fr!!(%4kp?k^rJ8Ya}0hiB8 zJETVJdMR|hJ9kgWXREJ!>%%$#A2H^RlSdIIs#b*09ixc_C};K@R^Z;WBFayyMo&~4 zUbru|rmitf;h}jyhWOs8IF?pS%tjY(HOgS4hH;b_h`!Qb)F#+-wJqzr%o;8Q!af{q zc@qAa#6x=v-7^%LAT|2dZ!`PzU+3K=X-Qhu>njbO8O|p&mnm8h3$l?sp7R(iGjO5{ z^LW9Nu`);h)L-yU(fhe^*z?B?qI5D~&WGRbO%rMaXtbOE65QhT1BdR^_-c4dI=D!B&8t}tyLfr3r4{3s1p2-3A&{H$ znzHxhb)SDt|NAin83UOZ`ENb|+UN(VoR9jK5U8SrVaHQe5hHXjj3u82X%EVa^(R|( zL;CW11l`hihgw-lN(6VUxD)hDt zNWL2Q_n~z-jjW6Rq-Z%v^zVwTk@JP~(!jFwl_k4Aoe=sw>srmka&5z=NS3!;^L*8P ztLg~pEotcLLn(ps_DU#P!u#CMDz8sYz?j0d%vT)mcH5%J7Jty|k6VhZh}4P8#H2!s z8VlfVMn0YRj$djub+-_c2tS!+BEttgxUJ^1dsH(~?`Ybu@{B1X3CEwkkYx*&fk9(E z3r=faW?!@m%4%)aWt{$;!CS?bB(hn*jVyEV(6;ZIiL1?NbqmnwN5U1%KehSSg3E{~ z{y2BT0%CKQv90;3R^9mNkr$LX62*nJGj4@^d)n4#xj?d0f7}Im^yyWD&BW9bNI+mG zbDS`rKZb_B9)Z)OdoLRGO$QLUCV!TlorLi2w^j38;!4n!TNkQ0{3=Vd#4YoUJn0CoAxU*Gn!y$!pvr!P4LJbn64JanQSxOSC> zV6y!p4XyOOGn)ePTs4=rFwW>TpBi6!e5%7WPV{LIs8EN+d&}ZCTYJYhvuUyc!0;+} zyxezGQTD$aU9#>IUNu=k**so;@}p+w zXFvfR41N)5w%-^$J1XJ_2#7T)N7{p!LNrb92s|TXwqalvF@d;% z$W-Lepz1x})@{06DmjdsQHDK9cs}7KCy9gZE1Wu<@q(0G+E_{a7pkMBjT?_v(v4~s zKG*jCT(1}~gc;W0#n&Y7)owif`X+ra1?UNRMP<}AXYZRTUdLCLNxE^Ni9ws93tsMA zid0kU3=wsoonYFIiuy7}kI)k7_4=1f{{^(^Q{PJK%^74^RuXgs{`X1zavRQXq|aR3 zwF&byyL>06;1)SWr5l_TnH;%n=he@wmhYw+P=dUVXAiDujXbuPrK7XHI0~{mzrE1+ z{c@-G)xL&If0;~WXzKz&KZbX&=yV&>+Q4s`&*v#O?0Pv=!;og`0JyE*-eh3KVsUqJd&$eqm54hpC~X;rpkJwWD+Y#>!Yo zzn^9FiDDfK%%WNsMck%7r5>1`#85Xm0;Q<7!P;V#n9xT+8!RcyyQmo@^#5hH=pPT$ z8Wh2{59#I^{rCC6hP%_$cxA_hn?l_yU*HlgHe@t}*Zr?VcS5l*^M*^yc6>gsulfb( ztK4d8DlqI(rD6h(^@mV$?JAbn_1Pp1f(?&qgUM`Z57Zs+FEU`aQR37Y-h?a^*hI(eWn|D2WW`s^1Hvuva0qHvp{Q?UeI9*A0JTaUU#N5y#_UB`uUs`k{S z(AmS`6>F|TX+@LEv-u%ziRTE{(;p&!+r7j|ttEO)96Yivn6p!MQ;)nJbWfPH<#N6p zlZ=NGn+z|%c1q(!zr`>eh`7?^@aa7qH z=ej$y=km5-@c0d>0v0@I-J`7{cJo{)_vg!<=ypC10X|*pWg#6Nh!Tqo1ST@Sw?_ji zZjvL??K7$`>VR3vsy$5!@gSqW$@0c zBRqzxggm+By2ZOjS*uv;=%wa12Dz@Z*xPnfq5$hX-;V<=Irz#!w_&}PeFfM@_fmt` z&OI_1YY^+2|G`awXh6sAZR_{NXt}ufuCkU~X{dwr7~%(hZi}PDUdRcmXwB0_txi<2 zsFsG-N|nnfxo4<&o@Ni#m=W`ijUxHG2LfKefrEK312v+C4;Mu9MqEDI*8soHUt!^| z;-e#ASjBBiMXim+uT`G74R~9Hksi%9tu`MV>O1*;xzInm`P^zUY*3(8`0Ets9y`QNk0>kXby9OyszOw40~gKybVS*}uB8MW7h4k);RAV<3f4Pr$1k zp`JSli(c&jYB1&RQ=tgWywba-<7SZs4A55qvI1deGPz`!_wdq2pZQdvSU9sU9XhM6 z9ria^3U(Fog`N|qEk`4@^A0C7+;&&1Ic@IK+}vEZ{wKpke-hiJEesFsjtq?bZ!O~2 zMgk7noaUj~e^y#k*6x@VC7yvDVA_UD3v*2!6T}qY`Wgw;;r?*zcNkqt{*R~OFr0MkE*cR^ zQ(tol37+ATGqM^_R>ir8^;LgfzpMUBQjp0+Zkth?%dvYGmeAAKrE%c%Fg-)v>ykU` zil9K35IchnZYzXVaFEKrITWQajxQ7H!TrnPGN9v z#?KM)mcopcJaxZ@JsR9XN1U8)qHN#aTQ|DIS!^t{>dW`sqg}0PrjY-DIORil1w=vI zOwy-hjJ)ufBW{@MU5xgoldUo$Hi=LFxglB2;6Dch13+|#V3PBBDb03E6acP7x2tsG z`v63b&h0@KX_oR@n`;x%97%-UJY?_f`~#y9fr3Si{=><5l#uYa(s;?->`dG>FE8op zI4US|SgwL#ht&NbKQ8Ap?x@Zlp32EnajZ)NMiRGCzLXBLjzf_ub}oHBBl({K4edP@ zCSnyNte~~p2CB|S)zp=xeTl&L&Xa@K_E`U&ngCXp~9c{MNBwB{9~}67KopU3E#~^=CaywaK_@rC*XO z8>&r1+_y<5{4jLqd~vZRXwdi^N-1#BKfvO2PT46>8cJ$p-r0 zIhUeWU0#2X_5oiek5!t;UOfCK+q;4M7^AIE1!vOXEo!xFNf+GvGz&vT>6CNS5yHeg z1gi%HEiZwI$TIas=-{0#*lqPQA}GQU|3hB!;}9a7GaR$tF~X*( zF@fhJx)*!(YHBS;FAj>q*wr^o6le2xS4WXX5!+9M`R=BM_Jz7r9}q*{dK@iu@QF~q zTH)&7ovj|-4)kj!Etd2FYRqk`aOqMRNM(Vd6-3zMp3G`(%aTG&(rA zb@42)37Pz`a5YgaaU@`k0bhT_j{df|0X|X61f|-hP9wT)cgI z1Tpkqh{&I}YEMhctWElnZ8BGDm}SZ2Br^eNI1J zfsT`k-nPRSb9^P_eQZIy!st7L$NX^YB3&1Qxwztas>N#Cg(=&pAU~k-_b5?6yXUp) z_U)wY`k8*qI2GwVWtG>h9jkETfa#1ElAFJ{n5EBHsW1og+i@!+hMbW>i*xGI@0Tj9PK+U#Wsu{5BtaPiSk>e=!53Dmn69VD@Xl|oRt1f{sY^R++L6ur zU%M-t;$atA+yzH=he($~x$7=1BzPK0BS<-dUc(KZaZAOS3U)KcX16EHCx&cC4jwu? zaorg1H*|>4-~Md2$$K>|`BPIem})d_`S|&}cHeUYT=5pXL-*nZa0QaXlf!7lKr18w zs9WHJmbOH|>DVwUJ?Y1RWaMl;p2xF!9j|sH3y}?>k@@F@M_{gK@BOmpdd%)XF;Mr7 zrhYfg_yNo*;u8@yG4eC-#5;EQI5r;-RPf#ooz9~FGS8pq(~LLm->q_PJ)K$0)ay2|}XZueYvy$KaHgq|QK@JiY^zc~=YzSSc zGv6~NIXqNBMGF2rb>ZA%I19`ybXmF|wH~HDojy1Eoe36}v5nb;hHcp~~lrHeu(qSaqDoQ6zoN^_#8JKnbUVA>y*)M}_ z>(OhmCcWCEP90-;$raetq(gIQ?N5<{9HA2`XLBzzxGH=)v~f5JS1Ljuw)b!^_IoWF z>jE;`1E5(a(1pl3aiX0js0saaa{jD!tYZ?u_&QVk7!%KEP6HR$ie#mn8`!;y&#F+G%7{W?BMa{JxppY-MrI)Ra2`4EC` z)vJ%&OWX7{tvG_`_W^WO+^xvp5P&+Tx|!bzv)=PZqU?Sd`@uK1r{;QHAFy@@O@-ui z?_Y(22E(&XIt!syQu4vV;-YH4fB#Y{5_uGXTqB$4csAR4A8sibBFQKIi*LklW+XPs z6D}i{W|Bi)1tXOJ3-*UJaFiUqcP5KlPcDATS0?IG=l?znAnftyCmQA_i*53rR!~*g zXCF>#=?zPfPd#jpYHP5|D;b9@HNB3nvq+C)OPp)_b9GOW(pKmc4BR^>bgT3M#vcN! zu4GzbbwZE4!Sa-UTkoYX=+Yn+VWUlU+Cu!y-0K%U=x2IUlrt^*=_O>o7K>E6cJ)5U z->(ta<3U`TJYQLftJ(>9*tmy9_qX?b~N zsG#`dA*z2LE#;Pqa54?5=@OAkvV%Kbd+xn7peiLL<;7g$pH zC;rd<`FJ?@Kd@m7Hg)$!h5Ymg}3^0=UgW4M)_Yh+H$?D z@$?ET3o@_NRo;z7NJ;+lg1qgf^_VjqLX>!%!+pC0DksWWL$7`e#m%K~7nB z3S#CdmdKkJz5>~uX+;-4KJ_fPx3sFc?%9DIy$#jNct05=pOL2v3Yrc!y@3^vBJ^(mch;F=4Ez4*2 zmrRY_k4D3Ztp-LywcfHYecM>QMZ)0M;R1YQ?z=@Y%ZL3NTN1*^>r_EPsu$}MY$k)PUP?ME!e=T3Dy8E_t zuZYO_LEkP5YFC;TZYX=Wn6|%QMW;eHExDvXB`j?zB*(aypXpSt4VLC+&f&_5Wj;Za?zs$ z4QxXs$<2gM<%`=+obAOLsYirJVmiV#vSzyky2MM6oZaaeUTpfBDZZ6v18=W5Hfa-ue$noWi%1arr7_;> z=27!i`(P+|1HtmJW_R57lK?I4#QXs}F(VPj=BW%DIA*a0FP0s>!>P_2ehxG3eNC?- zzx;8;JE`|29caud;z#cqIQFZXl+OGbTur0PRb?{>(ZkZ=_!voSsZ0kP=q|7oZ{WFm z>JtWI`}0c*h&hApJSN}StZKL8BzW9KAFqzIb2dCROqwkI=wkU&Ubqcbh~3Rd_S@%?o@Un^%NWeBavh%2J(*DD`k`Ecjzac%*j%KjO>aOcJ7h z$otxZR*O4f>qn=`Q{DJy&^quaRe}m%lPiwOY=OoUB_Io<4tG#~xsgiSC>C!;yrpW& z=_82@aqWIm0!o(j1V~ItY1}GD(DOBd0t@szo8MKPwRJx~ zAV|K+l|g{Mo{GBY=7!-x=i|I`1jckof@MK$qROQtA=jkSl?1djU^|lE6vOK!+iSw z;HUvL$;wu0Ju}n(r@tS2E0xMOjB0q*7zlxKAPgLQT}3kR4Ia5#PDQ1w`@|!+k4;ep zWCY!_gL8xbY|b&gUKwMTadODeFMbrb!@EOIk!FaC^d;DIbjjM$QG12fLkax~6X8wy zK}h!xsEPH?U`cVY(dLC03vGm5O3jqr*TeEEyYPVkjo2vJjY6^kHQE2unSp85r!E4$ z;7K|k5*#jn|B2wM-hk)#z%tfE(sLpTEJTiGnbRM9%Vsf?(Jaq0NjzLn^+8cLvq zR#q~lkMLMz=w(Mtq%deCMMp&)5<`Yn0|48S&&ki%7>la-__U^UspaS`EOZ41#>W|2 zUM9__e#yo5hkEa3;&+%+_=6#GreIpF*U0$zEvZ_$U|E44O| z7s#t$n-qOfG>nt|FT2Q&2qvPxA?{Dxhzr(T; zANZltvNCUGFuJ4GaJ5`{?;v@g-^U=ggR3b8*7t$iLx~3gU4ifuR~Tk~fo$MqZ4C`h z^SR2;9iYOf+!S{60k`s+nn0=7g zue;NgrlHZNiNM$Cro6n3DpmS=4ei`TF^Zp!jg7Y(Gzw{M1o7_K_ZL(iXb22yL38;c7r zzQ4m)gh~QnKS>g!X@(sS_ZyvrYu`De(w7bVg;wc17sND!tDrfH$H8Y-u@m(5^xLAMC1K@6)jlI1eFFxwaVw>lg6Z1c*0}9Ed-iYQXLm=-$@-{D# z-+YS|1uPY27Pvqt-Q#lBafcZ?LXo|82Akcx!lxVfDt$@ z19>w#B4og#b4#FOkoaSchO#du94^&=fK5?cTYHYUzrWv@hL%?OYuic)^P>0xMc*Nu z06M6!xENa4c(L9cQd7&+_PXTM<*()d_-W=i2?4NK=hJB$nu^dxUp4TAjN1nZ0ngKA z9cI4?sIU|Idx3ht{wRVfk`hUO{}-NA6BQsgVcdbQ&*K12)Qo-Su4qfdK+Tw$(d5p$ zzgr9Js&8p|5Cx*sN0E8Oecmv=EY*er`~GAvH?Y&>cMx0-FqOsd7kWyAn+>GnnpUtd zKxN-W{2#CX%NqXCH0J4Y!ISUrX!@=r^?~}JPS4BT{RUH4sEmY!q?3f>i|oT(m3|2I z1s*Q$ubG~T^72N~BEwF<2PzO;g98x$)O2+5EiboA^RMT# z|J%soWwf@h0V=u00JHr#2Kq(2$jbH)wifVoB5pnNUd+tEVA;JFg27l(St&G6&niDy zWGIwh)6$Y@E!|D2sj>_7Q=lMp-Z;>|ztjH-`gc6r6nBDeE5`Gzc`NQq1yT|&I+A%~ zlna1|1jtxqOk5FZZp+St%)lspqL^Z$1_63Rl(<1nO-q|Qv}8p)2YJO0nwQ}e6&HKF z`Q5hSxN;4EmcRSe?)XEu$=7ggV5x74-1oSa5hc2Dd4J7&FQ->~Ix53<42Vx?i~rMY zmPB4cF)t7Wk0(uQA|u6yDIW5Qh`ncbXX%zBN@rf5EZuR&54uWwdq3<05Ua+ltf!|J2x=eQQLh`PSsa58N>joTIv3;VWg8q4 z$@!8yW-*$^T~Rch-_qhO#|AcFe5wQNe94A3|nVh zTwLYk7lkt#{-}sDljEhPGops`zP`T6ot+(DPEO7SLbt@b7T3Mk`{TL^q`Zt(3otDU3(FttpGkldzVCaqsqg{)mtoTV zDaL6gA<=6&$ujGx3nVTlh|R1o!czqHe8ug#;;w@d1xZUxbPfbO@};ygcW8Wk1#6uE zyfs4rJ)0?;HUv665lIK-bNQ3a{~ZV5xnlYSF&lF;9~#{@4~L(%wY7cndLgxM<+x%7 z*zSQroJOpj@pd#1?YLb0hgB57gx;G^*TtS|{!RFxwZDJQvyA!@Kgbj>``@iR0Su<2 zCnaG~Nl8OvL5*^#V8VFa&LL+#Iy(9}eRMXQqOEwgLMKpGouz0C2d#VEf_yB4eT$*$ z6DM?!^dv2BCqLT!?bI-gzPtkk|PH0K#O*6yiU;pf!R(z=>j#i&QqMq8`mv`Bs;e9cYxIL}diPPFLET{)~+H zXneH0-k%h_J6kgbxlgW7Pfz2)ou?amEZh<>YG;$9Am}l}>-^ond+J&SqVz<+(S9;J zPTOtPjkIRzWH%S!SQgtQ@w~s3AbLhd-$no(@%Cq4&Nq5_0a)&=UM|$(DKhUq7s7%> zj%cS*|2cmK067&ayT7LERp1v8r6Z1^3r)5S zK8@P|QF2~hUP633R;vMhlgep1c7Jw#Fntuu;d4DHlkC)X(%5})a6soJ1dS1+Q1##c zn}=aO5c63_Tf4Yb_3-6x?abvr%HO~7nSS$4OanmNxe1Y{;}U?WOZ136hm&YlCWNjO zdHDHT1VIQP-Kys1TTlRf99ypb2=cnVqhsxLH2(tn0jRUu?d@&kRMNZS1oI$L}}?bdWs| zB18X46Jq=)=-$I(ety1)l$6xX#~u2+w(qgsA}LR#9bQ<5SH zDe0PuqGG!QP9+VlC89b>&itTg8HPW#AeZtKYUDKY<3y)ZiSq^gr6C_>> z)Lbo~LKU8%RT4EuI8D$w+&Me?R^4Y7P>?BDa3O(Hh?R)&FtP~E&m$`JkO6=j@-}%5 zdd%Nf&-9=IP)tMStO2M9y*EYgC!AOcqPZ8e;HGa1G3|%}$G;m4O~;^+dHxbj&i%1Z zg*b?V$xszXxPbmW4s`Dd4qyD~&^A>b6b4+K@e@%j1;O0QNF-lZ1!yJyoq{KLGC!u} zr_q5tieoB`Md3T)h?O`q5PX4wCV$YIq*HlK1c`l*zDg+dO6vYw$hsUpXb3sMQM4DO z94-Y!Ukn|D5eiKZ!8h{`^mh)iDSk6T7zFxflr@8=K!iQ3(bH*yBCdw=^unaREB>|O zqnRdI5yrZ=2z+oj@kvD$;SR`!7*eLbw4Y&uK4C}n->6z|Qhu_4#ih_dirl&XaH4*? zeKI9YRf?n%n%D!;hh6!5)oH!~_p>Qxx`ccPW*4e4oCUtidQPL~yNO#+l)3cM^qx#6HZk#sCB5ToD z6l{A20tZ*5Zb7H?8+?c9zU7{(4R4x=72PmmOA{|6%rurECp!uH#`8~m;+k6e;c8M7 z=Cc!|%oZZ%&${>q+&%JBtN9N6X{e5|SOPa=vU1V~Gss`N4_<&4-g5@{tgp-R>b*Wm z?s5pT4AM{dX#B2}ibQ3Y>#B>a)OD0C8c|HqVSV~{Ymv{UE!xT9Rw_)MawwJ(e$yp- zglLh@tnE=rtp5M|L}jdLz43&2Y|G5_zHY=3lQv1eIZF#6i0!7>E z%s}`5Nl#_?`qLohy~n5fz^r_Bd2RvUmp-8Ix#?gq7Ep$^_LE*;JcoRAz9^tQdeaChFRPBK22eNQHP+j62ka$dpoI6 zlc6TKo`A&L-rsmWTUAeIl3IrE<-49%%d4sm%S87X&}luWYZJf<$l`)Xn=VcYcG&Wr z*Lh!8#Wjx?$Z?GLoG4NEm?anHqQ2@%yKu;tD1Y*C!39yk!gQz_vrK+i*YSt$tfn1i ziZT&}@y34gXsV1j@5vhYabC1Btw7LQrl(H* zegd7522S_Q`p1j9J~J|pOv<@$Q=JU;-`PI!6N9Ko)X!L$yXxAcd43*Oe?C{rin`vW z)|{XHaMw*$k*@|W-~u7wfUqfJQlIn!bdF>3$D%r(5}!T4&OGoaEeZ_&jcETghdaRyXo6)6#Kj+m2+1&7@ef$ zT`IT$TjyZMu4132Qb{y7jkpLabUl%UT@gyh$fP(_q5G<9HMmzz0lQztxqLX&4M^2g z+yS7_L9rvK1X8RYz>L@pZ;^{+3{xrVhOp=3DSf7_DG^F1w~xR@AlKmroRB~TZ5U`b z$u3c_NS4!3IoCc#Ip+-sFxFsc{+S8&Z!W}O}x zQ9!C)uO@p$R$Z`{QNks1(gRMjA!xGKmtw?8Y>yf74@NV-9pU2aj}Q9_O&(~7p^g#T zMwj1c53AbT%}!X6m!xJb@FdDpNaMWt1gzT5XgH)5{#A5D*p6BgsgE@QiRWA{mD)$4 zZfcf0e7rr4-|w}ert7_%mfp_(E9l4l-aYQoUiS3&Yw5o>a@Q^c0`^g}V1s%C>RFs( zb%*2?Zbmc3;__t!&rqly-|4#ljZBXy zan5pFYT9^jNQst=M7DGp5MK+1%A9?5Fy0nOlp9VLxgX($bc6w!IdsoLOoOF}jwTJ5 zdHl8QtRxo4j!Q8K?L+t1Qs_gkOQPVHfl_gWXKbO|hnaUHwilRpw{lQQxPG5cepg5~~I+vWGLLlmYD=}Ay`A-+?9hB(P z%;)hz@c-zejM;rg{QhK;nCeVau`Mr}5(0f_tV`>o#2p?5;$I3Rf%C*L{|ru(Vy9h- zR0Qk>`2S$TaTth#lS)S}g+>YI7|w(5VN+!qJu695Wmx|{SJ}3D9mqt7Q!2jjIo}!Z zgr3Uq>k*c3zoEw|(cMXj+R+Y^lHR|P+EVUxL!Tg(BEOq={JQP92iTFm+4f7box0am z#!zQ~!+Uw1z%|>dU`g{j(c|(845~LMHK;*^W{je3Z9 zB%}pfd5+pPFtu;LMmAq&b2_A}c};`A7ziu7wi&RwIHVJ1s)RAwQ$Y4CB0LjEbmDj6 z>G7o`QOKdZ%6{dwehD*l)flx;ZZ!tI;1o;+X?gXEpXG}_GM8y-dQHePhlSdnjIs)Q z4cG`08SkABzwssUZb*EAPlvK;GB7ggKd03Uj3KL1EnbI%MRg2D6P>32tO8lBWTg-% z;-b9o(46GF{0_T?sL+3buN$ypM8BkM)6CJ}r*GlK-_nOz zayM9>%L_T8o8@h@)9!Qe`9O`;JM7Cc)xYy^#70w&ZRGFNevu2K=H)P9mv4c^dntxv z(a-!c1w!)3kS~_hfx3>mnl61eD4Fxm?>i4PdZSwb*6IP0>q~@=o{hJ=@3$|Oh1&|o zx|$<>H#Ffy9g)inQX5i+0O=(N{tzwiYn2<_iA}JS%kGq8lsOI;~>@b@?4WM$v75kZ6yWj7^;`HhUS{0|ng^dJXpu(Q<2t z*rMpbP*GOU7`iy>E62eR8{U2uDTiqNgp9B0NGdtlG4{xpKmN(Aa=RnovP!h#RG7>e zjL+r(i14A!j%fROn8yVsmliHyr1IbC+G?+7UEp+QE>FJMnFxTaY=?isjt)XiQY11? zN>%ILG6$Q+Z+N$0GQW;^{3eO=|A@VXET>?mX7Jdud-w<74Cilr(@BCwL)ODyh@WZ+ zBAkV3YU#n;;;!yi9`j6FBYsDY_ z8Z?{_*C`4g4O@W=Fi!K-MG!tS`we(q`YIL)YQZtGazs(T2UJ_%X}F8Gu9M`R6muv2 zwww*=;-Q?qvdO@0K{3<=5#HK6QZ$U8FS5lWqUT7d?{G{w18R$9%#R>FUSUz zSgWUdnnRUXw_T6B@|m+I>PJ&)gftfV{`2tI+*89=fRNRMKJ7#Hg*#P0(Ev1v zbCV(zgE~zpJw@8HQmPg4>ae}QGp)mC0^iS%y7cS3yw#`j(Ys)Qx12zaeng&R5D-c| zKo;^oNjHdF1Z|u0Ip1`0_&wd9w^K<4nZ72A;Xg4jM zNe2cZ2OgcjQ;0O1Q}CNUBWtIYM8l&T{~d=Ai$tKfsk4C&irF`$Yt??7vjUZ^_f58o(&gHfLzL__e!wineK@T)0)@paBEXGSzB#=ah<1;IiY! zmDos2i4hFLl%f4xfhz&ziZ(gR(gp3Vo}x{DG?!&!wW@FK%7IgWNiv{<^JN*rWtlX_z5f*hl6h@6&L5{Z_F z?>b2}B$sD+UNKsp%UKCw<)sh8v}u`Y!xq+bD4)V*hU2MVbX>&uuoffwGYjPa3P`3- zZOxKsAv`7`X7$vXI+dfGC21`f033RxzmjSI*;u-uO58DJs>&v8%aMKT?z|!_T~KH< z4@x_L=lOgH%axtJC!-QTA;T~wCTs!VuwY0CPscArlcG}>UIbNZR z95^cuN-D8*LAJwrQrZ}v=SM*p)3Up6XfA+KhG9(4o<&tKBm~dev3gpWB_tCJ0OH-J z>n$3nhcqf2i{~5;A|1@3bWFtViuB2b_IV}m{`zdK*hGv3Lr%-v0CQoYo+RB4J;((^ zFw)7Dnz3fGxNwX@q1Zq!8v23(IK5;%R?sEj6pBO01;hA>TSCL@NRJq!VnLxq3DQUO z6`*5?#$4FD{g^_b=wRF>k<-4rC)Bf`P@;gjE{PnWK~8qo97mW;#ezbKKIS|O31P~$ z6fu4UoC=i??y#d%rxZ$*FgHu0M|4(%l2Qbq*vvY33WZ`G=L7?g?ma0)?8Y|cqUGJK z6bdEEI4c+uf^ZZ-xU1CZH=b2Pc%DTu6$%O^wnRrT}Dr%))) z5PiXrBX}Ot&1Kopeoa7y_|d-2okF3+oY)Emg+l4jSYL-hp-}#(p@Ko7P>A`T6AYGR z2eK@i+17SYC>@diDZyY_b|i#B)vw#y77C>!@;@aQ5N2Tjpg+s9$!%!}h0+nx6%3YT z?`K(dLadC50b9gx2EcJ`X$XbV5z!P3mSy_^cpkucu`?&Sa2(eRK)Uy&OIzAPp>#y_ zJd88N?>}Q|nm5OacA>28;1i&-^ZnTWW1jO$e=dGqtj&Ah2B$8l+)Hbp# zI}ku$j^h@{!aM*HIF75;%9Lf<1OWE{7!Kfbj^kcXiQ|Rva$1IE+0QwS+sm@-0|0IU zFp}fAodBK_^8kRmAc%v+GXM?%xE8=|VwiF)X0Miw6zk0Hb(Q?xxn@~%$M(geoV17H zEP8^`YV1OsIoSrFJAm&2Yyhxe(4aw#%jH@O;4%PimSr0Nd;wqr$8q~)>3c!wCS;32 zLjbfA436XcEXytdFd9IvxH5CPxH*qy+4%q_$&wr|E29&DvjDsapdWyz0PF*>QjF3B zUp-PEyr=aIF4)7*)NpnP~O%CQ0x(Ld%M`BcoM>s!Q*A| zCIHA1w_OF`0|0RVngMj>I4f&$Z=eMmSuMU=qZM00r&{OATiEj08eoow@H?7 z9DrUN$Ng@3uTeCa-Rmk|5mXIfIex(%+ZUJ3?sZim^q&KJ{2kjDSI7fcmMwaU55o%v8CJW!Vh0JRwec$kP%4#T>`^#5g(P|GA31asU*I<(G(g6+?Jv zR62x*Ka~O~l-hKVvg`{0mO=0^ zZiLYNkPNyEz;mKl^oHO$NaeTkGB}Q_2GA&$u}Yj4{T@Iv1dl@UI`)g-Cy6J|*<$%Y z0238r;R3(`*ut{xQL`Yeos$ls3p#3cudDJQG!Q+qRl;&0oWO;$PX>TLSeDIK#8XSJ zw#^5jk&WUwj)8E2D+91nY_Jf^xImtXcrN<@RLB~zPqJOiD<8rIPTmNmyySI|L?#?h ztWPO~2F-~16#yt;S+)e~6o_?Gdx@9YzAFZhFN%qlZ9cKgGEoo#M2=y+3c=l92HfEgUe1tFXi zr$QLetpp`j^oDRUkAiSATA@O^@{9ObmaPC#%(85${0eP^cty?tkRzoNzYAqocb`f+ zNh}IwSLa*+138WhU&T3&^RX;j2*Jb6m*=6V1H^W<7(xTi2JjYuq4IcQez^cDSeDI~ zdm1dujuPvV51@o)*$kC^q1<=!a>F8{5~mcRcL?#gxx@{9AdCy_2QXUf?++8xWsBd^ z%!eCd1LipHTaM%Quq=BigoeKcf(O!1jCX~Y<}3(Zi@^{Yxa46-V;ow`w3Ec|rQ-KH z05$`d#&Mi9izCg_Op#p~3IKcs!E>1ops#4}K>+6f=)-Z`4vjJ?&QlKIJSv9bifsp} z(LxX+GmL`JooFR89LMEy9M>v8nOGFa$_2#90fnanj^j#2?|=kp=|Vn$a%IC6^Q(g3 z>E|mpkq0tko=9URBiL2Uf8N`1z% z>@xrcK$x`w$8q%lE?`;qGyqK;$8C|tU#n3TC3@uEv3+qBfSlRAuF8RM;tzBv?=on2 zL$r|GZz9ACQ7Iz3Apii5X8vN5`C=S--KBwK>GL95k8`M%Sqklapjsv%dKetXeIu^o zj0=TA8`rO2&x_$r03MeWbct53Vw#ACFLqs&-4{7M#cwsQg>v+e4xn^)ud7NS^qVu# zGRvx zmp@0o210D~YU>-+>X8FsokgkWnM4dUit+Nrcv5&ifF&w38x;WVRnDfUU^uHJ+9EHr zWm>h3`uc;#?`>^RHYIi}fpFrD6+f$>JzG+t5uUGDA2ASuSjeXZOJviJB@h}#wpivk zNm#^b%5f077o*T}g&zfB#-T*3A{@t6iD}kLECO?isAX9ry!kMWf0a)R4C$=hz&$q z$5000DqkjxR)&^aB;;w!Se6|m*~D>NfjGb^").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
      a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
      "+""+"
      ",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
      t
      ",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
      ",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( -a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
      ","
      "]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f -.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
      ").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/www/js/libs/modernizr-2.5.3.min.js b/www/js/libs/modernizr-2.5.3.min.js deleted file mode 100755 index 10ac67de11..0000000000 --- a/www/js/libs/modernizr-2.5.3.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/* Modernizr 2.5.3 (Custom Build) | MIT & BSD - * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load - */ -;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function L(){e.input=function(c){for(var d=0,e=c.length;d",a,""].join(""),k.id=h,m.innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e});var K=function(c,d){var f=c.join(""),g=d.length;y(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch||(j.touch&&j.touch.offsetTop)===9,e.csstransforms3d=(j.csstransforms3d&&j.csstransforms3d.offsetLeft)===9&&j.csstransforms3d.offsetHeight===3,e.generatedcontent=(j.generatedcontent&&j.generatedcontent.offsetHeight)>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",n.join("touch-enabled),("),h,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",n.join("transform-3d),("),h,")","{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join(""),['#generatedcontent:after{content:"',l,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);s.flexbox=function(){return J("flexOrder")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){try{var d=b.createElement("canvas"),e;e=!(!a.WebGLRenderingContext||!d.getContext("experimental-webgl")&&!d.getContext("webgl")),d=c}catch(f){e=!1}return e},s.touch=function(){return e.touch},s.geolocation=function(){return!!navigator.geolocation},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){for(var b=-1,c=p.length;++b",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f Date: Fri, 27 Jul 2012 13:28:15 +0200 Subject: [PATCH 057/248] get rid of jquery-ui, not used anymore --- libs/jquery-ui/jquery-ui.js | 25 ------------------------- test/jquery.gridder.html | 1 - 2 files changed, 26 deletions(-) delete mode 100644 libs/jquery-ui/jquery-ui.js diff --git a/libs/jquery-ui/jquery-ui.js b/libs/jquery-ui/jquery-ui.js deleted file mode 100644 index 72e5907fd4..0000000000 --- a/libs/jquery-ui/jquery-ui.js +++ /dev/null @@ -1,25 +0,0 @@ -/*! jQuery UI - v1.8.21 - 2012-06-05 -* https://github.com/jquery/jquery-ui -* Includes: jquery.ui.core.js -* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ -(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.21",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 -* https://github.com/jquery/jquery-ui -* Includes: jquery.ui.position.js -* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ -(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);;/*! jQuery UI - v1.8.21 - 2012-06-05 -* https://github.com/jquery/jquery-ui -* Includes: jquery.ui.draggable.js -* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */ -(function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('
      ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.lefth[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.toph[3]?j-this.offset.click.toph[2]?k-this.offset.click.left=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f
      ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b+c:-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b+c:d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b+c:-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){return(b/=e/2)<1?d/2*b*b*b*b*b+c:d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){return b==0?c:b==e?c+d:(b/=e/2)<1?d/2*Math.pow(2,10*(b-1))+c:d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){return(b/=e/2)<1?-d/2*(Math.sqrt(1-b*b)-1)+c:d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h - From f4e425ced25790966ea633283660c464b58b68df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:29:07 +0200 Subject: [PATCH 058/248] switch to using the MIT license exclusively --- LICENSE | 19 +++++++++++++++++++ package.json | 6 +----- src/jquery.collision.js | 2 +- src/jquery.coords.js | 2 +- src/jquery.draggable.js | 2 +- src/jquery.gridster.js | 2 +- 6 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..869f81f5b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Ducksboard + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/package.json b/package.json index a361d54ca3..d6ce85e3c9 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,7 @@ "licenses": [ { "type": "MIT", - "url": "https://github.com/ducksboard/gridster.js/blob/master/LICENSE-MIT" - }, - { - "type": "GPL", - "url": "https://github.com/ducksboard/gridster.js/blob/master/LICENSE-GPL" + "url": "https://github.com/ducksboard/gridster.js/blob/master/LICENSE" } ], "dependencies": { diff --git a/src/jquery.collision.js b/src/jquery.collision.js index e1b7ae6449..5d37c614f8 100644 --- a/src/jquery.collision.js +++ b/src/jquery.collision.js @@ -3,7 +3,7 @@ * https://github.com/ducksboard/gridster.js * * Copyright (c) 2012 ducksboard - * Licensed under the MIT, GPL licenses. + * Licensed under the MIT licenses. */ ;(function($, window, document, undefined){ diff --git a/src/jquery.coords.js b/src/jquery.coords.js index 16edf47ec7..e3bd5e65d1 100644 --- a/src/jquery.coords.js +++ b/src/jquery.coords.js @@ -3,7 +3,7 @@ * https://github.com/ducksboard/gridster.js * * Copyright (c) 2012 ducksboard - * Licensed under the MIT, GPL licenses. + * Licensed under the MIT licenses. */ ;(function($, window, document, undefined){ diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 6b65d3c990..3a3d49eb61 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -3,7 +3,7 @@ * https://github.com/ducksboard/gridster.js * * Copyright (c) 2012 ducksboard - * Licensed under the MIT, GPL licenses. + * Licensed under the MIT licenses. */ ;(function($, window, document, undefined){ diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index bf6d789737..983b263523 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -3,7 +3,7 @@ * https://github.com/ducksboard/gridster.js * * Copyright (c) 2012 ducksboard - * Licensed under the MIT, GPL licenses. + * Licensed under the MIT licenses. */ ;(function($, window, document, undefined) { From ec60bde4df6805b204490f5947ee1021b22d4463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:29:31 +0200 Subject: [PATCH 059/248] make the description more descriptive --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6ce85e3c9..61c63ce041 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jquery.gridster", "title": "gridster.js", - "description": "Put a grid in your life", + "description": "gridster.js, a drag-and-drop multi-column jQuery grid plugin", "version": "0.1.0", "homepage": "https://github.com/ducksboard/gridster.js", "author": { From d84de52886379f62d856804d8d720084ae12bf55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:29:42 +0200 Subject: [PATCH 060/248] update .gitignore --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 51102461ca..784f0ac67a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -demo/ node_modules/ -LICENSE-GPL -LICENSE-MIT -README.md +gh-pages/ From 74cc7c49a90e26c21a12b7c74a81a2257c89dd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:29:50 +0200 Subject: [PATCH 061/248] generated dist --- dist/jquery.gridster.css | 4 ++-- dist/jquery.gridster.js | 4 ++-- dist/jquery.gridster.min.css | 4 ++-- dist/jquery.gridster.min.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index 9c03f7954a..e0d4b3a3e0 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,6 +1,6 @@ -/*! gridster.js - v0.1.0 - 2012-07-26 +/*! gridster.js - v0.1.0 - 2012-07-27 * https://github.com/ducksboard/gridster.js -* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ +* Copyright (c) 2012 ducksboard; Licensed MIT */ .gridster { position:relative; diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 2507a371cb..1d87accb59 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,6 +1,6 @@ -/*! gridster.js - v0.1.0 - 2012-07-26 +/*! gridster.js - v0.1.0 - 2012-07-27 * https://github.com/ducksboard/gridster.js -* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ +* Copyright (c) 2012 ducksboard; Licensed MIT */ ;(function($, window, document, undefined){ /** diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index 1d2dde3d55..b1d3872879 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ -/*! gridster.js - v0.1.0 - 2012-07-26 +/*! gridster.js - v0.1.0 - 2012-07-27 * https://github.com/ducksboard/gridster.js -* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file +* Copyright (c) 2012 ducksboard; Licensed MIT */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 6221e40c43..d1cba6b9e9 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-26 +/*! gridster.js - v0.1.0 - 2012-07-27 * https://github.com/ducksboard/gridster.js -* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */ +* Copyright (c) 2012 ducksboard; Licensed MIT */ (function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 5006689badf922c0a5f09e75ac8e601d97646d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:40:56 +0200 Subject: [PATCH 062/248] add a simple README file --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000000..689f1d4939 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +Gridster.js +=========== + +Gridster is a jQuery plugin that makes building intuitive draggable +layouts from elements spanning multiple columns. You can even +dynamically add and remove elements from the grid. + +More at [http://gridster.net/](http://gridster.net/). + +License +======= + +Distributed under the MIT license. + +Whodunit +======== + +Gridster is built by [Ducksboard](http://ducksboard.com/). From 817c9936ad87234aadd7b2e652db7561e60c4364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:51:10 +0200 Subject: [PATCH 063/248] change homepage url and description --- grunt.js | 8 ++++---- package.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/grunt.js b/grunt.js index 897aa29473..60241db807 100644 --- a/grunt.js +++ b/grunt.js @@ -65,10 +65,10 @@ module.exports = function(grunt) { uglify: {}, yuidoc: { compile: { - "name": '<%= pkg.title || pkg.name %>', - "description": '<%= pkg.description %>', - "version": '<%= pkg.version %>', - "url": '<%= pkg.homepage %>', + "name": 'gridster.js', + "description": 'gridster.js, a drag-and-drop multi-column jQuery grid plugin', + "version": '0.1.0', + "url": 'http://gridster.net/', "logo": 'http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png', options: { paths: "src/", diff --git a/package.json b/package.json index 61c63ce041..23d8d1802e 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "jquery.gridster", "title": "gridster.js", - "description": "gridster.js, a drag-and-drop multi-column jQuery grid plugin", + "description": "a drag-and-drop multi-column jQuery grid plugin", "version": "0.1.0", - "homepage": "https://github.com/ducksboard/gridster.js", + "homepage": "http://gridster.net/", "author": { "name": "ducksboard", "email": "hackers@ducksboard.com" From 698bc9c5f1a4095384b0bfa3618128f83def8468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Urba=C5=84ski?= Date: Fri, 27 Jul 2012 13:51:15 +0200 Subject: [PATCH 064/248] generated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 2 +- dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index e0d4b3a3e0..e233b4bcce 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,5 +1,5 @@ /*! gridster.js - v0.1.0 - 2012-07-27 -* https://github.com/ducksboard/gridster.js +* http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ .gridster { diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 1d87accb59..f6328fc226 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,5 +1,5 @@ /*! gridster.js - v0.1.0 - 2012-07-27 -* https://github.com/ducksboard/gridster.js +* http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ ;(function($, window, document, undefined){ diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index b1d3872879..b7241c1567 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ /*! gridster.js - v0.1.0 - 2012-07-27 -* https://github.com/ducksboard/gridster.js +* http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index d1cba6b9e9..ed25cea5ab 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-27 -* https://github.com/ducksboard/gridster.js +* http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ (function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 6972f9fb333af9ac1ef645347272beb4491b6d9b Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 27 Jul 2012 17:55:04 +0200 Subject: [PATCH 065/248] recalculate grid height when a widget is removed --- src/jquery.gridster.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 983b263523..3967412f60 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -227,6 +227,8 @@ this.move_widget_up( $(widget), wgd.size_y ); }, this)); + this.set_dom_grid_height(); + if (callback) { callback.call(this, el); } From dffdc794c71278773b3831243359af4b20a5acbd Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 27 Jul 2012 17:56:15 +0200 Subject: [PATCH 066/248] generated dist --- dist/jquery.gridster.js | 2 ++ dist/jquery.gridster.min.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index f6328fc226..e805a43d11 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -891,6 +891,8 @@ this.move_widget_up( $(widget), wgd.size_y ); }, this)); + this.set_dom_grid_height(); + if (callback) { callback.call(this, el); } diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index ed25cea5ab..47190fcdff 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-27 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 07784bc1a0e9c769d515e20a87b9f352fed83adb Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 30 Jul 2012 12:49:28 +0200 Subject: [PATCH 067/248] updated grunt config to generate a copy of dist/ inside gh-pages --- grunt.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/grunt.js b/grunt.js index 60241db807..ec02ba8a7d 100644 --- a/grunt.js +++ b/grunt.js @@ -19,18 +19,33 @@ module.exports = function(grunt) { dist_css: { src: ['', 'src/<%= pkg.name %>.css'], dest: 'dist/<%= pkg.name %>.css' + }, + + dist_demo_js: { + src: ['', '', '', 'src/utils.js', '', '.js>'], + dest: 'gh-pages/dist/<%= pkg.name %>.js' + }, + dist_demo_css: { + src: ['', 'src/<%= pkg.name %>.css'], + dest: 'gh-pages/dist/<%= pkg.name %>.css' } }, min: { dist: { src: ['', ''], dest: 'dist/<%= pkg.name %>.min.js' + }, + + dist_demo: { + src: ['', ''], + dest: 'gh-pages/dist/<%= pkg.name %>.min.js' } }, mincss: { compress: { files: { - "dist/<%= pkg.name %>.min.css": ["dist/<%= pkg.name %>.css"] + "dist/<%= pkg.name %>.min.css": ["dist/<%= pkg.name %>.css"], + "gh-pages/dist/<%= pkg.name %>.min.css": ["dist/<%= pkg.name %>.css"] } } }, From d6d3c67ea41caf002a3a4e92a817463d562365a6 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 30 Jul 2012 12:49:42 +0200 Subject: [PATCH 068/248] updated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 2 +- dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index e233b4bcce..9b6903c486 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-27 +/*! gridster.js - v0.1.0 - 2012-07-30 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index e805a43d11..e689eafb70 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-27 +/*! gridster.js - v0.1.0 - 2012-07-30 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index b7241c1567..e920e1f743 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ -/*! gridster.js - v0.1.0 - 2012-07-27 +/*! gridster.js - v0.1.0 - 2012-07-30 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 47190fcdff..802d2bf913 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-27 +/*! gridster.js - v0.1.0 - 2012-07-30 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ (function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 4048784eaf77b35cda3845b08f38ecb0005b87ef Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 30 Jul 2012 21:17:03 +0200 Subject: [PATCH 069/248] Forcing conversion to arrays before calling Math.max --- src/jquery.gridster.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 3967412f60..625d74bd56 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -2145,12 +2145,14 @@ var actual_cols = this.$widgets.map(function() { return $(this).attr('data-col'); }); + actual_cols = Array.prototype.slice.call(actual_cols, 0); //needed to pass tests with phantomjs actual_cols.length || (actual_cols = [0]); var actual_rows = this.$widgets.map(function() { return $(this).attr('data-row'); }); + actual_rows = Array.prototype.slice.call(actual_rows, 0); //needed to pass tests with phantomjs actual_rows.length || (actual_rows = [0]); From c03a11eed83e697ae7522e78312bc7991f8b944f Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 30 Jul 2012 21:18:43 +0200 Subject: [PATCH 070/248] updated dist --- dist/jquery.gridster.js | 2 ++ dist/jquery.gridster.min.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index e689eafb70..c8b9e5e1b1 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -2809,12 +2809,14 @@ var actual_cols = this.$widgets.map(function() { return $(this).attr('data-col'); }); + actual_cols = Array.prototype.slice.call(actual_cols, 0); //needed to pass tests with phantomjs actual_cols.length || (actual_cols = [0]); var actual_rows = this.$widgets.map(function() { return $(this).attr('data-row'); }); + actual_rows = Array.prototype.slice.call(actual_rows, 0); //needed to pass tests with phantomjs actual_rows.length || (actual_rows = [0]); diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 802d2bf913..50b11faec6 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ /*! gridster.js - v0.1.0 - 2012-07-30 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g=Array.prototype.slice.call(g,0),g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h=Array.prototype.slice.call(h,0),h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From 9987989c8c8d94099427285ec97035b42c0e8acc Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 3 Aug 2012 16:45:49 +0200 Subject: [PATCH 071/248] Caching $(document.body) once document is ready. Fixes #10. --- src/jquery.draggable.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 3a3d49eb61..262b9af959 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -19,7 +19,6 @@ // stop : function(e){} }; - var $body = $(document.body); var $window = $(window); @@ -51,6 +50,7 @@ */ function Draggable(el, options) { this.options = $.extend({}, defaults, options); + this.$body = $(document.body); this.$container = $(el); this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; @@ -164,7 +164,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; - $body.on('mousemove.draggable', function(mme){ + this.$body.on('mousemove.draggable', function(mme){ var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs( @@ -279,9 +279,9 @@ this.$container.on('mousedown.draggable', this.options.items, $.proxy( this.drag_handler, this)); - $body.on('mouseup.draggable', $.proxy(function(e) { + this.$body.on('mouseup.draggable', $.proxy(function(e) { this.is_dragging = false; - $body.off('mousemove.draggable'); + this.$body.off('mousemove.draggable'); if (this.drag_start) { this.on_dragstop(e); } @@ -291,7 +291,7 @@ fn.disable = function(){ this.$container.off('mousedown.draggable'); - $body.off('mouseup.draggable'); + this.$body.off('mouseup.draggable'); }; From 39a473cedf203326e79219d0d5ce09be97e96c95 Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 3 Aug 2012 23:49:46 +0200 Subject: [PATCH 072/248] Doing form elements inside widgets clickable. Fixes #7. --- src/jquery.draggable.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 262b9af959..1a15c5652b 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -152,10 +152,16 @@ fn.drag_handler = function(e) { + var node = e.target.nodeName; + if (e.which !== 1) { - return false; + return; } + if (node === 'INPUT' || node === 'TEXTAREA' || node === 'SELECT') { + return; + }; + var self = this; var first = true; this.$player = $(e.currentTarget); @@ -188,10 +194,7 @@ } return false; - }); - - return false; }; From 9bf0283a1fbfedea1774b09157c9dae83fb4d901 Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 3 Aug 2012 23:51:55 +0200 Subject: [PATCH 073/248] updated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index 9b6903c486..1b2d552d93 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-30 +/*! gridster.js - v0.1.0 - 2012-08-03 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index c8b9e5e1b1..38c9b5f366 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-30 +/*! gridster.js - v0.1.0 - 2012-08-03 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ @@ -375,7 +375,6 @@ // stop : function(e){} }; - var $body = $(document.body); var $window = $(window); @@ -407,6 +406,7 @@ */ function Draggable(el, options) { this.options = $.extend({}, defaults, options); + this.$body = $(document.body); this.$container = $(el); this.$dragitems = $(this.options.items, this.$container); this.is_dragging = false; @@ -508,10 +508,16 @@ fn.drag_handler = function(e) { + var node = e.target.nodeName; + if (e.which !== 1) { - return false; + return; } + if (node === 'INPUT' || node === 'TEXTAREA' || node === 'SELECT') { + return; + }; + var self = this; var first = true; this.$player = $(e.currentTarget); @@ -520,7 +526,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; - $body.on('mousemove.draggable', function(mme){ + this.$body.on('mousemove.draggable', function(mme){ var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs( @@ -544,10 +550,7 @@ } return false; - }); - - return false; }; @@ -635,9 +638,9 @@ this.$container.on('mousedown.draggable', this.options.items, $.proxy( this.drag_handler, this)); - $body.on('mouseup.draggable', $.proxy(function(e) { + this.$body.on('mouseup.draggable', $.proxy(function(e) { this.is_dragging = false; - $body.off('mousemove.draggable'); + this.$body.off('mousemove.draggable'); if (this.drag_start) { this.on_dragstop(e); } @@ -647,7 +650,7 @@ fn.disable = function(){ this.$container.off('mousedown.draggable'); - $body.off('mouseup.draggable'); + this.$body.off('mouseup.draggable'); }; From 0e942677ec5f99bd36adb53f65fe99c853c09b65 Mon Sep 17 00:00:00 2001 From: vieron Date: Sun, 5 Aug 2012 11:00:08 +0200 Subject: [PATCH 074/248] increased scroll area size and scroll speed --- src/jquery.draggable.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 1a15c5652b..c1783b7594 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -119,8 +119,8 @@ var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var mouse_down_zone = max_window_y - 30; - var mouse_up_zone = min_window_y + 20; + var mouse_down_zone = max_window_y - 50; + var mouse_up_zone = min_window_y + 50; var abs_mouse_left = offset.mouse_left; var abs_mouse_top = min_window_y + offset.mouse_top; @@ -129,18 +129,18 @@ this.player_height); if (abs_mouse_top >= mouse_down_zone) { - nextScrollTop = scrollTop + 10; + nextScrollTop = scrollTop + 30; if (nextScrollTop < max_player_y) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset + 10; + this.scrollOffset = this.scrollOffset + 30; } }; if (abs_mouse_top <= mouse_up_zone) { - nextScrollTop = scrollTop - 10; + nextScrollTop = scrollTop - 30; if (nextScrollTop > 0) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset - 10; + this.scrollOffset = this.scrollOffset - 30; } }; } From 1316a37e6046db67c10eacc5e1b0ea1dfeabf91b Mon Sep 17 00:00:00 2001 From: vieron Date: Sun, 5 Aug 2012 12:39:51 +0200 Subject: [PATCH 075/248] added touch support. Closes #12, closes #9 --- src/jquery.draggable.js | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index c1783b7594..152825c93b 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -20,7 +20,12 @@ }; var $window = $(window); - + var isTouch = !!('ontouchstart' in window); + var pointer_events = { + start: isTouch ? 'touchstart' : 'mousedown.draggable', + move: isTouch ? 'touchmove' : 'mousemove.draggable', + end: isTouch ? 'touchend' : 'mouseup.draggable' + }; /** * Basic drag implementation for DOM elements inside a container. @@ -77,6 +82,11 @@ fn.get_mouse_pos = function(e) { + if (isTouch) { + var oe = e.originalEvent; + e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0]; + }; + return { left: e.clientX, top: e.clientY @@ -154,7 +164,7 @@ fn.drag_handler = function(e) { var node = e.target.nodeName; - if (e.which !== 1) { + if (e.which !== 1 && !isTouch) { return; } @@ -170,8 +180,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; - this.$body.on('mousemove.draggable', function(mme){ - + this.$body.on(pointer_events.move, function(mme){ var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs( mouse_actual_pos.left - self.mouse_init_pos.left); @@ -279,12 +288,12 @@ fn.enable = function(){ - this.$container.on('mousedown.draggable', this.options.items, $.proxy( + this.$container.on(pointer_events.start, this.options.items, $.proxy( this.drag_handler, this)); - this.$body.on('mouseup.draggable', $.proxy(function(e) { + this.$body.on(pointer_events.end, $.proxy(function(e) { this.is_dragging = false; - this.$body.off('mousemove.draggable'); + this.$body.off(pointer_events.move); if (this.drag_start) { this.on_dragstop(e); } @@ -293,8 +302,8 @@ fn.disable = function(){ - this.$container.off('mousedown.draggable'); - this.$body.off('mouseup.draggable'); + this.$container.off(pointer_events.start); + this.$body.off(pointer_events.end); }; From 6e8de6d9ab313e8a3d47e791034f02ed061a95b1 Mon Sep 17 00:00:00 2001 From: vieron Date: Sun, 5 Aug 2012 12:40:27 +0200 Subject: [PATCH 076/248] updated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 41 ++++++++++++++++++++++--------------- dist/jquery.gridster.min.js | 4 ++-- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index 1b2d552d93..0e9b0aa698 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-08-03 +/*! gridster.js - v0.1.0 - 2012-08-05 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 38c9b5f366..58d8b67811 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-08-03 +/*! gridster.js - v0.1.0 - 2012-08-05 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ @@ -376,7 +376,12 @@ }; var $window = $(window); - + var isTouch = !!('ontouchstart' in window); + var pointer_events = { + start: isTouch ? 'touchstart' : 'mousedown.draggable', + move: isTouch ? 'touchmove' : 'mousemove.draggable', + end: isTouch ? 'touchend' : 'mouseup.draggable' + }; /** * Basic drag implementation for DOM elements inside a container. @@ -433,6 +438,11 @@ fn.get_mouse_pos = function(e) { + if (isTouch) { + var oe = e.originalEvent; + e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0]; + }; + return { left: e.clientX, top: e.clientY @@ -475,8 +485,8 @@ var min_window_y = scrollTop; var max_window_y = min_window_y + this.window_height; - var mouse_down_zone = max_window_y - 30; - var mouse_up_zone = min_window_y + 20; + var mouse_down_zone = max_window_y - 50; + var mouse_up_zone = min_window_y + 50; var abs_mouse_left = offset.mouse_left; var abs_mouse_top = min_window_y + offset.mouse_top; @@ -485,18 +495,18 @@ this.player_height); if (abs_mouse_top >= mouse_down_zone) { - nextScrollTop = scrollTop + 10; + nextScrollTop = scrollTop + 30; if (nextScrollTop < max_player_y) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset + 10; + this.scrollOffset = this.scrollOffset + 30; } }; if (abs_mouse_top <= mouse_up_zone) { - nextScrollTop = scrollTop - 10; + nextScrollTop = scrollTop - 30; if (nextScrollTop > 0) { $window.scrollTop(nextScrollTop); - this.scrollOffset = this.scrollOffset - 10; + this.scrollOffset = this.scrollOffset - 30; } }; } @@ -510,7 +520,7 @@ fn.drag_handler = function(e) { var node = e.target.nodeName; - if (e.which !== 1) { + if (e.which !== 1 && !isTouch) { return; } @@ -526,8 +536,7 @@ this.mouse_init_pos = this.get_mouse_pos(e); this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top; - this.$body.on('mousemove.draggable', function(mme){ - + this.$body.on(pointer_events.move, function(mme){ var mouse_actual_pos = self.get_mouse_pos(mme); var diff_x = Math.abs( mouse_actual_pos.left - self.mouse_init_pos.left); @@ -635,12 +644,12 @@ fn.enable = function(){ - this.$container.on('mousedown.draggable', this.options.items, $.proxy( + this.$container.on(pointer_events.start, this.options.items, $.proxy( this.drag_handler, this)); - this.$body.on('mouseup.draggable', $.proxy(function(e) { + this.$body.on(pointer_events.end, $.proxy(function(e) { this.is_dragging = false; - this.$body.off('mousemove.draggable'); + this.$body.off(pointer_events.move); if (this.drag_start) { this.on_dragstop(e); } @@ -649,8 +658,8 @@ fn.disable = function(){ - this.$container.off('mousedown.draggable'); - this.$body.off('mouseup.draggable'); + this.$container.off(pointer_events.start); + this.$body.off(pointer_events.end); }; diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 50b11faec6..96f45d5029 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-07-30 +/*! gridster.js - v0.1.0 - 2012-08-05 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ -(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=f&&(b=c+10,b0&&(g.scrollTop(b),this.scrollOffset=this.scrollOffset-10))},i.calculate_positions=function(a){this.window_height=g.height()},i.drag_handler=function(b){if(b.which!==1)return!1;var c=this,d=!0;return this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,f.on("mousemove.draggable",function(a){var b=c.get_mouse_pos(a),e=Math.abs(b.left-c.mouse_init_pos.left),f=Math.abs(b.top-c.mouse_init_pos.top);return e>c.options.distance||f>c.options.distance?d?(d=!1,c.on_dragstart.call(c,a),!1):(c.is_dragging==!0&&c.on_dragmove.call(c,a),!1):!1}),!1},i.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},i.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},i.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},i.enable=function(){this.$container.on("mousedown.draggable",this.options.items,a.proxy(this.drag_handler,this)),f.on("mouseup.draggable",a.proxy(function(a){this.is_dragging=!1,f.off("mousemove.draggable"),this.drag_start&&this.on_dragstop(a)},this))},i.disable=function(){this.$container.off("mousedown.draggable"),f.off("mouseup.draggable")},i.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new h(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g=Array.prototype.slice.call(g,0),g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h=Array.prototype.slice.call(h,0),h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file +(function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=g&&(b=c+30,b0&&(f.scrollTop(b),this.scrollOffset=this.scrollOffset-30))},j.calculate_positions=function(a){this.window_height=f.height()},j.drag_handler=function(b){var c=b.target.nodeName;if(b.which!==1&&!g)return;if(c==="INPUT"||c==="TEXTAREA"||c==="SELECT")return;var d=this,e=!0;this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$body.on(h.move,function(a){var b=d.get_mouse_pos(a),c=Math.abs(b.left-d.mouse_init_pos.left),f=Math.abs(b.top-d.mouse_init_pos.top);return c>d.options.distance||f>d.options.distance?e?(e=!1,d.on_dragstart.call(d,a),!1):(d.is_dragging==!0&&d.on_dragmove.call(d,a),!1):!1})},j.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},j.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},j.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},j.enable=function(){this.$container.on(h.start,this.options.items,a.proxy(this.drag_handler,this)),this.$body.on(h.end,a.proxy(function(a){this.is_dragging=!1,this.$body.off(h.move),this.drag_start&&this.on_dragstop(a)},this))},j.disable=function(){this.$container.off(h.start),this.$body.off(h.end)},j.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new i(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g=Array.prototype.slice.call(g,0),g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h=Array.prototype.slice.call(h,0),h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From f359a7eb76409d5edc39f25a31dfdfcd24af313c Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 6 Aug 2012 23:55:30 +0200 Subject: [PATCH 077/248] fixed typo in docs --- src/jquery.gridster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 625d74bd56..28be92b3b8 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -108,7 +108,7 @@ /** * Disable dragging. * - * @method enable + * @method disable * @return {Class} Returns the instance of the Gridster Class. */ fn.disable = function() { From ded20e32f1565d782ad4194ff57f40caeec61159 Mon Sep 17 00:00:00 2001 From: vieron Date: Mon, 6 Aug 2012 23:55:48 +0200 Subject: [PATCH 078/248] updated dist --- dist/jquery.gridster.css | 2 +- dist/jquery.gridster.js | 4 ++-- dist/jquery.gridster.min.css | 2 +- dist/jquery.gridster.min.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/jquery.gridster.css b/dist/jquery.gridster.css index 0e9b0aa698..2bf0344ec0 100644 --- a/dist/jquery.gridster.css +++ b/dist/jquery.gridster.css @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-08-05 +/*! gridster.js - v0.1.0 - 2012-08-06 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ diff --git a/dist/jquery.gridster.js b/dist/jquery.gridster.js index 58d8b67811..badeef4c57 100644 --- a/dist/jquery.gridster.js +++ b/dist/jquery.gridster.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-08-05 +/*! gridster.js - v0.1.0 - 2012-08-06 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ @@ -784,7 +784,7 @@ /** * Disable dragging. * - * @method enable + * @method disable * @return {Class} Returns the instance of the Gridster Class. */ fn.disable = function() { diff --git a/dist/jquery.gridster.min.css b/dist/jquery.gridster.min.css index e920e1f743..7322f97960 100644 --- a/dist/jquery.gridster.min.css +++ b/dist/jquery.gridster.min.css @@ -1,3 +1,3 @@ -/*! gridster.js - v0.1.0 - 2012-07-30 +/*! gridster.js - v0.1.0 - 2012-08-06 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute}.ready .gs_w:not(.preview-holder){-webkit-transition:opacity .3s,left .3s,top .3s;-moz-transition:opacity .3s,left .3s,top .3s;-o-transition:opacity .3s,left .3s,top .3s;transition:opacity .3s,left .3s,top .3s}.gridster .preview-holder{z-index:1;position:absolute;background-color:#fff;border-color:#fff;opacity:.3}.gridster .player-revert{z-index:10!important;-webkit-transition:left .3s,top .3s!important;-moz-transition:left .3s,top .3s!important;-o-transition:left .3s,top .3s!important;transition:left .3s,top .3s!important}.gridster .dragging{z-index:10!important;-webkit-transition:all 0s!important;-moz-transition:all 0s!important;-o-transition:all 0s!important;transition:all 0s!important} \ No newline at end of file diff --git a/dist/jquery.gridster.min.js b/dist/jquery.gridster.min.js index 96f45d5029..ed35d99cc0 100644 --- a/dist/jquery.gridster.min.js +++ b/dist/jquery.gridster.min.js @@ -1,4 +1,4 @@ -/*! gridster.js - v0.1.0 - 2012-08-05 +/*! gridster.js - v0.1.0 - 2012-08-06 * http://gridster.net/ * Copyright (c) 2012 ducksboard; Licensed MIT */ (function(a,b,c,d){function e(b){return b[0]&&a.isPlainObject(b[0])?this.data=b[0]:this.el=b,this.isCoords=!0,this.coords={},this.init(),this}var f=e.prototype;f.init=function(){this.set(),this.original_coords=this.get()},f.set=function(a,b){var c=this.el;c&&!a&&(this.data=c.offset(),this.data.width=c.width(),this.data.height=c.height());if(c&&a&&!b){var d=c.offset();this.data.top=d.top,this.data.left=d.left}var e=this.data;return this.coords.x1=e.left,this.coords.y1=e.top,this.coords.x2=e.left+e.width,this.coords.y2=e.top+e.height,this.coords.cx=e.left+e.width/2,this.coords.cy=e.top+e.height/2,this.coords.width=e.width,this.coords.height=e.height,this.coords.el=c||!1,this},f.update=function(b){if(!b&&!this.el)return this;if(b){var c=a.extend({},this.data,b);return this.data=c,this.set(!0,!0)}return this.set(!0),this},f.get=function(){return this.coords},a.fn.coords=function(){if(this.data("coords"))return this.data("coords");var a=new e(this,arguments[0]);return this.data("coords",a),a}})(jQuery,window,document),function(a,b,c,d){function f(b,c,d){this.options=a.extend(e,d),this.$element=b,this.last_colliders=[],this.last_colliders_coords=[],typeof c=="string"||c instanceof jQuery?this.$colliders=a(c,this.options.colliders_context).not(this.$element):this.colliders=a(c),this.init()}var e={colliders_context:c.body},g=f.prototype;g.init=function(){this.find_collisions()},g.overlaps=function(a,b){var c=!1,d=!1;if(b.x1>=a.x1&&b.x1<=a.x2||b.x2>=a.x1&&b.x2<=a.x2||a.x1>=b.x1&&a.x2<=b.x2)c=!0;if(b.y1>=a.y1&&b.y1<=a.y2||b.y2>=a.y1&&b.y2<=a.y2||a.y1>=b.y1&&a.y2<=b.y2)d=!0;return c&&d},g.detect_overlapping_region=function(a,b){var c="",d="";return a.y1>b.cy&&a.y1b.y1&&a.y2b.cx&&a.x1b.x1&&a.x2this.player_max_left?e=this.player_max_left:e=g&&(b=c+30,b0&&(f.scrollTop(b),this.scrollOffset=this.scrollOffset-30))},j.calculate_positions=function(a){this.window_height=f.height()},j.drag_handler=function(b){var c=b.target.nodeName;if(b.which!==1&&!g)return;if(c==="INPUT"||c==="TEXTAREA"||c==="SELECT")return;var d=this,e=!0;this.$player=a(b.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(b),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$body.on(h.move,function(a){var b=d.get_mouse_pos(a),c=Math.abs(b.left-d.mouse_init_pos.left),f=Math.abs(b.top-d.mouse_init_pos.top);return c>d.options.distance||f>d.options.distance?e?(e=!1,d.on_dragstart.call(d,a),!1):(d.is_dragging==!0&&d.on_dragmove.call(d,a),!1):!1})},j.on_dragstart=function(b){b.preventDefault(),this.drag_start=!0,this.is_dragging=!0;var d=this.$container.offset();return this.baseX=Math.round(d.left),this.baseY=Math.round(d.top),this.doc_height=a(c).height(),this.options.helper==="clone"?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.scrollOffset=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.player_max_left=this.$container.width()-this.player_width+this.options.offset_left,this.options.start&&this.options.start.call(this.$player,b,{helper:this.helper?this.$helper:this.$player}),!1},j.on_dragmove=function(a){var b=this.get_offset(a);this.options.autoscroll&&this.manage_scroll(b),(this.helper?this.$helper:this.$player).css({position:"absolute",left:b.left,top:b.top});var c={position:{left:b.left,top:b.top}};return this.options.drag&&this.options.drag.call(this.$player,a,c),!1},j.on_dragstop=function(a){var b=this.get_offset(a);this.drag_start=!1;var c={position:{left:b.left,top:b.top}};return this.options.stop&&this.options.stop.call(this.$player,a,c),this.helper&&this.$helper.remove(),!1},j.enable=function(){this.$container.on(h.start,this.options.items,a.proxy(this.drag_handler,this)),this.$body.on(h.end,a.proxy(function(a){this.is_dragging=!1,this.$body.off(h.move),this.drag_start&&this.on_dragstop(a)},this))},j.disable=function(){this.$container.off(h.start),this.$body.off(h.end)},j.destroy=function(){this.disable(),a.removeData(this.$container,"draggable")},a.fn.draggable=function(b){return this.each(function(){a.data(this,"draggable")||a.data(this,"draggable",new i(this,b))})}}(jQuery,window,document),function(a,b,c,d){function f(b,c){this.options=a.extend(!0,e,c),this.$el=a(b),this.$wrapper=this.$el.parent(),this.$widgets=a(this.options.widget_selector,this.$el).addClass("gs_w"),this.widgets=[],this.$changed=a([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=this.options.widget_margins[0]*2+this.options.widget_base_dimensions[0],this.min_widget_height=this.options.widget_margins[1]*2+this.options.widget_base_dimensions[1],this.init()}var e={widget_selector:"> li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,min_rows:15,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,serialize_params:function(a,b){return{col:b.col,row:b.row}},collision:{},draggable:{distance:4}};f.generated_stylesheets=[];var g=f.prototype;g.init=function(){this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.$wrapper.addClass("ready"),this.draggable(),a(b).bind("resize",throttle(a.proxy(this.recalculate_faux_grid,this),200))},g.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},g.enable=function(){return this.drag_api.enable(),this},g.add_widget=function(b,c,d){var e=this.next_position(c,d),f=a(b).attr({"data-col":e.col,"data-row":e.row,"data-sizex":e.size_x,"data-sizey":e.size_y}).addClass("gs_w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(f),this.register_widget(f),this.set_dom_grid_height(),f.fadeIn()},g.next_position=function(a,b){a||(a=1),b||(b=1);var c=this.gridmap,d=c.length,e=[];for(var f=1;f",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:e.width,height:e.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,b,c)},g.on_drag=function(a,b){var c={left:b.position.left+this.baseX,top:b.position.top+this.baseY};this.colliders_data=this.collision_api.get_closest_colliders(c),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:b.position.left,top:b.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,a,b)},g.on_stop_drag=function(a,b){this.$helper.add(this.$player).add(this.$wrapper).removeClass("dragging"),b.position.left=b.position.left+this.baseX,b.position.top=b.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(b.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.$player=null,this.$preview_holder.remove(),this.set_dom_grid_height(),this.options.draggable.stop&&this.options.draggable.stop.call(this,a,b)},g.on_overlapped_column_change=function(b,c){if(!this.colliders_data.length)return;var d=this.get_targeted_columns(this.colliders_data[0].el.data.col),e=this.last_cols.length,f=d.length,g;for(g=0;gb.row?1:-1}),a},g.sort_by_row_and_col_asc=function(a){return a=a.sort(function(a,b){return a.row>b.row||a.row==b.row&&a.col>b.col?1:-1}),a},g.sort_by_col_asc=function(a){return a=a.sort(function(a,b){return a.col>b.col?1:-1}),a},g.sort_by_row_desc=function(a){return a=a.sort(function(a,b){return a.row+a.size_y=0&&a.inArray(c,d.rows)>=0},g.is_placeholder_in=function(b,c){var d=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(b)&&a.inArray(c,d.rows)>=0},g.is_placeholder_in_col=function(b){var c=this.cells_occupied_by_placeholder||[];return a.inArray(b,c.cols)>=0},g.is_empty=function(a,b){return typeof this.gridmap[a]!="undefined"&&typeof this.gridmap[a][b]!="undefined"&&this.gridmap[a][b]===!1?!0:!1},g.is_occupied=function(a,b){return this.gridmap[a]?this.gridmap[a][b]?!0:!1:!1},g.is_widget=function(a,b){var c=this.gridmap[a];return c?(c=c[b],c?c:!1):!1},g.is_widget_under_player=function(a,b){return this.is_widget(a,b)?this.is_player_in(a,b):!1},g.get_widgets_under_player=function(){var b=this.cells_occupied_by_player,c=a([]);return a.each(b.cols,a.proxy(function(d,e){a.each(b.rows,a.proxy(function(a,b){this.is_widget(e,b)&&(c=c.add(this.gridmap[e][b]))},this))},this)),c},g.set_placeholder=function(b,c){var d=a.extend({},this.placeholder_grid_data),e=this.widgets_below({col:d.col,row:d.row,size_y:d.size_y,size_x:d.size_x}),f=b+d.size_x-1;f>this.cols&&(b=b-(f-b));var g=this.placeholder_grid_data.row0)if(this.is_empty(a,h)||this.is_player(a,h)||this.is_widget(a,h)&&g[h].is(f))d[a].push(h),e=h0){if(this.is_occupied(a,g)&&!this.is_player(a,g))break;!this.is_player(a,g)&&!this.is_placeholder_in(a,g)&&d[a].push(g),g=b?a[d[0]]:!1},g.get_widgets_overlapped=function(){var b,c=a([]),d=[],e=this.cells_occupied_by_player.rows.slice(0);return e.reverse(),a.each(this.cells_occupied_by_player.cols,a.proxy(function(b,f){a.each(e,a.proxy(function(b,e){if(!this.gridmap[f])return!0;var g=this.gridmap[f][e];this.is_occupied(f,e)&&!this.is_player(g)&&a.inArray(g,d)===-1&&(c=c.add(g),d.push(g))},this))},this)),c},g.on_start_overlapping_column=function(a){this.set_player(a,!1)},g.on_start_overlapping_row=function(a){this.set_player(!1,a)},g.on_stop_overlapping_column=function(a){this.set_player();var b=this;this.for_each_widget_below(a,this.cells_occupied_by_player.rows[0],function(a,c){b.move_widget_up(this,b.player_grid_data.size_y)})},g.on_stop_overlapping_row=function(a){this.set_player();var b=this,c=this.cells_occupied_by_player.cols;for(var d=0,e=c.length;d0&&this.move_widget_down(d,f)},this)),h.row=i,this.update_widget_position(h,b),b.attr("data-row",h.row),this.$changed=this.$changed.add(b),f.push(b)}},g.can_go_up_to_row=function(b,c,d){var e=this.gridmap,f=!0,g=[],h=b.row,i;this.for_each_column_occupied(b,function(a){var b=e[a];g[a]=[],i=h;while(i--)if(this.is_empty(a,i)&&!this.is_placeholder_in(a,i))g[a].push(i);else break;if(!g[a].length)return f=!1,!0});if(!f)return!1;i=d;for(i=1;i0?c:0},g.widgets_below=function(b){var c=a.isPlainObject(b)?b:b.coords().grid,d=this,e=this.gridmap,f=c.row+c.size_y-1,g=a([]);return this.for_each_column_occupied(c,function(b){d.for_each_widget_below(b,f,function(b,c){if(!d.is_player(this)&&a.inArray(this,g)===-1)return g=g.add(this),!0})}),this.sort_by_row_asc(g)},g.set_cells_player_occupies=function(a,b){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=a,this.placeholder_grid_data.row=b,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},g.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},g.can_go_up=function(a){var b=a.coords().grid,c=b.row,d=c-1,e=this.gridmap,f=[],g=!0;return c===1?!1:(this.for_each_column_occupied(b,function(a){var b=this.is_widget(a,d);if(this.is_occupied(a,d)||this.is_player(a,d)||this.is_placeholder_in(a,d))return g=!1,!0}),g)},g.can_move_to=function(a,b,c){var d=this.gridmap,e=a.el,f={size_y:a.size_y,size_x:a.size_x,col:b,row:c},g=!0,h=b+a.size_x-1;return h>this.cols?!1:(this.for_each_cell_occupied(f,function(b,c){var d=this.is_widget(b,c);d&&(!a.el||d.is(e))&&(g=!1)}),g)},g.get_targeted_columns=function(a){var b=(a||this.player_grid_data.col)+(this.player_grid_data.size_x-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_targeted_rows=function(a){var b=(a||this.player_grid_data.row)+(this.player_grid_data.size_y-1),c=[];for(var d=a;d<=b;d++)c.push(d);return c},g.get_cells_occupied=function(a){var b={cols:[],rows:[]},c;arguments[1]instanceof jQuery&&(a=arguments[1].coords().grid);for(c=0;c0&&this.is_widget(d,m)&&a.inArray(g[d][m],l)===-1){h=f.call(g[d][m],d,m),l.push(g[d][m]);if(h)break}},"for_each/below":function(){for(m=e+1,i=g[d].length;m=1;e--)for(a=b[e].length-1;a>=1;a--)if(this.is_widget(e,a)){c.push(a),d[a]=e;break}var f=Math.max.apply(Math,c);return this.highest_occupied_cell={col:d[f],row:f},this.highest_occupied_cell},g.get_widgets_from=function(b,c){var d=this.gridmap,e=a();return b&&(e=e.add(this.$widgets.filter(function(){var c=a(this).attr("data-col");return c===b||c>b}))),c&&(e=e.add(this.$widgets.filter(function(){var b=a(this).attr("data-row");return b===c||b>c}))),e},g.set_dom_grid_height=function(){var a=this.get_highest_occupied_cell().row;return this.$el.css("height",a*this.min_widget_height),this},g.generate_stylesheet=function(b){var c="",d=10,e=6,g=6,h,i;b||(b={}),b.cols||(b.cols=this.cols),b.rows||(b.rows=this.rows),b.namespace||(b.namespace=""),b.widget_base_dimensions||(b.widget_base_dimensions=this.options.widget_base_dimensions),b.widget_margins||(b.widget_margins=this.options.widget_margins),b.min_widget_width=b.widget_margins[0]*2+b.widget_base_dimensions[0],b.min_widget_height=b.widget_margins[1]*2+b.widget_base_dimensions[1];var j=a.param(b);if(a.inArray(j,f.generated_stylesheets)>=0)return!1;f.generated_stylesheets.push(j);for(h=b.cols+d;h>=0;h--)c+=b.namespace+' [data-col="'+(h+1)+'"] { left:'+(h*b.widget_base_dimensions[0]+h*b.widget_margins[0]+(h+1)*b.widget_margins[0])+"px;} ";for(h=b.rows+d;h>=0;h--)c+=b.namespace+' [data-row="'+(h+1)+'"] { top:'+(h*b.widget_base_dimensions[1]+h*b.widget_margins[1]+(h+1)*b.widget_margins[1])+"px;} ";for(var k=1;k0;d--){this.gridmap[d]=[];for(e=b;e>0;e--){var f=a({left:this.baseX+(d-1)*this.min_widget_width,top:this.baseY+(e-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:d,row:e,original_col:d,original_row:e}).coords();this.gridmap[d][e]=!1,this.faux_grid.push(f)}}return this},g.recalculate_faux_grid=function(){var c=this.$wrapper.width();return this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,a.each(this.faux_grid,a.proxy(function(a,b){this.faux_grid[a]=b.update({left:this.baseX+(b.data.col-1)*this.min_widget_width,top:this.baseY+(b.data.row-1)*this.min_widget_height})},this)),this},g.get_widgets_from_DOM=function(){return this.$widgets.each(a.proxy(function(b,c){this.register_widget(a(c))},this)),this},g.generate_grid_and_stylesheet=function(){var c=this.$wrapper.width(),d=this.$wrapper.height(),e=Math.floor(c/this.min_widget_width)+this.options.extra_cols,f=Math.floor(d/this.min_widget_height)+this.options.extra_rows,g=this.$widgets.map(function(){return a(this).attr("data-col")});g=Array.prototype.slice.call(g,0),g.length||(g=[0]);var h=this.$widgets.map(function(){return a(this).attr("data-row")});h=Array.prototype.slice.call(h,0),h.length||(h=[0]);var i=Math.max.apply(Math,g),j=Math.max.apply(Math,h);return this.cols=Math.max(i,e,this.options.min_cols),this.rows=Math.max(j,f,this.options.min_rows),this.baseX=(a(b).width()-c)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},a.fn.gridster=function(b){return this.each(function(){a(this).data("gridster")||a(this).data("gridster",new f(this,b))})}}(jQuery,window,document); \ No newline at end of file From ca7577950e3bbb8dd8888ebadf3251d2ad63991a Mon Sep 17 00:00:00 2001 From: vieron Date: Tue, 7 Aug 2012 00:59:00 +0200 Subject: [PATCH 079/248] don't start drag if
      a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
      " + - "" + - "
      "; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
      t
      "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
      "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

      "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
      "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
      ", "
      " ], - thead: [ 1, "", "
      " ], - tr: [ 2, "", "
      " ], - td: [ 3, "", "
      " ], - col: [ 2, "", "
      " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and