Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- event.relocated renamed to event.relocateEnd

- added event.relocateBefore(div, to) - it's called before each
element is relocated
- added event.relocateAfter(div, to) - it's called after each element
is relocated
- added event.shiftOverflow - called after overflow happen in "shift"
drop mode
  • Loading branch information...
commit 36095672196eefe312234ed30d9d2be14e71f6d4 1 parent 89ef3c1
Darko Bunic authored
4 changes.txt
@@ -4,6 +4,10 @@ Changes for REDIPS.drag library
4 4 - modified enableDrag - method has option to accept node reference to enable / disable DIV elements inside that node
5 5 - fix inside relocate method (events were registered after DIV element was relocated and that should not be the case)
6 6 - added example26: jQuery dialog
  7 +- event.relocated renamed to event.relocateEnd
  8 +- added event.relocateBefore(div, to) - it's called before each element is relocated
  9 +- added event.relocateAfter(div, to) - it's called after each element is relocated
  10 +- added event.shiftOverflow - called after overflow happen in "shift" drop mode
7 11
8 12 5.0.3 (2012-12-19)
9 13 - modified emptyCell - now method has option to test target cell and to delete cell content
2  example04/script.js
@@ -35,7 +35,7 @@ redipsInit = function () {
35 35 objOld = rd.objOld, // previous element (this is clone element)
36 36 tac = rd.td.target; // target cell
37 37 // disable dropped DIV element
38   - rd.enableDrag(false, obj.id);
  38 + rd.enableDrag(false, obj);
39 39 // toggle X and O elements on the left
40 40 toggleXO();
41 41 // check board (objOld.id can be 'x' or 'o')
62 example25/index.html
@@ -15,33 +15,33 @@
15 15 <div id="main_container">
16 16 <!-- drag1 DIV container -->
17 17 <div id="drag">
18   - <select id="dropDown" onchange="setTable(this)">
  18 + <select id="dropDown" onchange="redips.setTable(this)">
19 19 <option value="addition">Addition</option>
20 20 <option value="multiplication">Multiplication</option>
21 21 </select>
22 22 <!-- numbers -->
23 23 <table id="number">
24 24 <colgroup>
25   - <col width="50"/>
26   - <col width="50"/>
27   - <col width="50"/>
28   - <col width="50"/>
29   - <col width="50"/>
  25 + <col width="70"/>
  26 + <col width="70"/>
  27 + <col width="70"/>
  28 + <col width="70"/>
  29 + <col width="70"/>
30 30 </colgroup>
31 31 <tbody>
32 32 <tr class="upper">
33   - <td class="mark"><div class="drag clone">1</div></td>
34   - <td class="mark"><div class="drag clone">2</div></td>
35   - <td class="mark"><div class="drag clone">3</div></td>
36   - <td class="mark"><div class="drag clone">4</div></td>
37   - <td class="mark"><div class="drag clone">5</div></td>
  33 + <td class="mark"><div class="drag box clone">1</div></td>
  34 + <td class="mark"><div class="drag box clone">2</div></td>
  35 + <td class="mark"><div class="drag box clone">3</div></td>
  36 + <td class="mark"><div class="drag box clone">4</div></td>
  37 + <td class="mark"><div class="drag box clone">5</div></td>
38 38 </tr>
39 39 <tr class="upper">
40   - <td class="mark"><div class="drag clone">6</div></td>
41   - <td class="mark"><div class="drag clone">7</div></td>
42   - <td class="mark"><div class="drag clone">8</div></td>
43   - <td class="mark"><div class="drag clone">9</div></td>
44   - <td class="mark"><div class="drag clone">10</div></td>
  40 + <td class="mark"><div class="drag box clone">6</div></td>
  41 + <td class="mark"><div class="drag box clone">7</div></td>
  42 + <td class="mark"><div class="drag box clone">8</div></td>
  43 + <td class="mark"><div class="drag box clone">9</div></td>
  44 + <td class="mark"><div class="drag box clone">10</div></td>
45 45 </tr>
46 46 </tbody>
47 47 </table>
@@ -49,11 +49,11 @@
49 49 <!-- addition table -->
50 50 <table id="addition">
51 51 <colgroup>
52   - <col width="50"/>
53   - <col width="50"/>
54   - <col width="50"/>
55   - <col width="50"/>
56   - <col width="50"/>
  52 + <col width="70"/>
  53 + <col width="70"/>
  54 + <col width="70"/>
  55 + <col width="70"/>
  56 + <col width="70"/>
57 57 </colgroup>
58 58 <tbody>
59 59 <tr>
@@ -132,11 +132,11 @@
132 132 <!-- multiplication table -->
133 133 <table id="multiplication" style="display:none">
134 134 <colgroup>
135   - <col width="50"/>
136   - <col width="50"/>
137   - <col width="50"/>
138   - <col width="50"/>
139   - <col width="50"/>
  135 + <col width="70"/>
  136 + <col width="70"/>
  137 + <col width="70"/>
  138 + <col width="70"/>
  139 + <col width="70"/>
140 140 </colgroup>
141 141 <tbody>
142 142 <tr>
@@ -215,7 +215,7 @@
215 215 <!-- trash -->
216 216 <table id="mini">
217 217 <colgroup>
218   - <col width="100"/>
  218 + <col width="70"/>
219 219 </colgroup>
220 220 <tbody>
221 221 <tr>
@@ -226,10 +226,10 @@
226 226 </div>
227 227 <!-- instructions -->
228 228 <div class="instructions">
229   - Try to drag numbers from top table to the first column.
230   - After dropping DIV element to the table cell, result will be automatically displayed.
231   - REDIPS.drag works in "overwrite" method so dropping number on top of existing content will overwrite bottom element.
232   - Numbers placed in first column can be cloned with shift key. Just press shift key and try to drag DIV element.
  229 + Try to drag numbers from top table to the first column in table below.
  230 + After dropping DIV element to the table cell, orange box with "?" will be automatically displayed to the most right column.
  231 + User should click on "?" and result will be shown.
  232 + REDIPS.drag works in "shift" mode so dropping number on top of existing content will shift other elements.
233 233 </div>
234 234 </div>
235 235 </body>
123 example25/script.js
@@ -4,63 +4,83 @@
4 4 /* enable strict mode */
5 5 "use strict";
6 6
7   -// define redipsInit variable
8   -var redipsInit,
9   - setTable,
10   - operation = 'addition';
  7 +
  8 +// create redips container
  9 +var redips = {};
11 10
12 11
13 12 // redips initialization
14   -redipsInit = function () {
  13 +redips.init = function () {
15 14 // reference to the REDIPS.drag class
16 15 var rd = REDIPS.drag;
  16 + // set initial math operation
  17 + redips.operation = 'addition';
17 18 // REDIPS.drag initialization
18 19 rd.init();
19   - // set overwrite mode
20   - rd.dropMode = 'overwrite';
21   - // enable cloning with shift key
22   - rd.clone.keyDiv = true;
23   - // event handler called after DIV is dropped
24   - rd.event.dropped = function (targetCell) {
  20 + // set shift mode and shift animation
  21 + rd.dropMode = 'shift';
  22 + rd.animation.shift = true;
  23 + // set vertical shift (each column is treated separately) and overflowed element will be deleted
  24 + rd.shift.mode = 'vertical2';
  25 + rd.shift.overflow = 'delete';
  26 + // event handler called after DIV is dropped (create result box in the most right column)
  27 + rd.event.dropped = function () {
25 28 var tr, // current row
26   - num1, num2; // numbers for addition or multiplication
27   - // set first multiplier
28   - num1 = rd.obj.innerHTML * 1;
  29 + num1, num2, // numbers for addition or multiplication
  30 + result; // result
29 31 // set current row
30   - tr = rd.findParent('TR', targetCell);
31   - // set second number
  32 + tr = REDIPS.drag.findParent('TR', rd.obj);
  33 + // set first and second number
  34 + num1 = rd.obj.innerHTML * 1;
32 35 num2 = tr.cells[2].innerHTML * 1;
33   - // add or multiply num1 and num2 and place result to the last cell in the row
34   - if (operation === 'addition') {
35   - tr.cells[4].innerHTML = num1 + num2;
36   - }
37   - else {
38   - tr.cells[4].innerHTML = num1 * num2;
  36 + // display result box
  37 + tr.cells[4].innerHTML = '<div class="result box r' + redips.math(num1, num2) + '" onclick="window.redips.showResult(this)">?</div>';
  38 + };
  39 + // even handler called when DIV element is moved (delete result box if DIV is moved in the bottom table)
  40 + rd.event.moved = function () {
  41 + // set source row
  42 + var tr = rd.findParent('TR', rd.td.source);
  43 + // if number is moved from bottom table then delete result box
  44 + if (tr.className.indexOf('upper') === -1) {
  45 + tr.cells[4].innerHTML = '';
39 46 }
40 47 };
41   - // even handler called when DIV element is moved
42   - rd.event.moved = function (cloned) {
43   - var tr;
44   - // if DIV element is not cloned
45   - if (!cloned) {
46   - // set source row
47   - tr = rd.findParent('TR', rd.td.source);
48   - // if number is moved from bottom table then delete result
49   - if (tr.className.indexOf('upper') === -1) {
50   - tr.cells[4].innerHTML = '';
  48 + // called before each DIV element is shifted (needed move orange box pn the right side)
  49 + rd.event.relocateBefore = function (div, to) {
  50 + var tr = rd.findParent('TR', div), // set current TR from DIV element that will be shifted by REDIPS.drag
  51 + resultDiv = tr.cells[4].getElementsByTagName('div')[0], // define result DIV (right orange DIV element)
  52 + target = to.parentNode.cells[4], // define target TD
  53 + num1 = div.innerHTML * 1; // set first number (from DIV element that will be shifted by REDIPS.drag)
  54 + // move right (orange) box
  55 + rd.moveObject({
  56 + obj: resultDiv,
  57 + target: target,
  58 + // call after result DIV is moved (el is reference to the moved DIV element)
  59 + callback: function (el) {
  60 + var targetTR = rd.findParent('TR', el), // set target TR
  61 + num2 = targetTR.cells[2].innerHTML * 1; // set number2 from target TR
  62 + // save (hide) new result to the class r(n+) and display "?"
  63 + el.className = el.className.replace(/r\d+/g, 'r' + redips.math(num1, num2));
  64 + el.innerHTML = '?';
51 65 }
52   - }
  66 + });
  67 + };
  68 + // delete last orange box when overflow happen (target is TD where overflow occurred)
  69 + rd.event.shiftOverflow = function (target) {
  70 + var rightCell = target.parentNode.cells[4];
  71 + // empty right cell
  72 + rd.emptyCell(rightCell);
53 73 };
54 74 };
55 75
56 76
57   -// set operation
58   -setTable = function (e) {
  77 +// set operation - addition / multiplication
  78 +redips.setTable = function (e) {
59 79 // set local variables
60 80 var tables = document.getElementById('drag').getElementsByTagName('table'),
61 81 i;
62 82 // set operation (global) - needed in event.dropped
63   - operation = e.options[e.selectedIndex].value;
  83 + redips.operation = e.options[e.selectedIndex].value;
64 84 // loop goes through all fetched tables within drag container
65 85 for (i = 0; i < tables.length; i++) {
66 86 // skip number or mini table
@@ -68,7 +88,7 @@ setTable = function (e) {
68 88 continue;
69 89 }
70 90 // show selected table
71   - else if (tables[i].id === operation) {
  91 + else if (tables[i].id === redips.operation) {
72 92 tables[i].style.display = '';
73 93 }
74 94 // hide all other tables
@@ -79,10 +99,35 @@ setTable = function (e) {
79 99 };
80 100
81 101
  102 +// do math with num1 and num2
  103 +redips.math = function (num1, num2) {
  104 + var result;
  105 + // add or multiply num1 and num2
  106 + if (redips.operation === 'addition') {
  107 + result = num1 + num2;
  108 + }
  109 + else {
  110 + result = num1 * num2;
  111 + }
  112 + // return result
  113 + return result;
  114 +};
  115 +
  116 +
  117 +// display result below "?" (called after user clicks on result DIV)
  118 +redips.showResult = function (div) {
  119 + // result is saved as a class name r(n+)
  120 + var className = div.className,
  121 + matchArray = className.match(/r(\d+)/);
  122 + // show result
  123 + div.innerHTML = matchArray[1];
  124 +};
  125 +
  126 +
82 127 // add onload event listener
83 128 if (window.addEventListener) {
84   - window.addEventListener('load', redipsInit, false);
  129 + window.addEventListener('load', redips.init, false);
85 130 }
86 131 else if (window.attachEvent) {
87   - window.attachEvent('onload', redipsInit);
  132 + window.attachEvent('onload', redips.init);
88 133 }
24 example25/style.css
@@ -14,7 +14,7 @@ body {
14 14 /* main container */
15 15 #main_container{
16 16 margin: auto;
17   - width: 570px;
  17 + width: 670px;
18 18 }
19 19
20 20 /* make drag container visible */
@@ -39,23 +39,37 @@ div#drag td {
39 39 padding: 2px;
40 40 }
41 41
42   -/* DIV elements */
43   -.drag {
  42 +/* BOX class (common styles used for drag and result DIV */
  43 +.box {
44 44 margin: auto;
45 45 margin-bottom: 1px;
46 46 margin-top: 1px;
47 47 font-size: 20pt;
48 48 text-align: center;
49   - width: 40px;
  49 + width: 56px;
50 50 height: 40px;
51 51 line-height: 40px;
52   - border: 2px solid SteelBlue;
53 52 background-color: white;
54 53 /* round corners */
55 54 border-radius: 4px; /* Opera, Chrome */
56 55 -moz-border-radius: 4px; /* FF */
57 56 }
58 57
  58 +/* DIV elements */
  59 +.drag {
  60 + background-color: #CDE1F2;
  61 + border: 2px solid SteelBlue;
  62 +}
  63 +
  64 +/* result DIV */
  65 +.result {
  66 + background-color: #FFE6C4;
  67 + border: 2px solid #A66C1D;
  68 + /* cursor */
  69 + cursor: pointer;
  70 + cursor: hand;
  71 +}
  72 +
59 73 /* forbidden cells */
60 74 .mark {
61 75 background-color: #eee;
98 redips-drag-min.js
@@ -3,68 +3,68 @@ Copyright (c) 2008-2011, www.redips.net All rights reserved.
3 3 Code licensed under the BSD License: http://www.redips.net/license/
4 4 http://www.redips.net/javascript/drag-and-drop-table-content/
5 5 Version 5.0.4
6   -Dec 20, 2012.
  6 +Dec 21, 2012.
7 7 */
8 8 var REDIPS=REDIPS||{};
9   -REDIPS.drag=function(){var q,B,K,za,La,Ma,ca,da,ia,Aa,Ba,V,ja,Ca,R,ka,Z,Da,C,u,O,la,ma,na,Ea,oa,Fa,E,x,Ga,ea,fa,pa,Na,Oa,Ha,qa,Ia,ra,ga,Ja,Pa,sa,Qa,n=null,G=0,H=0,ta=null,ua=null,L=[],s=null,M=0,N=0,P=0,Q=0,S=0,T=0,$,f=[],aa,va,p,I=[],m=[],y=null,D=null,W=0,X=0,Ra=0,Sa=0,ha=!1,Ka=!1,ba=!1,wa=[],h=null,t=null,z=null,j=null,v=null,J=null,k=null,A=null,U=null,i=!1,o=!1,r="cell",xa={div:[],cname:"only",other:"deny"},Ta={action:"deny",cname:"mark",exception:[]},l={},Ua={keyDiv:!1,keyRow:!1,sendBack:!1,
10   -drop:!1};K=function(){return!1};q=function(a){var b,c,d,e,g;f.length=0;e=void 0===a?y.getElementsByTagName("table"):document.querySelectorAll(a);for(b=a=0;a<e.length;a++)if(!("redips_clone"===e[a].parentNode.id||-1<e[a].className.indexOf("nolayout"))){c=e[a].parentNode;d=0;do"TD"===c.nodeName&&d++,c=c.parentNode;while(c&&c!==y);f[b]=e[a];f[b].redips||(f[b].redips={});f[b].redips.container=y;f[b].redips.nestedLevel=d;f[b].redips.idx=b;wa[b]=0;d=f[b].getElementsByTagName("td");c=0;for(g=!1;c<d.length;c++)if(1<
11   -d[c].rowSpan){g=!0;break}f[b].redips.rowspan=g;b++}a=0;for(e=aa=1;a<f.length;a++)if(0===f[a].redips.nestedLevel){f[a].redips.nestedGroup=e;f[a].redips.sort=100*aa;c=f[a].getElementsByTagName("table");for(b=0;b<c.length;b++)-1<c[b].className.indexOf("nolayout")||(c[b].redips.nestedGroup=e,c[b].redips.sort=100*aa+c[b].redips.nestedLevel);e++;aa++}};za=function(a){var b=a||window.event,c,d;if(!0===this.redips.animated)return!0;b.cancelBubble=!0;b.stopPropagation&&b.stopPropagation();Ka=b.shiftKey;a=
12   -b.which?b.which:b.button;if(Fa(b)||!b.touches&&1!==a)return!0;if(window.getSelection)window.getSelection().removeAllRanges();else if(document.selection&&"Text"===document.selection.type)try{document.selection.empty()}catch(e){}b.touches?(a=W=b.touches[0].clientX,d=X=b.touches[0].clientY):(a=W=b.clientX,d=X=b.clientY);Ra=a;Sa=d;ha=!1;REDIPS.drag.objOld=o=i||this;REDIPS.drag.obj=i=this;ba=-1<i.className.indexOf("clone")?!0:!1;REDIPS.drag.tableSort&&Ma(i);y!==i.redips.container&&(y=i.redips.container,
13   -q());-1===i.className.indexOf("row")?REDIPS.drag.mode=r="cell":(REDIPS.drag.mode=r="row",REDIPS.drag.obj=i=ga(i));u();!ba&&"cell"===r&&(i.style.zIndex=999);h=j=k=null;R();z=t=h;J=v=j;U=A=k;REDIPS.drag.td.source=l.source=x("TD",i);REDIPS.drag.td.current=l.current=l.source;REDIPS.drag.td.previous=l.previous=l.source;"cell"===r?REDIPS.drag.event.clicked(l.current):REDIPS.drag.event.rowClicked(l.current);if(null===h||null===j||null===k)if(R(),z=t=h,J=v=j,U=A=k,null===h||null===j||null===k)return!0;va=
14   -p=!1;REDIPS.event.add(document,"mousemove",da);REDIPS.event.add(document,"touchmove",da);REDIPS.event.add(document,"mouseup",ca);REDIPS.event.add(document,"touchend",ca);i.setCapture&&i.setCapture();null!==h&&(null!==j&&null!==k)&&($=Da(h,j,k));c=E(f[z],"position");"fixed"!==c&&(c=E(f[z].parentNode,"position"));c=C(i,c);n=[d-c[0],c[1]-a,c[2]-d,a-c[3]];y.onselectstart=function(a){b=a||window.event;if(!Fa(b)){b.shiftKey&&document.selection.clear();return false}};return!1};La=function(){REDIPS.drag.event.dblClicked()};
15   -Ma=function(a){var b;b=x("TABLE",a).redips.nestedGroup;for(a=0;a<f.length;a++)f[a].redips.nestedGroup===b&&(f[a].redips.sort=100*aa+f[a].redips.nestedLevel);f.sort(function(a,b){return b.redips.sort-a.redips.sort});aa++};ga=function(a,b){var c,d,e,g,f,w;if("DIV"===a.nodeName)return g=a,a=x("TR",a),void 0===a.redips&&(a.redips={}),a.redips.div=g,a;d=a;void 0===d.redips&&(d.redips={});a=x("TABLE",a);ba&&p&&(g=d.redips.div,g.className=sa(g.className.replace("clone","")));c=a.cloneNode(!0);ba&&p&&(g.className+=
16   -" clone");e=c.rows.length-1;g="animated"===b?0===e?!0:!1:!0;for(f=e;0<=f;f--)if(f!==d.rowIndex){if(!0===g&&void 0===b){e=c.rows[f];for(w=0;w<e.cells.length;w++)if(-1<e.cells[w].className.indexOf("rowhandler")){g=!1;break}}c.deleteRow(f)}p||(d.redips.emptyRow=g);c.redips={};c.redips.container=a.redips.container;c.redips.sourceRow=d;Pa(d,c.rows[0]);Ea(d,c.rows[0]);document.getElementById("redips_clone").appendChild(c);d=C(d,"fixed");c.style.position="fixed";c.style.top=d[0]+"px";c.style.left=d[3]+"px";
17   -c.style.width=d[1]-d[3]+"px";return c};Ja=function(a,b,c){var d=!1,e,g,ya,w,j,F,Y,k;k=function(a){var b;void 0===a.redips||!a.redips.emptyRow?(b=x("TABLE",a),b.deleteRow(a.rowIndex)):ra(a,"empty",REDIPS.drag.style.rowEmptyColor)};void 0===c?c=i:d=!0;e=c.redips.sourceRow;g=e.rowIndex;ya=x("TABLE",e);w=ya.rows[0].parentNode;j=f[a];F=j.rows[b];Y=j.rows[0].parentNode;a=c.getElementsByTagName("tr")[0];c.parentNode.removeChild(c);!1!==REDIPS.drag.event.rowDroppedBefore(ya,g)&&(!d&&-1<l.target.className.indexOf(REDIPS.drag.trash.className)?
  9 +REDIPS.drag=function(){var q,B,K,Aa,La,Ma,ca,da,ia,Ba,Ca,V,ja,Da,R,ka,Z,Ea,C,u,O,la,ma,na,Fa,oa,Ga,E,x,Ha,ea,fa,pa,Na,Oa,Ia,qa,ra,sa,ga,Ja,Pa,ta,Qa,n=null,G=0,H=0,ua=null,va=null,L=[],s=null,M=0,N=0,P=0,Q=0,S=0,T=0,$,f=[],aa,wa,p,I=[],m=[],y=null,D=null,W=0,X=0,Ra=0,Sa=0,ha=!1,Ka=!1,ba=!1,xa=[],h=null,t=null,z=null,j=null,v=null,J=null,k=null,A=null,U=null,i=!1,o=!1,r="cell",ya={div:[],cname:"only",other:"deny"},Ta={action:"deny",cname:"mark",exception:[]},l={},Ua={keyDiv:!1,keyRow:!1,sendBack:!1,
  10 +drop:!1};K=function(){return!1};q=function(a){var b,c,d,e,g;f.length=0;e=void 0===a?y.getElementsByTagName("table"):document.querySelectorAll(a);for(b=a=0;a<e.length;a++)if(!("redips_clone"===e[a].parentNode.id||-1<e[a].className.indexOf("nolayout"))){c=e[a].parentNode;d=0;do"TD"===c.nodeName&&d++,c=c.parentNode;while(c&&c!==y);f[b]=e[a];f[b].redips||(f[b].redips={});f[b].redips.container=y;f[b].redips.nestedLevel=d;f[b].redips.idx=b;xa[b]=0;d=f[b].getElementsByTagName("td");c=0;for(g=!1;c<d.length;c++)if(1<
  11 +d[c].rowSpan){g=!0;break}f[b].redips.rowspan=g;b++}a=0;for(e=aa=1;a<f.length;a++)if(0===f[a].redips.nestedLevel){f[a].redips.nestedGroup=e;f[a].redips.sort=100*aa;c=f[a].getElementsByTagName("table");for(b=0;b<c.length;b++)-1<c[b].className.indexOf("nolayout")||(c[b].redips.nestedGroup=e,c[b].redips.sort=100*aa+c[b].redips.nestedLevel);e++;aa++}};Aa=function(a){var b=a||window.event,c,d;if(!0===this.redips.animated)return!0;b.cancelBubble=!0;b.stopPropagation&&b.stopPropagation();Ka=b.shiftKey;a=
  12 +b.which?b.which:b.button;if(Ga(b)||!b.touches&&1!==a)return!0;if(window.getSelection)window.getSelection().removeAllRanges();else if(document.selection&&"Text"===document.selection.type)try{document.selection.empty()}catch(e){}b.touches?(a=W=b.touches[0].clientX,d=X=b.touches[0].clientY):(a=W=b.clientX,d=X=b.clientY);Ra=a;Sa=d;ha=!1;REDIPS.drag.objOld=o=i||this;REDIPS.drag.obj=i=this;ba=-1<i.className.indexOf("clone")?!0:!1;REDIPS.drag.tableSort&&Ma(i);y!==i.redips.container&&(y=i.redips.container,
  13 +q());-1===i.className.indexOf("row")?REDIPS.drag.mode=r="cell":(REDIPS.drag.mode=r="row",REDIPS.drag.obj=i=ga(i));u();!ba&&"cell"===r&&(i.style.zIndex=999);h=j=k=null;R();z=t=h;J=v=j;U=A=k;REDIPS.drag.td.source=l.source=x("TD",i);REDIPS.drag.td.current=l.current=l.source;REDIPS.drag.td.previous=l.previous=l.source;"cell"===r?REDIPS.drag.event.clicked(l.current):REDIPS.drag.event.rowClicked(l.current);if(null===h||null===j||null===k)if(R(),z=t=h,J=v=j,U=A=k,null===h||null===j||null===k)return!0;wa=
  14 +p=!1;REDIPS.event.add(document,"mousemove",da);REDIPS.event.add(document,"touchmove",da);REDIPS.event.add(document,"mouseup",ca);REDIPS.event.add(document,"touchend",ca);i.setCapture&&i.setCapture();null!==h&&(null!==j&&null!==k)&&($=Ea(h,j,k));c=E(f[z],"position");"fixed"!==c&&(c=E(f[z].parentNode,"position"));c=C(i,c);n=[d-c[0],c[1]-a,c[2]-d,a-c[3]];y.onselectstart=function(a){b=a||window.event;if(!Ga(b)){b.shiftKey&&document.selection.clear();return false}};return!1};La=function(){REDIPS.drag.event.dblClicked()};
  15 +Ma=function(a){var b;b=x("TABLE",a).redips.nestedGroup;for(a=0;a<f.length;a++)f[a].redips.nestedGroup===b&&(f[a].redips.sort=100*aa+f[a].redips.nestedLevel);f.sort(function(a,b){return b.redips.sort-a.redips.sort});aa++};ga=function(a,b){var c,d,e,g,f,w;if("DIV"===a.nodeName)return g=a,a=x("TR",a),void 0===a.redips&&(a.redips={}),a.redips.div=g,a;d=a;void 0===d.redips&&(d.redips={});a=x("TABLE",a);ba&&p&&(g=d.redips.div,g.className=ta(g.className.replace("clone","")));c=a.cloneNode(!0);ba&&p&&(g.className+=
  16 +" clone");e=c.rows.length-1;g="animated"===b?0===e?!0:!1:!0;for(f=e;0<=f;f--)if(f!==d.rowIndex){if(!0===g&&void 0===b){e=c.rows[f];for(w=0;w<e.cells.length;w++)if(-1<e.cells[w].className.indexOf("rowhandler")){g=!1;break}}c.deleteRow(f)}p||(d.redips.emptyRow=g);c.redips={};c.redips.container=a.redips.container;c.redips.sourceRow=d;Pa(d,c.rows[0]);Fa(d,c.rows[0]);document.getElementById("redips_clone").appendChild(c);d=C(d,"fixed");c.style.position="fixed";c.style.top=d[0]+"px";c.style.left=d[3]+"px";
  17 +c.style.width=d[1]-d[3]+"px";return c};Ja=function(a,b,c){var d=!1,e,g,za,w,j,F,Y,k;k=function(a){var b;void 0===a.redips||!a.redips.emptyRow?(b=x("TABLE",a),b.deleteRow(a.rowIndex)):sa(a,"empty",REDIPS.drag.style.rowEmptyColor)};void 0===c?c=i:d=!0;e=c.redips.sourceRow;g=e.rowIndex;za=x("TABLE",e);w=za.rows[0].parentNode;j=f[a];F=j.rows[b];Y=j.rows[0].parentNode;a=c.getElementsByTagName("tr")[0];c.parentNode.removeChild(c);!1!==REDIPS.drag.event.rowDroppedBefore(za,g)&&(!d&&-1<l.target.className.indexOf(REDIPS.drag.trash.className)?
18 18 p?REDIPS.drag.event.rowDeleted():REDIPS.drag.trash.questionRow?confirm(REDIPS.drag.trash.questionRow)?(k(e),REDIPS.drag.event.rowDeleted()):(delete o.redips.emptyRow,REDIPS.drag.event.rowUndeleted()):(k(e),REDIPS.drag.event.rowDeleted()):(b<j.rows.length?h===z?g>b?Y.insertBefore(a,F):Y.insertBefore(a,F.nextSibling):"after"===REDIPS.drag.rowDropMode?Y.insertBefore(a,F.nextSibling):Y.insertBefore(a,F):(Y.appendChild(a),F=j.rows[0]),F&&F.redips&&F.redips.emptyRow?Y.deleteRow(F.rowIndex):"overwrite"===
19   -REDIPS.drag.rowDropMode?k(F):"switch"===REDIPS.drag.rowDropMode&&!p&&(w.insertBefore(F,e),void 0!==e.redips&&delete e.redips.emptyRow),(d||!p)&&k(e),delete a.redips.emptyRow,d||REDIPS.drag.event.rowDropped(a,ya,g)),0<a.getElementsByTagName("table").length&&q())};Pa=function(a,b){var c,d,e,g=[],f=[];g[0]=a.getElementsByTagName("input");g[1]=a.getElementsByTagName("textarea");g[2]=a.getElementsByTagName("select");f[0]=b.getElementsByTagName("input");f[1]=b.getElementsByTagName("textarea");f[2]=b.getElementsByTagName("select");
  19 +REDIPS.drag.rowDropMode?k(F):"switch"===REDIPS.drag.rowDropMode&&!p&&(w.insertBefore(F,e),void 0!==e.redips&&delete e.redips.emptyRow),(d||!p)&&k(e),delete a.redips.emptyRow,d||REDIPS.drag.event.rowDropped(a,za,g)),0<a.getElementsByTagName("table").length&&q())};Pa=function(a,b){var c,d,e,g=[],f=[];g[0]=a.getElementsByTagName("input");g[1]=a.getElementsByTagName("textarea");g[2]=a.getElementsByTagName("select");f[0]=b.getElementsByTagName("input");f[1]=b.getElementsByTagName("textarea");f[2]=b.getElementsByTagName("select");
20 20 for(c=0;c<g.length;c++)for(d=0;d<g[c].length;d++)switch(e=g[c][d].type,e){case "text":case "textarea":case "password":f[c][d].value=g[c][d].value;break;case "radio":case "checkbox":f[c][d].checked=g[c][d].checked;break;case "select-one":f[c][d].selectedIndex=g[c][d].selectedIndex;break;case "select-multiple":for(e=0;e<g[c][d].options.length;e++)f[c][d].options[e].selected=g[c][d].options[e].selected}};ca=function(a){var b=a||window.event,c,d,e,a=b.clientX;e=b.clientY;S=T=0;i.releaseCapture&&i.releaseCapture();
21   -REDIPS.event.remove(document,"mousemove",da);REDIPS.event.remove(document,"touchmove",da);REDIPS.event.remove(document,"mouseup",ca);REDIPS.event.remove(document,"touchend",ca);y.onselectstart=null;Ba(i);ta=document.documentElement.scrollWidth;ua=document.documentElement.scrollHeight;S=T=0;if(p&&"cell"===r&&(null===h||null===j||null===k))i.parentNode.removeChild(i),I[o.id]-=1,REDIPS.drag.event.notCloned();else if(null===h||null===j||null===k)REDIPS.drag.event.notMoved();else{h<f.length?(b=f[h],REDIPS.drag.td.target=
22   -l.target=b.rows[j].cells[k],Z(h,j,k,$),c=h,d=j):null===t||null===v||null===A?(b=f[z],REDIPS.drag.td.target=l.target=b.rows[J].cells[U],Z(z,J,U,$),c=z,d=J):(b=f[t],REDIPS.drag.td.target=l.target=b.rows[v].cells[A],Z(t,v,A,$),c=t,d=v);if("row"===r)if(va)if(z===c&&J===d){b=i.getElementsByTagName("tr")[0];o.style.backgroundColor=b.style.backgroundColor;for(a=0;a<b.cells.length;a++)o.cells[a].style.backgroundColor=b.cells[a].style.backgroundColor;i.parentNode.removeChild(i);delete o.redips.emptyRow;p?
  21 +REDIPS.event.remove(document,"mousemove",da);REDIPS.event.remove(document,"touchmove",da);REDIPS.event.remove(document,"mouseup",ca);REDIPS.event.remove(document,"touchend",ca);y.onselectstart=null;Ca(i);ua=document.documentElement.scrollWidth;va=document.documentElement.scrollHeight;S=T=0;if(p&&"cell"===r&&(null===h||null===j||null===k))i.parentNode.removeChild(i),I[o.id]-=1,REDIPS.drag.event.notCloned();else if(null===h||null===j||null===k)REDIPS.drag.event.notMoved();else{h<f.length?(b=f[h],REDIPS.drag.td.target=
  22 +l.target=b.rows[j].cells[k],Z(h,j,k,$),c=h,d=j):null===t||null===v||null===A?(b=f[z],REDIPS.drag.td.target=l.target=b.rows[J].cells[U],Z(z,J,U,$),c=z,d=J):(b=f[t],REDIPS.drag.td.target=l.target=b.rows[v].cells[A],Z(t,v,A,$),c=t,d=v);if("row"===r)if(wa)if(z===c&&J===d){b=i.getElementsByTagName("tr")[0];o.style.backgroundColor=b.style.backgroundColor;for(a=0;a<b.cells.length;a++)o.cells[a].style.backgroundColor=b.cells[a].style.backgroundColor;i.parentNode.removeChild(i);delete o.redips.emptyRow;p?
23 23 REDIPS.drag.event.rowNotCloned():REDIPS.drag.event.rowDroppedSource(l.target)}else Ja(c,d);else REDIPS.drag.event.rowNotMoved();else if(!p&&!ha)REDIPS.drag.event.notMoved();else if(p&&z===h&&J===j&&U===k)i.parentNode.removeChild(i),I[o.id]-=1,REDIPS.drag.event.notCloned();else if(p&&!1===REDIPS.drag.clone.drop&&(a<b.redips.offset[3]||a>b.redips.offset[1]||e<b.redips.offset[0]||e>b.redips.offset[2]))i.parentNode.removeChild(i),I[o.id]-=1,REDIPS.drag.event.notCloned();else if(-1<l.target.className.indexOf(REDIPS.drag.trash.className))i.parentNode.removeChild(i),
24   -REDIPS.drag.trash.question?setTimeout(function(){if(confirm(REDIPS.drag.trash.question))Aa();else{if(!p){f[z].rows[J].cells[U].appendChild(i);u()}REDIPS.drag.event.undeleted()}},20):Aa();else if("switch"===REDIPS.drag.dropMode)if(a=REDIPS.drag.event.droppedBefore(l.target),!1===a)ia(!1);else{i.parentNode.removeChild(i);b=l.target.getElementsByTagName("div");c=b.length;for(a=0;a<c;a++)void 0!==b[0]&&(REDIPS.drag.objOld=o=b[0],l.source.appendChild(o),V(o));ia();c&&REDIPS.drag.event.switched()}else"overwrite"===
  24 +REDIPS.drag.trash.question?setTimeout(function(){if(confirm(REDIPS.drag.trash.question))Ba();else{if(!p){f[z].rows[J].cells[U].appendChild(i);u()}REDIPS.drag.event.undeleted()}},20):Ba();else if("switch"===REDIPS.drag.dropMode)if(a=REDIPS.drag.event.droppedBefore(l.target),!1===a)ia(!1);else{i.parentNode.removeChild(i);b=l.target.getElementsByTagName("div");c=b.length;for(a=0;a<c;a++)void 0!==b[0]&&(REDIPS.drag.objOld=o=b[0],l.source.appendChild(o),V(o));ia();c&&REDIPS.drag.event.switched()}else"overwrite"===
25 25 REDIPS.drag.dropMode?(a=REDIPS.drag.event.droppedBefore(l.target),!1!==a&&fa(l.target)):a=REDIPS.drag.event.droppedBefore(l.target),ia(a);"cell"===r&&0<i.getElementsByTagName("table").length&&q();u();REDIPS.drag.event.finish()}t=v=A=null};ia=function(a){var b=null,c;if(!1!==a){if(!0===Ua.sendBack){a=l.target.getElementsByTagName("DIV");for(c=0;c<a.length;c++)if(i!==a[c]&&0===i.id.indexOf(a[c].id)){b=a[c];break}if(b){oa(b,1);i.parentNode.removeChild(i);return}}"shift"===REDIPS.drag.dropMode&&(Qa(l.target)||
26   -"always"===REDIPS.drag.shift.after)&&pa(l.source,l.target);"top"===REDIPS.drag.multipleDrop&&l.target.hasChildNodes()?l.target.insertBefore(i,l.target.firstChild):l.target.appendChild(i);V(i);REDIPS.drag.event.dropped(l.target);p&&(REDIPS.drag.event.clonedDropped(l.target),oa(o,-1))}else p&&i.parentNode&&i.parentNode.removeChild(i)};V=function(a,b){!1===b?(a.onmousedown=null,a.ontouchstart=null,a.ondblclick=null):(a.onmousedown=za,a.ontouchstart=za,a.ondblclick=La)};Ba=function(a){a.style.top="";
27   -a.style.left="";a.style.position="";a.style.zIndex=""};Aa=function(){var a;p&&oa(o,-1);if("shift"===REDIPS.drag.dropMode&&("delete"===REDIPS.drag.shift.after||"always"===REDIPS.drag.shift.after)){switch(REDIPS.drag.shift.mode){case "vertical2":a="lastInColumn";break;case "horizontal2":a="lastInRow";break;default:a="last"}pa(l.source,Ga(a,l.source)[2])}REDIPS.drag.event.deleted(p)};da=function(a){var a=a||window.event,b=REDIPS.drag.scroll.bound,c,d,e,g;a.touches?(d=W=a.touches[0].clientX,e=X=a.touches[0].clientY):
28   -(d=W=a.clientX,e=X=a.clientY);c=Math.abs(Ra-d);g=Math.abs(Sa-e);if(!va){if("cell"===r&&(ba||!0===REDIPS.drag.clone.keyDiv&&Ka))REDIPS.drag.objOld=o=i,REDIPS.drag.obj=i=na(i,!0),p=!0,REDIPS.drag.event.cloned();else{if("row"===r){if(ba||!0===REDIPS.drag.clone.keyRow&&Ka)p=!0;REDIPS.drag.objOld=o=i;REDIPS.drag.obj=i=ga(i);i.style.zIndex=999}i.setCapture&&i.setCapture();i.style.position="fixed";u();R();"row"===r&&(p?REDIPS.drag.event.rowCloned():REDIPS.drag.event.rowMoved())}ka();d>G-n[1]&&(i.style.left=
29   -G-(n[1]+n[3])+"px");e>H-n[2]&&(i.style.top=H-(n[0]+n[2])+"px")}va=!0;if("cell"===r&&(7<c||7<g)&&!ha)ha=!0,ka(),REDIPS.drag.event.moved(p);d>n[3]&&d<G-n[1]&&(i.style.left=d-n[3]+"px");e>n[0]&&e<H-n[2]&&(i.style.top=e-n[0]+"px");if(d<D[1]&&d>D[3]&&e<D[2]&&e>D[0]&&0===S&&0===T&&(m.containTable||d<m[3]||d>m[1]||e<m[0]||e>m[2]))R(),ja();if(REDIPS.drag.scroll.enable){M=b-(G/2>d?d-n[3]:G-d-n[1]);if(0<M){if(M>b&&(M=b),c=O()[0],M*=d<G/2?-1:1,!(0>M&&0>=c||0<M&&c>=ta-G)&&0===S++)REDIPS.event.remove(window,"scroll",
30   -u),la(window)}else M=0;N=b-(H/2>e?e-n[0]:H-e-n[2]);if(0<N){if(N>b&&(N=b),c=O()[1],N*=e<H/2?-1:1,!(0>N&&0>=c||0<N&&c>=ua-H)&&0===T++)REDIPS.event.remove(window,"scroll",u),ma(window)}else N=0;for(g=0;g<L.length;g++)if(c=L[g],c.autoscroll&&d<c.offset[1]&&d>c.offset[3]&&e<c.offset[2]&&e>c.offset[0]){P=b-(c.midstX>d?d-n[3]-c.offset[3]:c.offset[1]-d-n[1]);0<P?(P>b&&(P=b),P*=d<c.midstX?-1:1,0===S++&&(REDIPS.event.remove(c.div,"scroll",u),la(c.div))):P=0;Q=b-(c.midstY>e?e-n[0]-c.offset[0]:c.offset[2]-e-
  26 +"always"===REDIPS.drag.shift.after)&&pa(l.source,l.target);"top"===REDIPS.drag.multipleDrop&&l.target.hasChildNodes()?l.target.insertBefore(i,l.target.firstChild):l.target.appendChild(i);V(i);REDIPS.drag.event.dropped(l.target);p&&(REDIPS.drag.event.clonedDropped(l.target),oa(o,-1))}else p&&i.parentNode&&i.parentNode.removeChild(i)};V=function(a,b){!1===b?(a.onmousedown=null,a.ontouchstart=null,a.ondblclick=null):(a.onmousedown=Aa,a.ontouchstart=Aa,a.ondblclick=La)};Ca=function(a){a.style.top="";
  27 +a.style.left="";a.style.position="";a.style.zIndex=""};Ba=function(){var a;p&&oa(o,-1);if("shift"===REDIPS.drag.dropMode&&("delete"===REDIPS.drag.shift.after||"always"===REDIPS.drag.shift.after)){switch(REDIPS.drag.shift.mode){case "vertical2":a="lastInColumn";break;case "horizontal2":a="lastInRow";break;default:a="last"}pa(l.source,Ha(a,l.source)[2])}REDIPS.drag.event.deleted(p)};da=function(a){var a=a||window.event,b=REDIPS.drag.scroll.bound,c,d,e,g;a.touches?(d=W=a.touches[0].clientX,e=X=a.touches[0].clientY):
  28 +(d=W=a.clientX,e=X=a.clientY);c=Math.abs(Ra-d);g=Math.abs(Sa-e);if(!wa){if("cell"===r&&(ba||!0===REDIPS.drag.clone.keyDiv&&Ka))REDIPS.drag.objOld=o=i,REDIPS.drag.obj=i=na(i,!0),p=!0,REDIPS.drag.event.cloned();else{if("row"===r){if(ba||!0===REDIPS.drag.clone.keyRow&&Ka)p=!0;REDIPS.drag.objOld=o=i;REDIPS.drag.obj=i=ga(i);i.style.zIndex=999}i.setCapture&&i.setCapture();i.style.position="fixed";u();R();"row"===r&&(p?REDIPS.drag.event.rowCloned():REDIPS.drag.event.rowMoved())}ka();d>G-n[1]&&(i.style.left=
  29 +G-(n[1]+n[3])+"px");e>H-n[2]&&(i.style.top=H-(n[0]+n[2])+"px")}wa=!0;if("cell"===r&&(7<c||7<g)&&!ha)ha=!0,ka(),REDIPS.drag.event.moved(p);d>n[3]&&d<G-n[1]&&(i.style.left=d-n[3]+"px");e>n[0]&&e<H-n[2]&&(i.style.top=e-n[0]+"px");if(d<D[1]&&d>D[3]&&e<D[2]&&e>D[0]&&0===S&&0===T&&(m.containTable||d<m[3]||d>m[1]||e<m[0]||e>m[2]))R(),ja();if(REDIPS.drag.scroll.enable){M=b-(G/2>d?d-n[3]:G-d-n[1]);if(0<M){if(M>b&&(M=b),c=O()[0],M*=d<G/2?-1:1,!(0>M&&0>=c||0<M&&c>=ua-G)&&0===S++)REDIPS.event.remove(window,"scroll",
  30 +u),la(window)}else M=0;N=b-(H/2>e?e-n[0]:H-e-n[2]);if(0<N){if(N>b&&(N=b),c=O()[1],N*=e<H/2?-1:1,!(0>N&&0>=c||0<N&&c>=va-H)&&0===T++)REDIPS.event.remove(window,"scroll",u),ma(window)}else N=0;for(g=0;g<L.length;g++)if(c=L[g],c.autoscroll&&d<c.offset[1]&&d>c.offset[3]&&e<c.offset[2]&&e>c.offset[0]){P=b-(c.midstX>d?d-n[3]-c.offset[3]:c.offset[1]-d-n[1]);0<P?(P>b&&(P=b),P*=d<c.midstX?-1:1,0===S++&&(REDIPS.event.remove(c.div,"scroll",u),la(c.div))):P=0;Q=b-(c.midstY>e?e-n[0]-c.offset[0]:c.offset[2]-e-
31 31 n[2]);0<Q?(Q>b&&(Q=b),Q*=e<c.midstY?-1:1,0===T++&&(REDIPS.event.remove(c.div,"scroll",u),ma(c.div))):Q=0;break}else P=Q=0}a.cancelBubble=!0;a.stopPropagation&&a.stopPropagation()};ja=function(){if(h<f.length&&(h!==t||j!==v||k!==A))null!==t&&(null!==v&&null!==A)&&(Z(t,v,A,$),REDIPS.drag.td.previous=l.previous=f[t].rows[v].cells[A],REDIPS.drag.td.current=l.current=f[h].rows[j].cells[k],"switching"===REDIPS.drag.dropMode&&"cell"===r&&(ea(l.current,l.previous),u(),R()),"cell"===r?REDIPS.drag.event.changed(l.current):
32   -"row"===r&&(h!==t||j!==v)&&REDIPS.drag.event.rowChanged(l.current)),ka()};Ca=function(){if("number"===typeof window.innerWidth)G=window.innerWidth,H=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))G=document.documentElement.clientWidth,H=document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight))G=document.body.clientWidth,H=document.body.clientHeight;ta=document.documentElement.scrollWidth;
33   -ua=document.documentElement.scrollHeight;u()};R=function(){var a,b,c,d,e,g;c=[];a=function(){null!==t&&(null!==v&&null!==A)&&(h=t,j=v,k=A)};b=W;g=X;for(h=0;h<f.length;h++)if(!1!==f[h].redips.enabled&&(c[0]=f[h].redips.offset[0],c[1]=f[h].redips.offset[1],c[2]=f[h].redips.offset[2],c[3]=f[h].redips.offset[3],void 0!==f[h].sca&&(c[0]=c[0]>f[h].sca.offset[0]?c[0]:f[h].sca.offset[0],c[1]=c[1]<f[h].sca.offset[1]?c[1]:f[h].sca.offset[1],c[2]=c[2]<f[h].sca.offset[2]?c[2]:f[h].sca.offset[2],c[3]=c[3]>f[h].sca.offset[3]?
  32 +"row"===r&&(h!==t||j!==v)&&REDIPS.drag.event.rowChanged(l.current)),ka()};Da=function(){if("number"===typeof window.innerWidth)G=window.innerWidth,H=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))G=document.documentElement.clientWidth,H=document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight))G=document.body.clientWidth,H=document.body.clientHeight;ua=document.documentElement.scrollWidth;
  33 +va=document.documentElement.scrollHeight;u()};R=function(){var a,b,c,d,e,g;c=[];a=function(){null!==t&&(null!==v&&null!==A)&&(h=t,j=v,k=A)};b=W;g=X;for(h=0;h<f.length;h++)if(!1!==f[h].redips.enabled&&(c[0]=f[h].redips.offset[0],c[1]=f[h].redips.offset[1],c[2]=f[h].redips.offset[2],c[3]=f[h].redips.offset[3],void 0!==f[h].sca&&(c[0]=c[0]>f[h].sca.offset[0]?c[0]:f[h].sca.offset[0],c[1]=c[1]<f[h].sca.offset[1]?c[1]:f[h].sca.offset[1],c[2]=c[2]<f[h].sca.offset[2]?c[2]:f[h].sca.offset[2],c[3]=c[3]>f[h].sca.offset[3]?
34 34 c[3]:f[h].sca.offset[3]),c[3]<b&&b<c[1]&&c[0]<g&&g<c[2])){c=f[h].redips.row_offset;for(j=0;j<c.length-1;j++)if(void 0!==c[j]){m[0]=c[j][0];if(void 0!==c[j+1])m[2]=c[j+1][0];else for(d=j+2;d<c.length;d++)if(void 0!==c[d]){m[2]=c[d][0];break}if(g<=m[2])break}d=j;j===c.length-1&&(m[0]=c[j][0],m[2]=f[h].redips.offset[2]);do for(k=e=f[h].rows[j].cells.length-1;0<=k&&!(m[3]=c[j][3]+f[h].rows[j].cells[k].offsetLeft,m[1]=m[3]+f[h].rows[j].cells[k].offsetWidth,m[3]<=b&&b<=m[1]);k--);while(f[h].redips.rowspan&&
35   --1===k&&0<j--);0>j||0>k?a():j!==d&&(m[0]=c[j][0],m[2]=m[0]+f[h].rows[j].cells[k].offsetHeight,(g<m[0]||g>m[2])&&a());b=f[h].rows[j].cells[k];m.containTable=0<b.childNodes.length&&0<b.getElementsByTagName("table").length?!0:!1;if(-1===b.className.indexOf(REDIPS.drag.trash.className))if(g=-1<b.className.indexOf(REDIPS.drag.only.cname)?!0:!1,!0===g){if(-1===b.className.indexOf(xa.div[i.id])){a();break}}else if(void 0!==xa.div[i.id]&&"deny"===xa.other){a();break}else if(g=-1<b.className.indexOf(REDIPS.drag.mark.cname)?
  35 +-1===k&&0<j--);0>j||0>k?a():j!==d&&(m[0]=c[j][0],m[2]=m[0]+f[h].rows[j].cells[k].offsetHeight,(g<m[0]||g>m[2])&&a());b=f[h].rows[j].cells[k];m.containTable=0<b.childNodes.length&&0<b.getElementsByTagName("table").length?!0:!1;if(-1===b.className.indexOf(REDIPS.drag.trash.className))if(g=-1<b.className.indexOf(REDIPS.drag.only.cname)?!0:!1,!0===g){if(-1===b.className.indexOf(ya.div[i.id])){a();break}}else if(void 0!==ya.div[i.id]&&"deny"===ya.other){a();break}else if(g=-1<b.className.indexOf(REDIPS.drag.mark.cname)?
36 36 !0:!1,(!0===g&&"deny"===REDIPS.drag.mark.action||!1===g&&"allow"===REDIPS.drag.mark.action)&&-1===b.className.indexOf(Ta.exception[i.id])){a();break}g=-1<b.className.indexOf("single")?!0:!1;if("cell"===r){if(("single"===REDIPS.drag.dropMode||g)&&0<b.childNodes.length){if(1===b.childNodes.length&&3===b.firstChild.nodeType)break;g=!0;for(d=b.childNodes.length-1;0<=d;d--)if(b.childNodes[d].className&&-1<b.childNodes[d].className.indexOf("drag")){g=!1;break}if(!g&&(null!==t&&null!==v&&null!==A)&&(z!==
37   -h||J!==j||U!==k)){a();break}}if(-1<b.className.indexOf("rowhandler")){a();break}if(b.parentNode.redips&&b.parentNode.redips.emptyRow){a();break}}break}};ka=function(){h<f.length&&(null!==h&&null!==j&&null!==k)&&($=Da(h,j,k),Z(h,j,k),t=h,v=j,A=k)};Z=function(a,b,c,d){if("cell"===r&&ha)c=f[a].rows[b].cells[c].style,c.backgroundColor=void 0===d?REDIPS.drag.hover.colorTd:d.color[0].toString(),void 0!==REDIPS.drag.hover.borderTd&&(void 0===d?c.border=REDIPS.drag.hover.borderTd:(c.borderTopWidth=d.top[0][0],
  37 +h||J!==j||U!==k)){a();break}}if(-1<b.className.indexOf("rowhandler")){a();break}if(b.parentNode.redips&&b.parentNode.redips.emptyRow){a();break}}break}};ka=function(){h<f.length&&(null!==h&&null!==j&&null!==k)&&($=Ea(h,j,k),Z(h,j,k),t=h,v=j,A=k)};Z=function(a,b,c,d){if("cell"===r&&ha)c=f[a].rows[b].cells[c].style,c.backgroundColor=void 0===d?REDIPS.drag.hover.colorTd:d.color[0].toString(),void 0!==REDIPS.drag.hover.borderTd&&(void 0===d?c.border=REDIPS.drag.hover.borderTd:(c.borderTopWidth=d.top[0][0],
38 38 c.borderTopStyle=d.top[0][1],c.borderTopColor=d.top[0][2],c.borderRightWidth=d.right[0][0],c.borderRightStyle=d.right[0][1],c.borderRightColor=d.right[0][2],c.borderBottomWidth=d.bottom[0][0],c.borderBottomStyle=d.bottom[0][1],c.borderBottomColor=d.bottom[0][2],c.borderLeftWidth=d.left[0][0],c.borderLeftStyle=d.left[0][1],c.borderLeftColor=d.left[0][2]));else if("row"===r){a=f[a].rows[b];for(b=0;b<a.cells.length;b++)c=a.cells[b].style,c.backgroundColor=void 0===d?REDIPS.drag.hover.colorTr:d.color[b].toString(),
39   -void 0!==REDIPS.drag.hover.borderTr&&(void 0===d?h===z?j<J?c.borderTop=REDIPS.drag.hover.borderTr:c.borderBottom=REDIPS.drag.hover.borderTr:"before"===REDIPS.drag.rowDropMode?c.borderTop=REDIPS.drag.hover.borderTr:c.borderBottom=REDIPS.drag.hover.borderTr:(c.borderTopWidth=d.top[b][0],c.borderTopStyle=d.top[b][1],c.borderTopColor=d.top[b][2],c.borderBottomWidth=d.bottom[b][0],c.borderBottomStyle=d.bottom[b][1],c.borderBottomColor=d.bottom[b][2]))}};Da=function(a,b,c){var d={color:[],top:[],right:[],
  39 +void 0!==REDIPS.drag.hover.borderTr&&(void 0===d?h===z?j<J?c.borderTop=REDIPS.drag.hover.borderTr:c.borderBottom=REDIPS.drag.hover.borderTr:"before"===REDIPS.drag.rowDropMode?c.borderTop=REDIPS.drag.hover.borderTr:c.borderBottom=REDIPS.drag.hover.borderTr:(c.borderTopWidth=d.top[b][0],c.borderTopStyle=d.top[b][1],c.borderTopColor=d.top[b][2],c.borderBottomWidth=d.bottom[b][0],c.borderBottomStyle=d.bottom[b][1],c.borderBottomColor=d.bottom[b][2]))}};Ea=function(a,b,c){var d={color:[],top:[],right:[],
40 40 bottom:[],left:[]},e=function(a,b){var c="border"+b+"Style",d="border"+b+"Color";return[E(a,"border"+b+"Width"),E(a,c),E(a,d)]};if("cell"===r)c=f[a].rows[b].cells[c],d.color[0]=c.style.backgroundColor,void 0!==REDIPS.drag.hover.borderTd&&(d.top[0]=e(c,"Top"),d.right[0]=e(c,"Right"),d.bottom[0]=e(c,"Bottom"),d.left[0]=e(c,"Left"));else{a=f[a].rows[b];for(b=0;b<a.cells.length;b++)c=a.cells[b],d.color[b]=c.style.backgroundColor,void 0!==REDIPS.drag.hover.borderTr&&(d.top[b]=e(c,"Top"),d.bottom[b]=e(c,
41 41 "Bottom"))}return d};C=function(a,b,c){var d=0,e=0,g=a;"fixed"!==b&&(b=O(),d=0-b[0],e=0-b[1]);if(void 0===c||!0===c){do d+=a.offsetLeft-a.scrollLeft,e+=a.offsetTop-a.scrollTop,a=a.offsetParent;while(a&&"BODY"!==a.nodeName)}else{do d+=a.offsetLeft,e+=a.offsetTop,a=a.offsetParent;while(a&&"BODY"!==a.nodeName)}return[e,d+g.offsetWidth,e+g.offsetHeight,d]};u=function(){var a,b,c,d;for(a=0;a<f.length;a++){c=[];d=E(f[a],"position");"fixed"!==d&&(d=E(f[a].parentNode,"position"));for(b=f[a].rows.length-1;0<=
42 42 b;b--)"none"!==f[a].rows[b].style.display&&(c[b]=C(f[a].rows[b],d));f[a].redips.offset=C(f[a],d);f[a].redips.row_offset=c}D=C(y);for(a=0;a<L.length;a++)d=E(L[a].div,"position"),b=C(L[a].div,d,!1),L[a].offset=b,L[a].midstX=(b[1]+b[3])/2,L[a].midstY=(b[0]+b[2])/2};O=function(){var a,b;"number"===typeof window.pageYOffset?(a=window.pageXOffset,b=window.pageYOffset):document.body&&(document.body.scrollLeft||document.body.scrollTop)?(a=document.body.scrollLeft,b=document.body.scrollTop):document.documentElement&&
43   -(document.documentElement.scrollLeft||document.documentElement.scrollTop)?(a=document.documentElement.scrollLeft,b=document.documentElement.scrollTop):a=b=0;return[a,b]};la=function(a){var b,c;b=W;c=X;0<S&&(u(),R(),b<D[1]&&(b>D[3]&&c<D[2]&&c>D[0])&&ja());"object"===typeof a&&(s=a);s===window?(a=O()[0],b=ta-G,c=M):(a=s.scrollLeft,b=s.scrollWidth-s.clientWidth,c=P);0<S&&(0>c&&0<a||0<c&&a<b)?(s===window?(window.scrollBy(c,0),O(),a=parseInt(i.style.left,10),isNaN(a)):s.scrollLeft+=c,setTimeout(la,REDIPS.drag.scroll.speed)):
44   -(REDIPS.event.add(s,"scroll",u),S=0,m=[0,0,0,0])};ma=function(a){var b,c;b=W;c=X;0<T&&(u(),R(),b<D[1]&&(b>D[3]&&c<D[2]&&c>D[0])&&ja());"object"===typeof a&&(s=a);s===window?(a=O()[1],b=ua-H,c=N):(a=s.scrollTop,b=s.scrollHeight-s.clientHeight,c=Q);0<T&&(0>c&&0<a||0<c&&a<b)?(s===window?(window.scrollBy(0,c),O(),a=parseInt(i.style.top,10),isNaN(a)):s.scrollTop+=c,setTimeout(ma,REDIPS.drag.scroll.speed)):(REDIPS.event.add(s,"scroll",u),T=0,m=[0,0,0,0])};na=function(a,b){var c=a.cloneNode(!0),d=c.className,
45   -e,g;!0===b&&(document.getElementById("redips_clone").appendChild(c),c.style.zIndex=999,c.style.position="fixed",e=C(a),g=C(c),c.style.top=e[0]-g[0]+"px",c.style.left=e[3]-g[3]+"px");c.setCapture&&c.setCapture();d=d.replace("clone","");d=d.replace(/climit(\d)_(\d+)/,"");c.className=sa(d);void 0===I[a.id]&&(I[a.id]=0);c.id=a.id+"c"+I[a.id];I[a.id]+=1;Ea(a,c);return c};Ea=function(a,b){var c=[],d;c[0]=function(a,b){a.redips&&(b.redips={},b.redips.enabled=a.redips.enabled,b.redips.container=a.redips.container,
  43 +(document.documentElement.scrollLeft||document.documentElement.scrollTop)?(a=document.documentElement.scrollLeft,b=document.documentElement.scrollTop):a=b=0;return[a,b]};la=function(a){var b,c;b=W;c=X;0<S&&(u(),R(),b<D[1]&&(b>D[3]&&c<D[2]&&c>D[0])&&ja());"object"===typeof a&&(s=a);s===window?(a=O()[0],b=ua-G,c=M):(a=s.scrollLeft,b=s.scrollWidth-s.clientWidth,c=P);0<S&&(0>c&&0<a||0<c&&a<b)?(s===window?(window.scrollBy(c,0),O(),a=parseInt(i.style.left,10),isNaN(a)):s.scrollLeft+=c,setTimeout(la,REDIPS.drag.scroll.speed)):
  44 +(REDIPS.event.add(s,"scroll",u),S=0,m=[0,0,0,0])};ma=function(a){var b,c;b=W;c=X;0<T&&(u(),R(),b<D[1]&&(b>D[3]&&c<D[2]&&c>D[0])&&ja());"object"===typeof a&&(s=a);s===window?(a=O()[1],b=va-H,c=N):(a=s.scrollTop,b=s.scrollHeight-s.clientHeight,c=Q);0<T&&(0>c&&0<a||0<c&&a<b)?(s===window?(window.scrollBy(0,c),O(),a=parseInt(i.style.top,10),isNaN(a)):s.scrollTop+=c,setTimeout(ma,REDIPS.drag.scroll.speed)):(REDIPS.event.add(s,"scroll",u),T=0,m=[0,0,0,0])};na=function(a,b){var c=a.cloneNode(!0),d=c.className,
  45 +e,g;!0===b&&(document.getElementById("redips_clone").appendChild(c),c.style.zIndex=999,c.style.position="fixed",e=C(a),g=C(c),c.style.top=e[0]-g[0]+"px",c.style.left=e[3]-g[3]+"px");c.setCapture&&c.setCapture();d=d.replace("clone","");d=d.replace(/climit(\d)_(\d+)/,"");c.className=ta(d);void 0===I[a.id]&&(I[a.id]=0);c.id=a.id+"c"+I[a.id];I[a.id]+=1;Fa(a,c);return c};Fa=function(a,b){var c=[],d;c[0]=function(a,b){a.redips&&(b.redips={},b.redips.enabled=a.redips.enabled,b.redips.container=a.redips.container,
46 46 a.redips.enabled&&V(b))};c[1]=function(a,b){a.redips&&(b.redips={},b.redips.emptyRow=a.redips.emptyRow)};d=function(d){var g,f,w;f=["DIV","TR"];g=a.getElementsByTagName(f[d]);f=b.getElementsByTagName(f[d]);for(w=0;w<f.length;w++)c[d](g[w],f[w])};if("DIV"===a.nodeName)c[0](a,b);else if("TR"===a.nodeName)c[1](a,b);d(0);d(1)};oa=function(a,b){var c,d,e;e=a.className;c=e.match(/climit(\d)_(\d+)/);null!==c&&(d=parseInt(c[1],10),c=parseInt(c[2],10),0===c&&1===b&&(e+=" clone",2===d&&B(!0,a)),c+=b,e=e.replace(/climit\d_\d+/g,
47   -"climit"+d+"_"+c),0>=c&&(e=e.replace("clone",""),2===d?(B(!1,a),REDIPS.drag.event.clonedEnd2()):REDIPS.drag.event.clonedEnd1()),a.className=sa(e))};Fa=function(a){var b=!1;a.srcElement?(b=a.srcElement.nodeName,a=a.srcElement.className):(b=a.target.nodeName,a=a.target.className);switch(b){case "A":case "INPUT":case "SELECT":case "OPTION":case "TEXTAREA":b=!0;break;default:b=/\bnodrag\b/i.test(a)?!0:!1}return b};B=function(a,b){var c,d,e,g=[],f=[],w,i,h,j,l=/\bdrag\b/i,k=/\bnoautoscroll\b/i;i=REDIPS.drag.style.opacityDisabled;
  47 +"climit"+d+"_"+c),0>=c&&(e=e.replace("clone",""),2===d?(B(!1,a),REDIPS.drag.event.clonedEnd2()):REDIPS.drag.event.clonedEnd1()),a.className=ta(e))};Ga=function(a){var b=!1;a.srcElement?(b=a.srcElement.nodeName,a=a.srcElement.className):(b=a.target.nodeName,a=a.target.className);switch(b){case "A":case "INPUT":case "SELECT":case "OPTION":case "TEXTAREA":b=!0;break;default:b=/\bnodrag\b/i.test(a)?!0:!1}return b};B=function(a,b){var c,d,e,g=[],f=[],w,i,h,j,l=/\bdrag\b/i,k=/\bnoautoscroll\b/i;i=REDIPS.drag.style.opacityDisabled;
48 48 !0===a||"init"===a?(w=REDIPS.drag.style.borderEnabled,h="move",j=!0):(w=REDIPS.drag.style.borderDisabled,h="auto",j=!1);void 0===b?g=y.getElementsByTagName("div"):"string"===typeof b?g=document.querySelectorAll(b):"object"===typeof b&&("DIV"!==b.nodeName||-1===b.className.indexOf("drag"))?g=b.getElementsByTagName("div"):g[0]=b;for(d=c=0;c<g.length;c++)if(l.test(g[c].className))"init"===a||void 0===g[c].redips?(g[c].redips={},g[c].redips.container=y):!0===a&&"number"===typeof i?(g[c].style.opacity=
49 49 "",g[c].style.filter=""):!1===a&&"number"===typeof i&&(g[c].style.opacity=i/100,g[c].style.filter="alpha(opacity="+i+")"),V(g[c],j),g[c].style.borderStyle=w,g[c].style.cursor=h,g[c].redips.enabled=j;else if("init"===a&&(e=E(g[c],"overflow"),"visible"!==e)){REDIPS.event.add(g[c],"scroll",u);e=E(g[c],"position");f=C(g[c],e,!1);e=k.test(g[c].className)?!1:!0;L[d]={div:g[c],offset:f,midstX:(f[1]+f[3])/2,midstY:(f[0]+f[2])/2,autoscroll:e};f=g[c].getElementsByTagName("table");for(e=0;e<f.length;e++)f[e].sca=
50   -L[d];d++}};E=function(a,b){var c;a&&a.currentStyle?c=a.currentStyle[b]:a&&window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null)[b]);return c};x=function(a,b,c){b=b.parentNode;for(void 0===c&&(c=0);b&&b.nodeName!==a;)if((b=b.parentNode)&&b.nodeName===a&&0<c)c--,b=b.parentNode;return b};Ga=function(a,b){var c=x("TABLE",b),d,e;switch(a){case "firstInColumn":d=0;e=b.cellIndex;break;case "firstInRow":d=b.parentNode.rowIndex;e=0;break;case "lastInColumn":d=c.rows.length-1;e=b.cellIndex;
51   -break;case "lastInRow":d=b.parentNode.rowIndex;e=c.rows[d].cells.length-1;break;case "last":d=c.rows.length-1;e=c.rows[d].cells.length-1;break;default:d=e=0}return[d,e,c.rows[d].cells[e]]};ea=function(a,b,c){var d,e,g;d=function(a,b){var c=REDIPS.drag.getPosition(b);REDIPS.drag.moveObject({obj:a,target:c,callback:function(a){var b,a=REDIPS.drag.findParent("TABLE",a);b=a.redips.idx;wa[b]--;0===wa[b]&&(REDIPS.drag.event.relocated(),REDIPS.drag.enableTable(!0,a))}})};if(a!==b&&!("object"!==typeof a||
52   -"object"!==typeof b))if(g=a.childNodes.length,"animation"===c){if(0<g){c=x("TABLE",b);e=c.redips.idx;REDIPS.drag.enableTable(!1,c);for(c=0;c<g;c++)1===a.childNodes[c].nodeType&&"DIV"===a.childNodes[c].nodeName&&(wa[e]++,d(a.childNodes[c],b))}}else for(d=c=0;c<g;c++)1===a.childNodes[d].nodeType&&"DIV"===a.childNodes[d].nodeName?(e=a.childNodes[d],b.appendChild(e),(!e.redips||!1!==e.redips.enabled)&&V(e)):d++};fa=function(a,b){var c,d=[],e=!0,g;if("TD"===a.nodeName){c=a.childNodes.length;if("test"===
53   -b){for(g=c-1;0<=g;g--)if(l.source!==a&&a.childNodes[g].className&&-1<a.childNodes[g].className.indexOf("drag")){e=!1;break}return e}for(g=0;g<c;g++)d.push(a.childNodes[0]),a.removeChild(a.childNodes[0]);return d}};pa=function(a,b){var c,d,e,g,f,i,h,j,k,o,m,n,p=!1,q,r;q=function(a,b){REDIPS.drag.animation.shift?ea(a,b,"animation"):ea(a,b)};r=function(a){"delete"===REDIPS.drag.shift.overflow?fa(a):"source"===REDIPS.drag.shift.overflow?q(a,l.source):"object"===typeof REDIPS.drag.shift.overflow&&q(a,
54   -REDIPS.drag.shift.overflow);p=!1};if(a!==b){f=REDIPS.drag.shift.mode;c=x("TABLE",a);d=x("TABLE",b);i=Na(d);e=c===d?[a.redips.rowIndex,a.redips.cellIndex]:[-1,-1];g=[b.redips.rowIndex,b.redips.cellIndex];m=d.rows.length;n=Oa(d);switch(f){case "vertical2":c=c===d&&a.redips.cellIndex===b.redips.cellIndex?e:[m,b.redips.cellIndex];break;case "horizontal2":c=c===d&&a.parentNode.rowIndex===b.parentNode.rowIndex?e:[b.redips.rowIndex,n];break;default:c=c===d?e:[m,n]}"vertical1"===f||"vertical2"===f?(f=1E3*
55   -c[1]+c[0]<1E3*g[1]+g[0]?1:-1,d=m,m=0,n=1):(f=1E3*c[0]+c[1]<1E3*g[0]+g[1]?1:-1,d=n,m=1,n=0);for(c[0]!==e[0]&&c[1]!==e[1]&&(p=!0);c[0]!==g[0]||c[1]!==g[1];)(h=i[c[0]+"-"+c[1]],c[m]+=f,0>c[m]?(c[m]=d,c[n]--):c[m]>d&&(c[m]=0,c[n]++),e=i[c[0]+"-"+c[1]],void 0!==e&&(j=e),void 0!==h&&(k=h),void 0!==e&&void 0!==k||void 0!==j&&void 0!==h)?(e=-1===j.className.indexOf(REDIPS.drag.mark.cname)?0:1,h=-1===k.className.indexOf(REDIPS.drag.mark.cname)?0:1,p&&0===e&&1===h&&r(j),1===e?0===h&&(o=k):(0===e&&1===h&&(k=
56   -o),q(j,k))):p&&(void 0!==j&&void 0===k)&&(e=-1===j.className.indexOf(REDIPS.drag.mark.cname)?0:1,0===e&&r(j))}};Na=function(a){var b=[],c,d={},e,g,f,i,h,j,k,l;i=a.rows;for(h=0;h<i.length;h++)for(j=0;j<i[h].cells.length;j++){c=i[h].cells[j];a=c.parentNode.rowIndex;e=c.rowSpan||1;g=c.colSpan||1;b[a]=b[a]||[];for(k=0;k<b[a].length+1;k++)if("undefined"===typeof b[a][k]){f=k;break}d[a+"-"+f]=c;void 0===c.redips&&(c.redips={});c.redips.rowIndex=a;c.redips.cellIndex=f;for(k=a;k<a+e;k++){b[k]=b[k]||[];c=
57   -b[k];for(l=f;l<f+g;l++)c[l]="x"}}return d};Oa=function(a){var b=a.rows,c=0,d,e;"string"===typeof a&&document.getElementById(a);for(d=0;d<b.length;d++){for(e=a=0;e<b[d].cells.length;e++)a+=b[d].cells[e].colSpan||1;a>c&&(c=a)}return c};Ha=function(a,b){var c=(b.k1-b.k2*a)*(b.k1-b.k2*a),d,a=a+REDIPS.drag.animation.step*(4-3*c)*b.direction;d=b.m*a+b.b;"horizontal"===b.type?(b.obj.style.left=a+"px",b.obj.style.top=d+"px"):(b.obj.style.left=d+"px",b.obj.style.top=a+"px");a<b.last&&0<b.direction||a>b.last&&
58   -0>b.direction?setTimeout(function(){Ha(a,b)},REDIPS.drag.animation.pause*c):(Ba(b.obj),b.obj.redips.animated=!1,"cell"===b.mode?(!0===b.overwrite&&fa(b.targetCell),b.targetCell.appendChild(b.obj),(!b.obj.redips||!1!==b.obj.redips.enabled)&&V(b.obj)):Ja(qa(b.target[0]),b.target[1],b.obj),"function"===typeof b.callback&&b.callback(b.obj))};Ia=function(a){var b,c,d;b=[];b=c=d=-1;if(void 0===a)b=h<f.length?f[h].redips.idx:null===t||null===v||null===A?f[z].redips.idx:f[t].redips.idx,c=f[z].redips.idx,
59   -b=[b,j,k,c,J,U];else{if(a="string"===typeof a?document.getElementById(a):a)"TD"!==a.nodeName&&(a=x("TD",a)),a&&"TD"===a.nodeName&&(b=a.cellIndex,c=a.parentNode.rowIndex,a=x("TABLE",a),d=a.redips.idx);b=[d,c,b]}return b};qa=function(a){var b;for(b=0;b<f.length&&f[b].redips.idx!==a;b++);return b};sa=function(a){void 0!==a&&(a=a.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," "));return a};Qa=function(a){var b;for(b=0;b<a.childNodes.length;b++)if(1===a.childNodes[b].nodeType)return!0;return!1};ra=function(a,
60   -b,c){var d,e;"string"===typeof a&&(a=document.getElementById(a),a=x("TABLE",a));if("TR"===a.nodeName){a=a.getElementsByTagName("td");for(d=0;d<a.length;d++)if(a[d].style.backgroundColor=c?c:"","empty"===b)a[d].innerHTML="";else for(e=0;e<a[d].childNodes.length;e++)1===a[d].childNodes[e].nodeType&&(a[d].childNodes[e].style.opacity=b/100,a[d].childNodes[e].style.filter="alpha(opacity="+b+")")}else a.style.opacity=b/100,a.style.filter="alpha(opacity="+b+")",a.style.backgroundColor=c?c:""};return{obj:i,
61   -objOld:o,mode:r,td:l,hover:{colorTd:"#E7AB83",colorTr:"#E7AB83"},scroll:{enable:!0,bound:25,speed:20},only:xa,mark:Ta,style:{borderEnabled:"solid",borderDisabled:"dotted",opacityDisabled:"",rowEmptyColor:"white"},trash:{className:"trash",question:null,questionRow:null},saveParamName:"p",dropMode:"multiple",multipleDrop:"bottom",clone:Ua,animation:{pause:20,step:2,shift:!1},shift:{mode:"horizontal1",after:"default",overflow:"bunch"},rowDropMode:"before",tableSort:!0,init:function(a){var b;if(void 0===
62   -a||"string"!==typeof a)a="drag";y=document.getElementById(a);document.getElementById("redips_clone")||(a=document.createElement("div"),a.id="redips_clone",a.style.width=a.style.height="1px",y.appendChild(a));B("init");q();Ca();REDIPS.event.add(window,"resize",Ca);b=y.getElementsByTagName("img");for(a=0;a<b.length;a++)REDIPS.event.add(b[a],"mousemove",K),REDIPS.event.add(b[a],"touchmove",K);REDIPS.event.add(window,"scroll",u)},initTables:q,enableDrag:B,enableTable:function(a,b){var c;if("object"===
63   -typeof b&&"TABLE"===b.nodeName)b.redips.enabled=a;else for(c=0;c<f.length;c++)-1<f[c].className.indexOf(b)&&(f[c].redips.enabled=a)},cloneObject:na,saveContent:function(a,b){var c="",d,e,g,f,i,h,j,k=[],l=REDIPS.drag.saveParamName;"string"===typeof a&&(a=document.getElementById(a));if(void 0!==a&&"object"===typeof a&&"TABLE"===a.nodeName){d=a.rows.length;for(i=0;i<d;i++){e=a.rows[i].cells.length;for(h=0;h<e;h++)if(g=a.rows[i].cells[h],0<g.childNodes.length)for(j=0;j<g.childNodes.length;j++)f=g.childNodes[j],
64   -"DIV"===f.nodeName&&-1<f.className.indexOf("drag")&&(c+=l+"[]="+f.id+"_"+i+"_"+h+"&",k.push([f.id,i,h]))}c="json"===b&&0<k.length?JSON.stringify(k):c.substring(0,c.length-1)}return c},relocate:ea,emptyCell:fa,moveObject:function(a){var b={direction:1},c,d,e,g,i,h;b.callback=a.callback;b.overwrite=a.overwrite;"string"===typeof a.id?b.obj=b.objOld=document.getElementById(a.id):"object"===typeof a.obj&&"DIV"===a.obj.nodeName&&(b.obj=b.objOld=a.obj);if("row"===a.mode){b.mode="row";h=qa(a.source[0]);i=
65   -a.source[1];o=b.objOld=f[h].rows[i];if(o.redips&&!0===o.redips.emptyRow)return!1;b.obj=ga(b.objOld,"animated")}else if(b.obj&&-1<b.obj.className.indexOf("row")){b.mode="row";b.obj=b.objOld=o=x("TR",b.obj);if(o.redips&&!0===o.redips.emptyRow)return!1;b.obj=ga(b.objOld,"animated")}else b.mode="cell";if(!("object"!==typeof b.obj||null===b.obj))return b.obj.style.zIndex=999,y!==b.obj.redips.container&&(y=b.obj.redips.container,q()),h=C(b.obj),e=h[1]-h[3],g=h[2]-h[0],c=h[3],d=h[0],!0===a.clone&&"cell"===
66   -b.mode&&(b.obj=na(b.obj,!0),REDIPS.drag.event.cloned(b.obj)),void 0===a.target&&(a.target=Ia()),b.target=a.target,h=qa(a.target[0]),i=a.target[1],a=a.target[2],i>f[h].rows.length-1&&(i=f[h].rows.length-1),b.targetCell=f[h].rows[i].cells[a],"cell"===b.mode?(h=C(b.targetCell),i=h[1]-h[3],a=h[2]-h[0],e=h[3]+(i-e)/2,g=h[0]+(a-g)/2):(h=C(f[h].rows[i]),e=h[3],g=h[0]),h=e-c,a=g-d,b.obj.style.position="fixed",Math.abs(h)>Math.abs(a)?(b.type="horizontal",b.m=a/h,b.b=d-b.m*c,b.k1=(c+e)/(c-e),b.k2=2/(c-e),c>
67   -e&&(b.direction=-1),h=c,b.last=e):(b.type="vertical",b.m=h/a,b.b=c-b.m*d,b.k1=(d+g)/(d-g),b.k2=2/(d-g),d>g&&(b.direction=-1),h=d,b.last=g),b.obj.redips.animated=!0,Ha(h,b),[b.obj,b.objOld]},shiftCells:pa,deleteObject:function(a){"object"===typeof a&&"DIV"===a.nodeName?a.parentNode.removeChild(a):"string"===typeof a&&(a=document.getElementById(a))&&a.parentNode.removeChild(a)},getPosition:Ia,rowOpacity:ra,rowEmpty:function(a,b,c){a=document.getElementById(a).rows[b];void 0===c&&(c=REDIPS.drag.style.rowEmptyColor);
68   -void 0===a.redips&&(a.redips={});a.redips.emptyRow=!0;ra(a,"empty",c)},getScrollPosition:O,getStyle:E,findParent:x,findCell:Ga,event:{changed:function(){},clicked:function(){},cloned:function(){},clonedDropped:function(){},clonedEnd1:function(){},clonedEnd2:function(){},dblClicked:function(){},deleted:function(){},dropped:function(){},droppedBefore:function(){},finish:function(){},moved:function(){},notCloned:function(){},notMoved:function(){},relocated:function(){},rowChanged:function(){},rowClicked:function(){},
69   -rowCloned:function(){},rowDeleted:function(){},rowDropped:function(){},rowDroppedBefore:function(){},rowDroppedSource:function(){},rowMoved:function(){},rowNotCloned:function(){},rowNotMoved:function(){},rowUndeleted:function(){},switched:function(){},undeleted:function(){}}}}();
70   -REDIPS.event||(REDIPS.event=function(){return{add:function(q,B,K){q.addEventListener?q.addEventListener(B,K,!1):q.attachEvent?q.attachEvent("on"+B,K):q["on"+B]=K},remove:function(q,B,K){q.removeEventListener?q.removeEventListener(B,K,!1):q.detachEvent?q.detachEvent("on"+B,K):q["on"+B]=null}}}());
  50 +L[d];d++}};E=function(a,b){var c;a&&a.currentStyle?c=a.currentStyle[b]:a&&window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null)[b]);return c};x=function(a,b,c){b=b.parentNode;for(void 0===c&&(c=0);b&&b.nodeName!==a;)if((b=b.parentNode)&&b.nodeName===a&&0<c)c--,b=b.parentNode;return b};Ha=function(a,b){var c=x("TABLE",b),d,e;switch(a){case "firstInColumn":d=0;e=b.cellIndex;break;case "firstInRow":d=b.parentNode.rowIndex;e=0;break;case "lastInColumn":d=c.rows.length-1;e=b.cellIndex;
  51 +break;case "lastInRow":d=b.parentNode.rowIndex;e=c.rows[d].cells.length-1;break;case "last":d=c.rows.length-1;e=c.rows[d].cells.length-1;break;default:d=e=0}return[d,e,c.rows[d].cells[e]]};ea=function(a,b,c){var d,e,g;d=function(a,b){REDIPS.drag.event.relocateBefore(a,b);var c=REDIPS.drag.getPosition(b);REDIPS.drag.moveObject({obj:a,target:c,callback:function(a){var c=REDIPS.drag.findParent("TABLE",a),d=c.redips.idx;REDIPS.drag.event.relocateAfter(a,b);xa[d]--;0===xa[d]&&(REDIPS.drag.event.relocateEnd(),
  52 +REDIPS.drag.enableTable(!0,c))}})};if(a!==b&&!("object"!==typeof a||"object"!==typeof b))if(g=a.childNodes.length,"animation"===c){if(0<g){c=x("TABLE",b);e=c.redips.idx;REDIPS.drag.enableTable(!1,c);for(c=0;c<g;c++)1===a.childNodes[c].nodeType&&"DIV"===a.childNodes[c].nodeName&&(xa[e]++,d(a.childNodes[c],b))}}else for(d=c=0;c<g;c++)1===a.childNodes[d].nodeType&&"DIV"===a.childNodes[d].nodeName?(e=a.childNodes[d],REDIPS.drag.event.relocateBefore(e,b),b.appendChild(e),e.redips&&!1!==e.redips.enabled&&
  53 +V(e),REDIPS.drag.event.relocateAfter(e)):d++};fa=function(a,b){var c,d=[],e=!0,g;if("TD"===a.nodeName){c=a.childNodes.length;if("test"===b){for(g=c-1;0<=g;g--)if(l.source!==a&&a.childNodes[g].className&&-1<a.childNodes[g].className.indexOf("drag")){e=!1;break}return e}for(g=0;g<c;g++)d.push(a.childNodes[0]),a.removeChild(a.childNodes[0]);return d}};pa=function(a,b){var c,d,e,g,f,i,h,j,k,o,m,n,p=!1,q,r;q=function(a,b){REDIPS.drag.animation.shift?ea(a,b,"animation"):ea(a,b)};r=function(a){"delete"===
  54 +REDIPS.drag.shift.overflow?fa(a):"source"===REDIPS.drag.shift.overflow?q(a,l.source):"object"===typeof REDIPS.drag.shift.overflow&&q(a,REDIPS.drag.shift.overflow);p=!1;REDIPS.drag.event.shiftOverflow(a)};if(a!==b){f=REDIPS.drag.shift.mode;c=x("TABLE",a);d=x("TABLE",b);i=Na(d);e=c===d?[a.redips.rowIndex,a.redips.cellIndex]:[-1,-1];g=[b.redips.rowIndex,b.redips.cellIndex];m=d.rows.length;n=Oa(d);switch(f){case "vertical2":c=c===d&&a.redips.cellIndex===b.redips.cellIndex?e:[m,b.redips.cellIndex];break;
  55 +case "horizontal2":c=c===d&&a.parentNode.rowIndex===b.parentNode.rowIndex?e:[b.redips.rowIndex,n];break;default:c=c===d?e:[m,n]}"vertical1"===f||"vertical2"===f?(f=1E3*c[1]+c[0]<1E3*g[1]+g[0]?1:-1,d=m,m=0,n=1):(f=1E3*c[0]+c[1]<1E3*g[0]+g[1]?1:-1,d=n,m=1,n=0);for(c[0]!==e[0]&&c[1]!==e[1]&&(p=!0);c[0]!==g[0]||c[1]!==g[1];)(h=i[c[0]+"-"+c[1]],c[m]+=f,0>c[m]?(c[m]=d,c[n]--):c[m]>d&&(c[m]=0,c[n]++),e=i[c[0]+"-"+c[1]],void 0!==e&&(j=e),void 0!==h&&(k=h),void 0!==e&&void 0!==k||void 0!==j&&void 0!==h)?(e=
  56 +-1===j.className.indexOf(REDIPS.drag.mark.cname)?0:1,h=-1===k.className.indexOf(REDIPS.drag.mark.cname)?0:1,p&&0===e&&1===h&&r(j),1===e?0===h&&(o=k):(0===e&&1===h&&(k=o),q(j,k))):p&&(void 0!==j&&void 0===k)&&(e=-1===j.className.indexOf(REDIPS.drag.mark.cname)?0:1,0===e&&r(j))}};Na=function(a){var b=[],c,d={},e,g,f,i,h,j,k,l;i=a.rows;for(h=0;h<i.length;h++)for(j=0;j<i[h].cells.length;j++){c=i[h].cells[j];a=c.parentNode.rowIndex;e=c.rowSpan||1;g=c.colSpan||1;b[a]=b[a]||[];for(k=0;k<b[a].length+1;k++)if("undefined"===
  57 +typeof b[a][k]){f=k;break}d[a+"-"+f]=c;void 0===c.redips&&(c.redips={});c.redips.rowIndex=a;c.redips.cellIndex=f;for(k=a;k<a+e;k++){b[k]=b[k]||[];c=b[k];for(l=f;l<f+g;l++)c[l]="x"}}return d};Oa=function(a){var b=a.rows,c=0,d,e;"string"===typeof a&&document.getElementById(a);for(d=0;d<b.length;d++){for(e=a=0;e<b[d].cells.length;e++)a+=b[d].cells[e].colSpan||1;a>c&&(c=a)}return c};Ia=function(a,b){var c=(b.k1-b.k2*a)*(b.k1-b.k2*a),d,a=a+REDIPS.drag.animation.step*(4-3*c)*b.direction;d=b.m*a+b.b;"horizontal"===
  58 +b.type?(b.obj.style.left=a+"px",b.obj.style.top=d+"px"):(b.obj.style.left=d+"px",b.obj.style.top=a+"px");a<b.last&&0<b.direction||a>b.last&&0>b.direction?setTimeout(function(){Ia(a,b)},REDIPS.drag.animation.pause*c):(Ca(b.obj),b.obj.redips&&(b.obj.redips.animated=!1),"cell"===b.mode?(!0===b.overwrite&&fa(b.targetCell),b.targetCell.appendChild(b.obj),b.obj.redips&&!1!==b.obj.redips.enabled&&V(b.obj)):Ja(qa(b.target[0]),b.target[1],b.obj),"function"===typeof b.callback&&b.callback(b.obj))};ra=function(a){var b,
  59 +c,d;b=[];b=c=d=-1;if(void 0===a)b=h<f.length?f[h].redips.idx:null===t||null===v||null===A?f[z].redips.idx:f[t].redips.idx,c=f[z].redips.idx,b=[b,j,k,c,J,U];else{if(a="string"===typeof a?document.getElementById(a):a)"TD"!==a.nodeName&&(a=x("TD",a)),a&&"TD"===a.nodeName&&(b=a.cellIndex,c=a.parentNode.rowIndex,a=x("TABLE",a),d=a.redips.idx);b=[d,c,b]}return b};qa=function(a){var b;for(b=0;b<f.length&&f[b].redips.idx!==a;b++);return b};ta=function(a){void 0!==a&&(a=a.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g,
  60 +" "));return a};Qa=function(a){var b;for(b=0;b<a.childNodes.length;b++)if(1===a.childNodes[b].nodeType)return!0;return!1};sa=function(a,b,c){var d,e;"string"===typeof a&&(a=document.getElementById(a),a=x("TABLE",a));if("TR"===a.nodeName){a=a.getElementsByTagName("td");for(d=0;d<a.length;d++)if(a[d].style.backgroundColor=c?c:"","empty"===b)a[d].innerHTML="";else for(e=0;e<a[d].childNodes.length;e++)1===a[d].childNodes[e].nodeType&&(a[d].childNodes[e].style.opacity=b/100,a[d].childNodes[e].style.filter=
  61 +"alpha(opacity="+b+")")}else a.style.opacity=b/100,a.style.filter="alpha(opacity="+b+")",a.style.backgroundColor=c?c:""};return{obj:i,objOld:o,mode:r,td:l,hover:{colorTd:"#E7AB83",colorTr:"#E7AB83"},scroll:{enable:!0,bound:25,speed:20},only:ya,mark:Ta,style:{borderEnabled:"solid",borderDisabled:"dotted",opacityDisabled:"",rowEmptyColor:"white"},trash:{className:"trash",question:null,questionRow:null},saveParamName:"p",dropMode:"multiple",multipleDrop:"bottom",clone:Ua,animation:{pause:20,step:2,shift:!1},
  62 +shift:{mode:"horizontal1",after:"default",overflow:"bunch"},rowDropMode:"before",tableSort:!0,init:function(a){var b;if(void 0===a||"string"!==typeof a)a="drag";y=document.getElementById(a);document.getElementById("redips_clone")||(a=document.createElement("div"),a.id="redips_clone",a.style.width=a.style.height="1px",y.appendChild(a));B("init");q();Da();REDIPS.event.add(window,"resize",Da);b=y.getElementsByTagName("img");for(a=0;a<b.length;a++)REDIPS.event.add(b[a],"mousemove",K),REDIPS.event.add(b[a],
  63 +"touchmove",K);REDIPS.event.add(window,"scroll",u)},initTables:q,enableDrag:B,enableTable:function(a,b){var c;if("object"===typeof b&&"TABLE"===b.nodeName)b.redips.enabled=a;else for(c=0;c<f.length;c++)-1<f[c].className.indexOf(b)&&(f[c].redips.enabled=a)},cloneObject:na,saveContent:function(a,b){var c="",d,e,g,f,i,h,j,k=[],l=REDIPS.drag.saveParamName;"string"===typeof a&&(a=document.getElementById(a));if(void 0!==a&&"object"===typeof a&&"TABLE"===a.nodeName){d=a.rows.length;for(i=0;i<d;i++){e=a.rows[i].cells.length;
  64 +for(h=0;h<e;h++)if(g=a.rows[i].cells[h],0<g.childNodes.length)for(j=0;j<g.childNodes.length;j++)f=g.childNodes[j],"DIV"===f.nodeName&&-1<f.className.indexOf("drag")&&(c+=l+"[]="+f.id+"_"+i+"_"+h+"&",k.push([f.id,i,h]))}c="json"===b&&0<k.length?JSON.stringify(k):c.substring(0,c.length-1)}return c},relocate:ea,emptyCell:fa,moveObject:function(a){var b={direction:1},c,d,e,g,i,h;b.callback=a.callback;b.overwrite=a.overwrite;"string"===typeof a.id?b.obj=b.objOld=document.getElementById(a.id):"object"===
  65 +typeof a.obj&&"DIV"===a.obj.nodeName&&(b.obj=b.objOld=a.obj);if("row"===a.mode){b.mode="row";h=qa(a.source[0]);i=a.source[1];o=b.objOld=f[h].rows[i];if(o.redips&&!0===o.redips.emptyRow)return!1;b.obj=ga(b.objOld,"animated")}else if(b.obj&&-1<b.obj.className.indexOf("row")){b.mode="row";b.obj=b.objOld=o=x("TR",b.obj);if(o.redips&&!0===o.redips.emptyRow)return!1;b.obj=ga(b.objOld,"animated")}else b.mode="cell";if(!("object"!==typeof b.obj||null===b.obj))return b.obj.style.zIndex=999,b.obj.redips&&y!==
  66 +b.obj.redips.container&&(y=b.obj.redips.container,q()),h=C(b.obj),e=h[1]-h[3],g=h[2]-h[0],c=h[3],d=h[0],!0===a.clone&&"cell"===b.mode&&(b.obj=na(b.obj,!0),REDIPS.drag.event.cloned(b.obj)),void 0===a.target?a.target=ra():"object"===typeof a.target&&"TD"===a.target.nodeName&&(a.target=ra(a.target)),b.target=a.target,h=qa(a.target[0]),i=a.target[1],a=a.target[2],i>f[h].rows.length-1&&(i=f[h].rows.length-1),b.targetCell=f[h].rows[i].cells[a],"cell"===b.mode?(h=C(b.targetCell),i=h[1]-h[3],a=h[2]-h[0],
  67 +e=h[3]+(i-e)/2,g=h[0]+(a-g)/2):(h=C(f[h].rows[i]),e=h[3],g=h[0]),h=e-c,a=g-d,b.obj.style.position="fixed",Math.abs(h)>Math.abs(a)?(b.type="horizontal",b.m=a/h,b.b=d-b.m*c,b.k1=(c+e)/(c-e),b.k2=2/(c-e),c>e&&(b.direction=-1),h=c,b.last=e):(b.type="vertical",b.m=h/a,b.b=c-b.m*d,b.k1=(d+g)/(d-g),b.k2=2/(d-g),d>g&&(b.direction=-1),h=d,b.last=g),b.obj.redips&&(b.obj.redips.animated=!0),Ia(h,b),[b.obj,b.objOld]},shiftCells:pa,deleteObject:function(a){"object"===typeof a&&"DIV"===a.nodeName?a.parentNode.removeChild(a):
  68 +"string"===typeof a&&(a=document.getElementById(a))&&a.parentNode.removeChild(a)},getPosition:ra,rowOpacity:sa,rowEmpty:function(a,b,c){a=document.getElementById(a).rows[b];void 0===c&&(c=REDIPS.drag.style.rowEmptyColor);void 0===a.redips&&(a.redips={});a.redips.emptyRow=!0;sa(a,"empty",c)},getScrollPosition:O,getStyle:E,findParent:x,findCell:Ha,event:{changed:function(){},clicked:function(){},cloned:function(){},clonedDropped:function(){},clonedEnd1:function(){},clonedEnd2:function(){},dblClicked:function(){},
  69 +deleted:function(){},dropped:function(){},droppedBefore:function(){},finish:function(){},moved:function(){},notCloned:function(){},notMoved:function(){},shiftOverflow:function(){},relocateBefore:function(){},relocateAfter:function(){},relocateEnd:function(){},rowChanged:function(){},rowClicked:function(){},rowCloned:function(){},rowDeleted:function(){},rowDropped:function(){},rowDroppedBefore:function(){},rowDroppedSource:function(){},rowMoved:function(){},rowNotCloned:function(){},rowNotMoved:function(){},
  70 +rowUndeleted:function(){},switched:function(){},undeleted:function(){}}}}();REDIPS.event||(REDIPS.event=function(){return{add:function(q,B,K){q.addEventListener?q.addEventListener(B,K,!1):q.attachEvent?q.attachEvent("on"+B,K):q["on"+B]=K},remove:function(q,B,K){q.removeEventListener?q.removeEventListener(B,K,!1):q.detachEvent?q.detachEvent("on"+B,K):q["on"+B]=null}}}());
86 redips-drag-source.js
@@ -3,7 +3,7 @@ Copyright (c) 2008-2011, www.redips.net All rights reserved.
3 3 Code licensed under the BSD License: http://www.redips.net/license/
4 4 http://www.redips.net/javascript/drag-and-drop-table-content/
5 5 Version 5.0.4
6   -Dec 20, 2012.
  6 +Dec 21, 2012.
7 7 */
8 8
9 9 /*jslint white: true, browser: true, undef: true, nomen: true, eqeqeq: true, plusplus: false, bitwise: true, regexp: true, strict: true, newcap: true, immed: true, maxerr: 14 */
@@ -194,7 +194,10 @@ REDIPS.drag = (function () {
194 194 moved : function () {},
195 195 notCloned : function () {},
196 196 notMoved : function () {},
197   - relocated : function () {},
  197 + shiftOverflow: function () {},
  198 + relocateBefore : function () {},
  199 + relocateAfter : function () {},
  200 + relocateEnd : function () {},
198 201 rowChanged : function () {},
199 202 rowClicked : function () {},
200 203 rowCloned : function () {},
@@ -1333,7 +1336,7 @@ REDIPS.drag = (function () {
1333 1336 }
1334 1337 }
1335 1338 // shift table content if dropMode is set to "shift" and target cell is not empty or shift.after option is set to always
1336   - // has_child() is a private method
  1339 + // hasChild() is a private method
1337 1340 if (REDIPS.drag.dropMode === 'shift' && (hasChilds(td.target) || REDIPS.drag.shift.after === 'always')) {
1338 1341 shiftCells(td.source, td.target);
1339 1342 }
@@ -3128,6 +3131,8 @@ REDIPS.drag = (function () {
3128 3131 move; // move object (private function)
3129 3132 // define private move function (after animation is finished table will be enabled)
3130 3133 move = function (el, to) {
  3134 + // call relocateBefore event handler for this element
  3135 + REDIPS.drag.event.relocateBefore(el, to);
3131 3136 // define target position
3132 3137 var target = REDIPS.drag.getPosition(to);
3133 3138 // move object
@@ -3135,16 +3140,17 @@ REDIPS.drag = (function () {
3135 3140 obj: el,
3136 3141 target: target,
3137 3142 callback: function (div) {
3138   - var tbl, idx;
3139 3143 // set reference to the table and table index
3140   - tbl = REDIPS.drag.findParent('TABLE', div);
3141   - idx = tbl.redips.idx;
  3144 + var tbl = REDIPS.drag.findParent('TABLE', div),
  3145 + idx = tbl.redips.idx;
  3146 + // call relocateAfter event handler for this div element
  3147 + REDIPS.drag.event.relocateAfter(div, to);
3142 3148 // decrease animation counter per table
3143 3149 animationCounter[idx]--;
3144 3150 // after last element is placed the table then table should be enabled
3145 3151 if (animationCounter[idx] === 0) {
3146 3152 // call event handler after relocation is finished
3147   - REDIPS.drag.event.relocated();
  3153 + REDIPS.drag.event.relocateEnd();
3148 3154 // enable target table
3149 3155 REDIPS.drag.enableTable(true, tbl);
3150 3156 }
@@ -3191,12 +3197,16 @@ REDIPS.drag = (function () {
3191 3197 if (from.childNodes[j].nodeType === 1 && from.childNodes[j].nodeName === 'DIV') {
3192 3198 // set DIV element
3193 3199 div = from.childNodes[j];
  3200 + // call relocateBefore event handler for this element
  3201 + REDIPS.drag.event.relocateBefore(div, to);
3194 3202 // append DIV element to the table cell
3195 3203 to.appendChild(div);
3196 3204 // register event listeners (FIX for Safari Mobile) if DIV element is not disabled
3197   - if (!div.redips || div.redips.enabled !== false) {
  3205 + if (div.redips && div.redips.enabled !== false) {
3198 3206 registerEvents(div);
3199 3207 }
  3208 + // call relocated event handler
  3209 + REDIPS.drag.event.relocateAfter(div);
3200 3210 }
3201 3211 // skip text nodes, attribute nodes ...
3202 3212 else {
@@ -3326,6 +3336,8 @@ REDIPS.drag = (function () {
3326 3336 }
3327 3337 // set overflow flag to false (overflow could happen only once)
3328 3338 overflow = false;
  3339 + // call shiftOverflow event handler
  3340 + REDIPS.drag.event.shiftOverflow(target);
3329 3341 };
3330 3342 // if DIV element is dropped to the source cell then there's nothing to do - just return from method
3331 3343 if (td1 === td2) {
@@ -3687,7 +3699,8 @@ REDIPS.drag = (function () {
3687 3699 // set high z-index
3688 3700 p.obj.style.zIndex = 999;
3689 3701 // if clicked element doesn't belong to the current container then context should be changed
3690   - if (dragContainer !== p.obj.redips.container) {
  3702 + // redips property could not be set in case when static DIV is moved (like in example25)
  3703 + if (p.obj.redips && dragContainer !== p.obj.redips.container) {
3691 3704 dragContainer = p.obj.redips.container;
3692 3705 initTables();
3693 3706 }
@@ -3709,6 +3722,10 @@ REDIPS.drag = (function () {
3709 3722 if (ip.target === undefined) {
3710 3723 ip.target = getPosition();
3711 3724 }
  3725 + // if target is TD (object) then set position for this TD
  3726 + else if (typeof(ip.target) === 'object' && ip.target.nodeName === 'TD') {
  3727 + ip.target = getPosition(ip.target);
  3728 + }
3712 3729 // set target table, row and cell indexes (needed for moving table row)
3713 3730 // table index is index from array not original table index
3714 3731 p.target = ip.target;
@@ -3784,7 +3801,10 @@ REDIPS.drag = (function () {
3784 3801 p.last = y2;
3785 3802 }
3786 3803 // set attribute "animated" of DIV object to true (to disable dragging od DIV while animation lasts)
3787   - p.obj.redips.animated = true;
  3804 + // redips property could not be set in case when static DIV is moved (like in example25)
  3805 + if (p.obj.redips) {
  3806 + p.obj.redips.animated = true;
  3807 + }
3788 3808 // start animation
3789 3809 animateObject(i, p);
3790 3810 // return reference of obj and objOld elements
@@ -3845,8 +3865,11 @@ REDIPS.drag = (function () {
3845 3865 else {
3846 3866 // reset object styles
3847 3867 resetStyles(p.obj);
3848   - // set animation flag to false (to enable DIV dragging)
3849   - p.obj.redips.animated = false;
  3868 + // set animation flag to false to enable DIV dragging
  3869 + // redips property could not be set in case when static DIV is moved (like in example25)
  3870 + if (p.obj.redips) {
  3871 + p.obj.redips.animated = false;
  3872 + }
3850 3873 // if moved element is cell then append element to the target cell
3851 3874 if (p.mode === 'cell') {
3852 3875 // if overwrite parameter is set to true then empty targetCell
@@ -3856,7 +3879,7 @@ REDIPS.drag = (function () {
3856 3879 }
3857 3880 p.targetCell.appendChild(p.obj);
3858 3881 // register event listeners (FIX for Safari Mobile) if DIV element is not disabled
3859   - if (!p.obj.redips || p.obj.redips.enabled !== false) {
  3882 + if (p.obj.redips && p.obj.redips.enabled !== false) {
3860 3883 registerEvents(p.obj);
3861 3884 }
3862 3885 }
@@ -4471,11 +4494,37 @@ REDIPS.drag = (function () {
4471 4494 * Event handler invoked after all DIV elements are relocated and before table is enabled (DIV elements enabled for dragging).
4472 4495 * This event can be triggered after single call of relocate() method or after all DIV elements are shifted in "shift" mode.
4473 4496 * It is called only if animation is turned on.
4474   - * @name REDIPS.drag#event:relocated
  4497 + * @name REDIPS.drag#event:relocateEnd
4475 4498 * @see <a href="#relocate">relocate</a>
  4499 + * @see <a href="#event.relocateBefore">relocateBefore</a>
  4500 + * @see <a href="#event.relocateAfter">relocateAfter</a>
4476 4501 * @function
4477 4502 * @event
4478   - */
  4503 + */
  4504 + /**
  4505 + * Event handler invoked before DIV element will be relocated.
  4506 + * For example, in shift drop mode, this event handler will be called for each DIV element.
  4507 + * @param {HTMLElement} div Reference of DIV element that will be relocated.
  4508 + * @param {HTMLElement} td Reference of TD where DIV element will be relocated.
  4509 + * @name REDIPS.drag#event:relocateBefore
  4510 + * @see <a href="#relocate">relocate</a>
  4511 + * @see <a href="#event.relocateAfter">relocateAfter</a>
  4512 + * @see <a href="#event.relocateEnd">relocateEnd</a>
  4513 + * @function
  4514 + * @event
  4515 + */
  4516 + /**
  4517 + * Event handler invoked after DIV element is relocated.
  4518 + * For example, in shift drop mode, this event handler will be called for each DIV element.
  4519 + * @param {HTMLElement} div Reference of DIV element that is relocated.
  4520 + * @param {HTMLElement} td Reference of TD where DIV element will be relocated.
  4521 + * @name REDIPS.drag#event:relocateAfter
  4522 + * @see <a href="#relocate">relocate</a>
  4523 + * @see <a href="#event.relocateBefore">relocateBefore</a>
  4524 + * @see <a href="#event.relocateEnd">relocateEnd</a>
  4525 + * @function
  4526 + * @event
  4527 + */
4479 4528 /**
4480 4529 * Event handler invoked on every change of current (highlighted) table cell.
4481 4530 * @param {HTMLElement} [currentCell] Reference to the current (highlighted) table cell.
@@ -4563,6 +4612,13 @@ REDIPS.drag = (function () {
4563 4612 * @function
4564 4613 * @event
4565 4614 */
  4615 + /**
  4616 + * Event handler invoked in a moment when overflow happen in shift mode.
  4617 + * @param {HTMLElement} td Reference of TD where overflow happen.
  4618 + * @name REDIPS.drag#event:shiftOverflow
  4619 + * @function
  4620 + * @event
  4621 + */
4566 4622
4567 4623 /* Row Event Handlers */
4568 4624 /**

0 comments on commit 3609567

Please sign in to comment.
Something went wrong with that request. Please try again.