app/jquery/jquery-ui.draggable.js
author Mario Ferraro <fadinlight@gmail.com>
Mon, 07 Sep 2009 15:07:37 +0200
changeset 2872 7d5c8039fbe2
parent 2749 4e2789b8e86d
permissions -rw-r--r--
Added Shrinksafe code to shrink JS files before deploy.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     1
/*
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
     2
 * jQuery UI Draggable 1.7.2
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     3
 *
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
     4
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     5
 * Dual licensed under the MIT (MIT-LICENSE.txt)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     6
 * and GPL (GPL-LICENSE.txt) licenses.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     7
 *
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     8
 * http://docs.jquery.com/UI/Draggables
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
     9
 *
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    10
 * Depends:
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    11
 *	ui.core.js
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    12
 */
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    13
(function($) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    14
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    15
$.widget("ui.draggable", $.extend({}, $.ui.mouse, {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    16
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    17
	_init: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    18
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    19
		if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    20
			this.element[0].style.position = 'relative';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    21
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    22
		(this.options.addClasses && this.element.addClass("ui-draggable"));
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    23
		(this.options.disabled && this.element.addClass("ui-draggable-disabled"));
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    24
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    25
		this._mouseInit();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    26
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    27
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    28
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    29
	destroy: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    30
		if(!this.element.data('draggable')) return;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    31
		this.element
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    32
			.removeData("draggable")
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    33
			.unbind(".draggable")
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    34
			.removeClass("ui-draggable"
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    35
				+ " ui-draggable-dragging"
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    36
				+ " ui-draggable-disabled");
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    37
		this._mouseDestroy();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    38
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    39
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    40
	_mouseCapture: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    41
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    42
		var o = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    43
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    44
		if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    45
			return false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    46
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    47
		//Quit if we're not on a valid handle
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    48
		this.handle = this._getHandle(event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    49
		if (!this.handle)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    50
			return false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    51
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    52
		return true;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    53
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    54
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    55
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    56
	_mouseStart: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    57
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    58
		var o = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    59
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    60
		//Create and append the visible helper
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    61
		this.helper = this._createHelper(event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    62
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    63
		//Cache the helper size
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    64
		this._cacheHelperProportions();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    65
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    66
		//If ddmanager is used for droppables, set the global draggable
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    67
		if($.ui.ddmanager)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    68
			$.ui.ddmanager.current = this;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    69
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    70
		/*
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    71
		 * - Position generation -
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    72
		 * This block generates everything position related - it's the core of draggables.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    73
		 */
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    74
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    75
		//Cache the margins of the original element
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    76
		this._cacheMargins();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    77
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    78
		//Store the helper's css position
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    79
		this.cssPosition = this.helper.css("position");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    80
		this.scrollParent = this.helper.scrollParent();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    81
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    82
		//The element's absolute position on the page minus margins
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    83
		this.offset = this.element.offset();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    84
		this.offset = {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    85
			top: this.offset.top - this.margins.top,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    86
			left: this.offset.left - this.margins.left
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    87
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    88
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    89
		$.extend(this.offset, {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    90
			click: { //Where the click happened, relative to the element
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    91
				left: event.pageX - this.offset.left,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    92
				top: event.pageY - this.offset.top
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    93
			},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    94
			parent: this._getParentOffset(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    95
			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    96
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
    97
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    98
		//Generate the original position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
    99
		this.originalPosition = this._generatePosition(event);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   100
		this.originalPageX = event.pageX;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   101
		this.originalPageY = event.pageY;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   102
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   103
		//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   104
		if(o.cursorAt)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   105
			this._adjustOffsetFromHelper(o.cursorAt);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   106
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   107
		//Set a containment if given in the options
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   108
		if(o.containment)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   109
			this._setContainment();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   110
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   111
		//Call plugins and callbacks
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   112
		this._trigger("start", event);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   113
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   114
		//Recache the helper size
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   115
		this._cacheHelperProportions();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   116
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   117
		//Prepare the droppable offsets
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   118
		if ($.ui.ddmanager && !o.dropBehaviour)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   119
			$.ui.ddmanager.prepareOffsets(this, event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   120
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   121
		this.helper.addClass("ui-draggable-dragging");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   122
		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   123
		return true;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   124
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   125
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   126
	_mouseDrag: function(event, noPropagation) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   127
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   128
		//Compute the helpers position
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   129
		this.position = this._generatePosition(event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   130
		this.positionAbs = this._convertPositionTo("absolute");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   131
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   132
		//Call plugins and callbacks and use the resulting position if something is returned
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   133
		if (!noPropagation) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   134
			var ui = this._uiHash();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   135
			this._trigger('drag', event, ui);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   136
			this.position = ui.position;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   137
		}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   138
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   139
		if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   140
		if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   141
		if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   142
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   143
		return false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   144
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   145
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   146
	_mouseStop: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   147
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   148
		//If we are using droppables, inform the manager about the drop
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   149
		var dropped = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   150
		if ($.ui.ddmanager && !this.options.dropBehaviour)
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   151
			dropped = $.ui.ddmanager.drop(this, event);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   152
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   153
		//if a drop comes from outside (a sortable)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   154
		if(this.dropped) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   155
			dropped = this.dropped;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   156
			this.dropped = false;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   157
		}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   158
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   159
		if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   160
			var self = this;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   161
			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   162
				self._trigger("stop", event);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   163
				self._clear();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   164
			});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   165
		} else {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   166
			this._trigger("stop", event);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   167
			this._clear();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   168
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   169
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   170
		return false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   171
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   172
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   173
	_getHandle: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   174
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   175
		var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   176
		$(this.options.handle, this.element)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   177
			.find("*")
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   178
			.andSelf()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   179
			.each(function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   180
				if(this == event.target) handle = true;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   181
			});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   182
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   183
		return handle;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   184
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   185
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   186
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   187
	_createHelper: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   188
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   189
		var o = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   190
		var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone() : this.element);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   191
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   192
		if(!helper.parents('body').length)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   193
			helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   194
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   195
		if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   196
			helper.css("position", "absolute");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   197
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   198
		return helper;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   199
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   200
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   201
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   202
	_adjustOffsetFromHelper: function(obj) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   203
		if(obj.left != undefined) this.offset.click.left = obj.left + this.margins.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   204
		if(obj.right != undefined) this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   205
		if(obj.top != undefined) this.offset.click.top = obj.top + this.margins.top;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   206
		if(obj.bottom != undefined) this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   207
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   208
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   209
	_getParentOffset: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   210
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   211
		//Get the offsetParent and cache its position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   212
		this.offsetParent = this.helper.offsetParent();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   213
		var po = this.offsetParent.offset();
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   214
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   215
		// This is a special case where we need to modify a offset calculated on start, since the following happened:
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   216
		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   217
		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   218
		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   219
		if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   220
			po.left += this.scrollParent.scrollLeft();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   221
			po.top += this.scrollParent.scrollTop();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   222
		}
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   223
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   224
		if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   225
		|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   226
			po = { top: 0, left: 0 };
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   227
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   228
		return {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   229
			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   230
			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   231
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   232
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   233
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   234
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   235
	_getRelativeOffset: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   236
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   237
		if(this.cssPosition == "relative") {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   238
			var p = this.element.position();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   239
			return {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   240
				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   241
				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   242
			};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   243
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   244
			return { top: 0, left: 0 };
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   245
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   246
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   247
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   248
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   249
	_cacheMargins: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   250
		this.margins = {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   251
			left: (parseInt(this.element.css("marginLeft"),10) || 0),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   252
			top: (parseInt(this.element.css("marginTop"),10) || 0)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   253
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   254
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   255
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   256
	_cacheHelperProportions: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   257
		this.helperProportions = {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   258
			width: this.helper.outerWidth(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   259
			height: this.helper.outerHeight()
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   260
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   261
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   262
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   263
	_setContainment: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   264
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   265
		var o = this.options;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   266
		if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   267
		if(o.containment == 'document' || o.containment == 'window') this.containment = [
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   268
			0 - this.offset.relative.left - this.offset.parent.left,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   269
			0 - this.offset.relative.top - this.offset.parent.top,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   270
			$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   271
			($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   272
		];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   273
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   274
		if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   275
			var ce = $(o.containment)[0]; if(!ce) return;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   276
			var co = $(o.containment).offset();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   277
			var over = ($(ce).css("overflow") != 'hidden');
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   278
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   279
			this.containment = [
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   280
				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   281
				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   282
				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   283
				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   284
			];
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   285
		} else if(o.containment.constructor == Array) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   286
			this.containment = o.containment;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   287
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   288
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   289
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   290
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   291
	_convertPositionTo: function(d, pos) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   292
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   293
		if(!pos) pos = this.position;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   294
		var mod = d == "absolute" ? 1 : -1;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   295
		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   296
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   297
		return {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   298
			top: (
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   299
				pos.top																	// The absolute mouse position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   300
				+ this.offset.relative.top * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   301
				+ this.offset.parent.top * mod											// The offsetParent's offset without borders (offset + border)
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   302
				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   303
			),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   304
			left: (
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   305
				pos.left																// The absolute mouse position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   306
				+ this.offset.relative.left * mod										// Only for relative positioned nodes: Relative offset from element to offset parent
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   307
				+ this.offset.parent.left * mod											// The offsetParent's offset without borders (offset + border)
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   308
				- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   309
			)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   310
		};
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   311
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   312
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   313
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   314
	_generatePosition: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   315
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   316
		var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   317
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   318
		// This is another very weird special case that only happens for relative elements:
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   319
		// 1. If the css position is relative
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   320
		// 2. and the scroll parent is the document or similar to the offset parent
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   321
		// we have to refresh the relative offset during the scroll so there are no jumps
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   322
		if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   323
			this.offset.relative = this._getRelativeOffset();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   324
		}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   325
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   326
		var pageX = event.pageX;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   327
		var pageY = event.pageY;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   328
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   329
		/*
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   330
		 * - Position constraining -
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   331
		 * Constrain the position to a mix of grid, containment.
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   332
		 */
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   333
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   334
		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   335
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   336
			if(this.containment) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   337
				if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   338
				if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   339
				if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   340
				if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   341
			}
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   342
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   343
			if(o.grid) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   344
				var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   345
				pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   346
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   347
				var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   348
				pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   349
			}
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   350
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   351
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   352
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   353
		return {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   354
			top: (
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   355
				pageY																// The absolute mouse position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   356
				- this.offset.click.top													// Click offset (relative to the element)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   357
				- this.offset.relative.top												// Only for relative positioned nodes: Relative offset from element to offset parent
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   358
				- this.offset.parent.top												// The offsetParent's offset without borders (offset + border)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   359
				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   360
			),
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   361
			left: (
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   362
				pageX																// The absolute mouse position
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   363
				- this.offset.click.left												// Click offset (relative to the element)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   364
				- this.offset.relative.left												// Only for relative positioned nodes: Relative offset from element to offset parent
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   365
				- this.offset.parent.left												// The offsetParent's offset without borders (offset + border)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   366
				+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   367
			)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   368
		};
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   369
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   370
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   371
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   372
	_clear: function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   373
		this.helper.removeClass("ui-draggable-dragging");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   374
		if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   375
		//if($.ui.ddmanager) $.ui.ddmanager.current = null;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   376
		this.helper = null;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   377
		this.cancelHelperRemoval = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   378
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   379
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   380
	// From now on bulk stuff - mainly helpers
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   381
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   382
	_trigger: function(type, event, ui) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   383
		ui = ui || this._uiHash();
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   384
		$.ui.plugin.call(this, type, [event, ui]);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   385
		if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   386
		return $.widget.prototype._trigger.call(this, type, event, ui);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   387
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   388
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   389
	plugins: {},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   390
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   391
	_uiHash: function(event) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   392
		return {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   393
			helper: this.helper,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   394
			position: this.position,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   395
			absolutePosition: this.positionAbs, //deprecated
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   396
			offset: this.positionAbs
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   397
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   398
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   399
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   400
}));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   401
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   402
$.extend($.ui.draggable, {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   403
	version: "1.7.2",
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   404
	eventPrefix: "drag",
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   405
	defaults: {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   406
		addClasses: true,
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   407
		appendTo: "parent",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   408
		axis: false,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   409
		cancel: ":input,option",
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   410
		connectToSortable: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   411
		containment: false,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   412
		cursor: "auto",
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   413
		cursorAt: false,
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   414
		delay: 0,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   415
		distance: 1,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   416
		grid: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   417
		handle: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   418
		helper: "original",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   419
		iframeFix: false,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   420
		opacity: false,
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   421
		refreshPositions: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   422
		revert: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   423
		revertDuration: 500,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   424
		scope: "default",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   425
		scroll: true,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   426
		scrollSensitivity: 20,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   427
		scrollSpeed: 20,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   428
		snap: false,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   429
		snapMode: "both",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   430
		snapTolerance: 20,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   431
		stack: false,
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   432
		zIndex: false
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   433
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   434
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   435
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   436
$.ui.plugin.add("draggable", "connectToSortable", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   437
	start: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   438
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   439
		var inst = $(this).data("draggable"), o = inst.options,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   440
			uiSortable = $.extend({}, ui, { item: inst.element });
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   441
		inst.sortables = [];
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   442
		$(o.connectToSortable).each(function() {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   443
			var sortable = $.data(this, 'sortable');
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   444
			if (sortable && !sortable.options.disabled) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   445
				inst.sortables.push({
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   446
					instance: sortable,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   447
					shouldRevert: sortable.options.revert
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   448
				});
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   449
				sortable._refreshItems();	//Do a one-time refresh at start to refresh the containerCache
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   450
				sortable._trigger("activate", event, uiSortable);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   451
			}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   452
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   453
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   454
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   455
	stop: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   456
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   457
		//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   458
		var inst = $(this).data("draggable"),
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   459
			uiSortable = $.extend({}, ui, { item: inst.element });
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   460
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   461
		$.each(inst.sortables, function() {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   462
			if(this.instance.isOver) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   463
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   464
				this.instance.isOver = 0;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   465
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   466
				inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   467
				this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   468
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   469
				//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   470
				if(this.shouldRevert) this.instance.options.revert = true;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   471
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   472
				//Trigger the stop of the sortable
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   473
				this.instance._mouseStop(event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   474
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   475
				this.instance.options.helper = this.instance.options._helper;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   476
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   477
				//If the helper has been the original item, restore properties in the sortable
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   478
				if(inst.options.helper == 'original')
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   479
					this.instance.currentItem.css({ top: 'auto', left: 'auto' });
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   480
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   481
			} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   482
				this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   483
				this.instance._trigger("deactivate", event, uiSortable);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   484
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   485
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   486
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   487
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   488
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   489
	drag: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   490
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   491
		var inst = $(this).data("draggable"), self = this;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   492
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   493
		var checkPos = function(o) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   494
			var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   495
			var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   496
			var itemHeight = o.height, itemWidth = o.width;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   497
			var itemTop = o.top, itemLeft = o.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   498
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   499
			return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   500
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   501
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   502
		$.each(inst.sortables, function(i) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   503
			
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   504
			//Copy over some variables to allow calling the sortable's native _intersectsWith
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   505
			this.instance.positionAbs = inst.positionAbs;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   506
			this.instance.helperProportions = inst.helperProportions;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   507
			this.instance.offset.click = inst.offset.click;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   508
			
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   509
			if(this.instance._intersectsWith(this.instance.containerCache)) {
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   510
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   511
				//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   512
				if(!this.instance.isOver) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   513
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   514
					this.instance.isOver = 1;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   515
					//Now we fake the start of dragging for the sortable instance,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   516
					//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   517
					//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   518
					this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   519
					this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   520
					this.instance.options.helper = function() { return ui.helper[0]; };
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   521
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   522
					event.target = this.instance.currentItem[0];
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   523
					this.instance._mouseCapture(event, true);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   524
					this.instance._mouseStart(event, true, true);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   525
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   526
					//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   527
					this.instance.offset.click.top = inst.offset.click.top;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   528
					this.instance.offset.click.left = inst.offset.click.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   529
					this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   530
					this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   531
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   532
					inst._trigger("toSortable", event);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   533
					inst.dropped = this.instance.element; //draggable revert needs that
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   534
					//hack so receive/update callbacks work (mostly)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   535
					inst.currentItem = inst.element;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   536
					this.instance.fromOutside = inst;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   537
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   538
				}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   539
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   540
				//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   541
				if(this.instance.currentItem) this.instance._mouseDrag(event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   542
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   543
			} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   544
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   545
				//If it doesn't intersect with the sortable, and it intersected before,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   546
				//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   547
				if(this.instance.isOver) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   548
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   549
					this.instance.isOver = 0;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   550
					this.instance.cancelHelperRemoval = true;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   551
					
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   552
					//Prevent reverting on this forced stop
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   553
					this.instance.options.revert = false;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   554
					
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   555
					// The out event needs to be triggered independently
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   556
					this.instance._trigger('out', event, this.instance._uiHash(this.instance));
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   557
					
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   558
					this.instance._mouseStop(event, true);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   559
					this.instance.options.helper = this.instance.options._helper;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   560
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   561
					//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   562
					this.instance.currentItem.remove();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   563
					if(this.instance.placeholder) this.instance.placeholder.remove();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   564
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   565
					inst._trigger("fromSortable", event);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   566
					inst.dropped = false; //draggable revert needs that
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   567
				}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   568
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   569
			};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   570
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   571
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   572
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   573
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   574
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   575
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   576
$.ui.plugin.add("draggable", "cursor", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   577
	start: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   578
		var t = $('body'), o = $(this).data('draggable').options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   579
		if (t.css("cursor")) o._cursor = t.css("cursor");
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   580
		t.css("cursor", o.cursor);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   581
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   582
	stop: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   583
		var o = $(this).data('draggable').options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   584
		if (o._cursor) $('body').css("cursor", o._cursor);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   585
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   586
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   587
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   588
$.ui.plugin.add("draggable", "iframeFix", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   589
	start: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   590
		var o = $(this).data('draggable').options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   591
		$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   592
			$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   593
			.css({
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   594
				width: this.offsetWidth+"px", height: this.offsetHeight+"px",
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   595
				position: "absolute", opacity: "0.001", zIndex: 1000
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   596
			})
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   597
			.css($(this).offset())
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   598
			.appendTo("body");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   599
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   600
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   601
	stop: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   602
		$("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   603
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   604
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   605
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   606
$.ui.plugin.add("draggable", "opacity", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   607
	start: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   608
		var t = $(ui.helper), o = $(this).data('draggable').options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   609
		if(t.css("opacity")) o._opacity = t.css("opacity");
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   610
		t.css('opacity', o.opacity);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   611
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   612
	stop: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   613
		var o = $(this).data('draggable').options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   614
		if(o._opacity) $(ui.helper).css('opacity', o._opacity);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   615
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   616
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   617
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   618
$.ui.plugin.add("draggable", "scroll", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   619
	start: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   620
		var i = $(this).data("draggable");
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   621
		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   622
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   623
	drag: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   624
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   625
		var i = $(this).data("draggable"), o = i.options, scrolled = false;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   626
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   627
		if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   628
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   629
			if(!o.axis || o.axis != 'x') {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   630
				if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   631
					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   632
				else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   633
					i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   634
			}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   635
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   636
			if(!o.axis || o.axis != 'y') {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   637
				if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   638
					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   639
				else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   640
					i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   641
			}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   642
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   643
		} else {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   644
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   645
			if(!o.axis || o.axis != 'x') {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   646
				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   647
					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   648
				else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   649
					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   650
			}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   651
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   652
			if(!o.axis || o.axis != 'y') {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   653
				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   654
					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   655
				else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   656
					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   657
			}
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   658
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   659
		}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   660
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   661
		if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   662
			$.ui.ddmanager.prepareOffsets(i, event);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   663
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   664
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   665
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   666
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   667
$.ui.plugin.add("draggable", "snap", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   668
	start: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   669
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   670
		var i = $(this).data("draggable"), o = i.options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   671
		i.snapElements = [];
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   672
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   673
		$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   674
			var $t = $(this); var $o = $t.offset();
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   675
			if(this != i.element[0]) i.snapElements.push({
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   676
				item: this,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   677
				width: $t.outerWidth(), height: $t.outerHeight(),
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   678
				top: $o.top, left: $o.left
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   679
			});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   680
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   681
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   682
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   683
	drag: function(event, ui) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   684
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   685
		var inst = $(this).data("draggable"), o = inst.options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   686
		var d = o.snapTolerance;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   687
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   688
		var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   689
			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   690
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   691
		for (var i = inst.snapElements.length - 1; i >= 0; i--){
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   692
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   693
			var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   694
				t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   695
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   696
			//Yes, I know, this is insane ;)
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   697
			if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   698
				if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   699
				inst.snapElements[i].snapping = false;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   700
				continue;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   701
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   702
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   703
			if(o.snapMode != 'inner') {
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   704
				var ts = Math.abs(t - y2) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   705
				var bs = Math.abs(b - y1) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   706
				var ls = Math.abs(l - x2) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   707
				var rs = Math.abs(r - x1) <= d;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   708
				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   709
				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   710
				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   711
				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   712
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   713
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   714
			var first = (ts || bs || ls || rs);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   715
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   716
			if(o.snapMode != 'outer') {
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   717
				var ts = Math.abs(t - y1) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   718
				var bs = Math.abs(b - y2) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   719
				var ls = Math.abs(l - x1) <= d;
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   720
				var rs = Math.abs(r - x2) <= d;
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   721
				if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   722
				if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   723
				if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   724
				if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   725
			}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   726
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   727
			if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   728
				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   729
			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   730
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   731
		};
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   732
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   733
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   734
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   735
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   736
$.ui.plugin.add("draggable", "stack", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   737
	start: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   738
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   739
		var o = $(this).data("draggable").options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   740
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   741
		var group = $.makeArray($(o.stack.group)).sort(function(a,b) {
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   742
			return (parseInt($(a).css("zIndex"),10) || o.stack.min) - (parseInt($(b).css("zIndex"),10) || o.stack.min);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   743
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   744
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   745
		$(group).each(function(i) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   746
			this.style.zIndex = o.stack.min + i;
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   747
		});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   748
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   749
		this[0].style.zIndex = o.stack.min + group.length;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   750
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   751
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   752
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   753
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   754
$.ui.plugin.add("draggable", "zIndex", {
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   755
	start: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   756
		var t = $(ui.helper), o = $(this).data("draggable").options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   757
		if(t.css("zIndex")) o._zIndex = t.css("zIndex");
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   758
		t.css('zIndex', o.zIndex);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   759
	},
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   760
	stop: function(event, ui) {
2749
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   761
		var o = $(this).data("draggable").options;
4e2789b8e86d Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents: 2420
diff changeset
   762
		if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
2420
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   763
	}
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   764
});
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   765
645f4de26f99 Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff changeset
   766
})(jQuery);