Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 036856af28
Fetching contributors…

Cannot retrieve contributors at this time

file 434 lines (360 sloc) 19.685 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
Changes for REDIPS.drag library

4.6.19
- added private method "register events", registering event listener is now in one place
- fixed bug for Safari Mobile in case of "switch", "switching" and "shift" mode

4.6.18
- fixing REDIPS.drag.clone_div() method
  * "climitX_Y" class name is removed from cloned DIV element
  * reduced iteration with DOM
- fixed example23 (added regex instead of redips.code_length property)

4.6.17
- added "clone" and "overwrite" options to the move_object() method
- improved get_position() method
- added "clone" and "overwrite" checkboxes to example18
- calling myhandler_cloned placed inside clone_div() method
- added private method reset_styles()
- fixed find_cell() method for cases "lastInRow" and "last" (instead of using index of first row it's used index of current row and last row) - thanks to Bruno Jesus

4.6.16
- fixed relocate() method - discarded "REDIPS.drag.obj !== from.childNodes[i]" condition from element filter
- fixed find_parent() method - prevented finding node itself (el = el.parentNode) - find_parent() from now starts from parent node
- resetting DIV styles to '' instead of -1, 0 and 'static'

4.6.15
- added public property REDIPS.drag.table_sort with default value "true"
  Table sort is feature where tables inside drop container are sorted on each element click. Sometimes this feature should be turned off when one table overlays the other using "position" style relative, fixed or absolute.
- added example23 - Shopping cart

4.6.14
- added public property REDIPS.drag.autoscroll with default value "true"
  If set to "false" then autoscroll option will be completely turned off for page and any DIV container with CSS style overflow set to anything but 'visible'
- added third optional "skip" parameter to the find_parent() method

4.6.13
- myhandler_deleted call is moved to the end inside element_deleted method
- it seemed that find_cell() method was not published as public - now it is

4.6.12
- added control inside REDIPS.drag.relocate() method - "from" and "to" input parameters should be element nodes

4.6.11
- added boolean parameter "cloned" to the myhandler_deleted event handler (reference of original DIV element is stored in REDIPS.drag.obj_old)

4.6.10
- fixed bug for dropped elements in iPad
  * it seems that Safari Mobile loses registrated events (traditional model) assigned to the DIV element
  * in element_drop() is added definition of event listener after appendChild/insertBefore (obj.onmousedown = handler_onmousedown; ...)

4.6.9
- fixed bug in save_content() - DIV elements without "drag" class name are skipped - thanks to CG Developer
- added parameter REDIPS.drag.save_pname to define parameter name in save_content() method

4.6.8
- modified save_content() method
  * first parameter is id or table reference
  * second parameter is optional and defines output in JSON format
  * table index is not contained in output because save_content() scans content for asked table (table is already known)

4.6.7
- method shift_cells() is declared as public
- fixed bug in case of enable_drag() for newly added DIV element to the table

4.6.6
- added option multiple_drop with options "top" and "bottom" (default value is "bottom") - thanks to Mark Jacobs
- added event handler myhandler_row_dropped_before() - if false is return from this event handler then row drop will be canceled
- added public method delete_object()

4.6.5
- added threshold value (after threshold value is prevailed then events will be fired) - only for cell mode
- known BUG - IE8 not playing nicely with example11 - TODO

4.6.4
- fixed bug for disabled tables inside DIV element
- fixed "nolayout" option for nested tables

4.6.3
- in "switch" mode, reference of last switched element (because TD can contain more elements) will be saved in REDIPS.drag.obj_old property

4.6.2
- added shift_option public property
- added 4 shift modes: horizontal1, horizontal2, vertical1 and vertical2
- extended find_cell method with values "first", "firstInColumn", "firstInRow", "last", "lastInColumn", "lastInRow"
- added public property hover_border (in "row" mode borderTop or borderBottom will be show where whether row will be dropped above or below current row)
- REDIPS.drag.hover_color is no longer used
- working on examples (improving)

4.6.1
- fixed bug with moving table row between two tables (added get_table_index)
  * in line 3080 -> row_drop(get_table_index(p.target[0]), p.target[1], p.obj);

4.6.0
- added support for touch devices (touchstart, touchmove, touchend)
- improved example07 (added EF example)

4.5.4
- added public method find_cell (method returns data for first or last table cell)
- added public property "shift_after" - shift table content after element is deleted (default is true)
- added private mehod element_deleted
- improved example21

4.5.3
- fixed BUG with text nodes and shift animation
- added private method has_childs()

4.5.2
- disable dragging DIV element while animation lasts
- public method enable_table() now accepts table class name and table reference
- text selection is cleared on element click
- added "shift" and "switching" options to example14

4.5.1
- added empty_cell() public method
- added shift_cells() private method
- added delete_shifted public property
- added shift_animation public property
- fixed BUG with cloning last row in table
- added optional "obj" parameter in move_object() public method
- added optional "mode" parameter in relocate() public method
- added public parameter "animation_shift" (default value is false)

4.5.0
- added functionality for cloning and deleting table rows
- added the following event handlers:
    myhandler_row_deleted()
    myhandler_row_undeleted()
    myhandler_row_cloned()
    myhandler_row_notcloned
- added "clone_shiftKey_row" public property
- added example20 "Clone and delete table rows"
- changed redips.dragrow_id to the redips.div (now it is reference to DIV element with class name "drag row")
- replacing window.onload in all examples with advanced event registration model
- added public method row_empty() - marks selected row as empty (tbl_id, row_idx, [color])

4.4.3
- if myhandler_dropped_before() returns false then element drop will be canceled

4.4.2
- modified enable_drag() - optional third parameter is changed from 'container' to 'subtree'
- fixed moving last row from table

4.4.1
- added example19 "Groups and table rows" - thanks to Tomas Lampo
- added public method enable_table()
- added public method find_parent() - find parent element from start position
- added public method clone_div() - clones DIV element
- deleted public method add_events() - not needed any more
- cloned_id property is no longer exposed as public
- code optimization
- code cleaning

4.4.0
- added support for dynamical creation of table layout (inner table inside DIV element can be moved and accept other DIV elements)
- added myhandler_cloned_dropped() event handler
- upgrading example11

4.3.6
- added support for rows with style display='none'

4.3.5
- added option to exclude tables with className "nolayout" (if want to put table in DIV element and drag as any other content)

4.3.4
- fixed bug: drop_option should not have impact in case of dragging table rows

4.3.3
- fixed bug: cloned row (mini_table) should be excluded from tables_nodeList - problem in move_object() when row was dropped outside table

4.3.2
- added public method REDIPS.drag.add_events(HTMLElement) - method adds omousedown and ondblclick event listeners to the DIV element
- handler_onmousedown and handler_ondblclick are set as private methods
- autoscrollX and autoscrollY are set as private methods

4.3.1
- id name "obj_new" changed to "redips_clone"
- added private method "form_elements"
  fixed reseting dropdown menu, checkboxes and so on in case of dragging table rows - thanks to Greg Palmer

4.3.0
- added private method get_table_index
- fixed BUG with public properties animation_pause and animation_step
- added example18

4.2.1
- fixed BUG when row was dropped to the last row position in table
- added redips_dragrow_id property to the cloned row (needed for dropped row identification)
- added opacity_disabled property - (integer) opacity level for disabled elements

4.2.0
- added animation functionality
- move_object() is renamed to relocate()
- move_object() has new meaning - move (animate) objects to specified table positions
- added animation() method
- added get_position method
- added public properties animation_pause and animation_step
- added example17
- modified example12

4.1.1
- fixed bug: in case of multiple dragging containers and enabling/disabling DIV element redips_container property was changed (and that was wrong)
  (added "if" case in enable_drag() method)

4.1.0
- added unlimit nest table support
- modification in init_tables() and table_top()
- modified example13

4.0.5
- fixed bug: in a moment of moving (big) DIV element at page bottom, element jumped to the top instead of staying at the page bottom

4.0.4
- getScrollPosition() and get_style() methods exposed as public methods

4.0.3
- added public myhandler_dropped_before() event handler
    * handler is similar to the myhandler_dropped()
    * myhandler_dropped_before() is called before element is dropped
    * myhandler_dropped() is called after element is dropped
    
4.0.2
- added public myhandler_dblclicked() event handler
    ondblclick event is attached to the DIV object
- changing styles in example13
- fixing example03 (attached ondblclick event to the cloned objects)
- removed target_cell.appendChild(obj) line in case when DIV element was not moved
    click&release mouse button will not place element to the bottom (if table cell contains more than one element)

4.0.0
- added support for drag and drop table rows
- added example15 to show drag rows functionality
- private method set_color() renamed to set_position()
- created private method set_bgcolor() - accepts color as array
- created private method get_bgcolor() - returns color as array
- added public parameter "mode" (readonly) with values "cell" and "row" (REDIPS.drag working mode)
- added private methods row_clone() and row_drop()
- added event handlers for drag-n-drop table rows
    myhandler_row_clicked()
    myhandler_row_moved()
    myhandler_row_notmoved()
    myhandler_row_dropped()
    myhandler_row_dropped_source()
    myhandler_row_changed()
- added special class name "rowhandler" to enable highlighting rows when dragging row across row handler column (but disable when dragging table content)
- special class names are: drag, row, mark, only, single, rowhandler
- enable_drag() modified to accept DIV id or DIV object
- when row is moved then obj is reference to the cloned row, while obj_old is reference to the source row
- added property redips_rowspan to the table nodeList to mark tables that contains rowspaned cells
- redips_rowspan is defined inside init_tables()
- optimization in set_trc() method
    1) search for rowspaned cells only if table contains rowspaned cells
    2) after cell is found, test if Y is inside current cell - this should prevent case where TD border > 1px and upper colspaned row like in example15
       (loop unnecessary went up to the top table top)
- fixed BUG - when table cell has shrunk, forbidden cell in the last row was lit (example15)
- added public method row_opacity(el, opacity, color)
- REDIPS.drag added to the github.com repository https://github.com/dbunic/REDIPS_drag

3.2.1
- fixing example03: School timetable
  * fixing div.sort()
  * added cloning with pressed SHIFT key
 - added script.js in example06 to show how to identify scrollable container after element is dropped

3.2.0
- code optimization in handler_onmousemove()
  set current table, row and cell:
    1) if mouse pointer is inside DIV id="drag"
    2) and autoscroll is not working
    3) and current table contains nested table or cursor is outside of current cell
 - added example14 - Sort elements in long table
 - fixed bug in "switching" mode (two entries are merging or there appears a gap in between)
 - fixed settings of "current cell" in autoscroll mode (modified autoscrollX() and autoscrollY())
 - evt.clientX/evt.clientY replaced with local variables X/Y in handlers
 - added pointer object with pointer.x and pointer.y properties (properties are set in handlers)
 - modified set_trc() - removed input parameter (uses pointer object instead)
 - fixed bug with adding events in IE8
 - fixed bug for case where moved element changed cell dimensions

3.1.3
- problem with calling REDIPS.drag.init() twice (bug fix) - thanks to Alan Jhu
  added line "top_position = 0;" in init_tables()

3.1.2
- internal cleaning and CTRL cloning replaced with SHIFT key

3.1.1
- changed table.idx to table.redips_idx
- changed table.nested to table.redips_table_type with values 2, 1, 0 (this is order for tables array)
  2 - "clean" table (table is not nested and doesn't contain nested tables)
  1 - nested table
  0 - table contains nested tables
- table type 2 will be sorted to the array top
- ctrlKey changed to shiftKey (using the ctrl-key for cloning was a problem on the mac) - fixed thanks to Peter
  
3.1.0
- adding reference of scrollable area to the contained tables (modified enable_drag())
- changed order of calling enable_drag('init') and init_tables() in init() function
- changed set_trc() - tos[] (table offsets are compared with scrollable container offsets)
- in handler_onmousemove() added sca.autoscroll in if condition
- added noautoscroll option for scrollable container (only needed to add class name "noautoscroll")
- fixed overlapping of tables inside scrollable container with other tables
- added "reset old positions" before set_trc() in handler_onmousedown() function

3.0.0
- added support for nested tables
- added example13 (Nested tables)
- added private parameter "top_position" (number of nested tables)
- changes inside init_tables(), top_table(), handler_onmousemove(), set_trc() and save_content()
- nested tables are placed to the array top (main array in REDIPS.drag is "tables")
- cell containing nested table is marked with "table" property (see line "element.table = true;" in init_tables())
- added currentCell.containTable property (needed for testing inside handler_onmousemove()

2.8.2
- added example12 (Select and move more elements)

2.8.1
- changed elementControl() function
* if element has "nodrag" class, then dragging will not be able
* useful for content of DIV element
- added example11 to show custom drag handle on titlebar

2.8.0
- REDIPS namespace created if is not already defined in another REDIPS package (var REDIPS = REDIPS || {};)
- added cross browser add / remove event handlers instead of traditional event registration model
- traditional event registration model used on DIV object for onmousedown event (otherwise problems with dragging selection)
- added REDIPS.event at the bottom
- drag.js renamed to redips-drag.js
! known problem with FF3 and padding/border style on dragging container (DIV element jumps when clicked for that padding/border width)

2.7.1
- table_top() function improved (used indexOf instead of idx property)
- tables.idx property reused for sorting tables to original order
- save_content() fixed - function first sorts tables array to original order using sort function
- bug in save_content() fixed thanks to Harrison
- enabled basic select inside drag region for IE browser
- div_drag.onselectstart moved from init() to handler_onmousedown()
- in handler_onmouseup() detached div_drag.onselectstart handler

2.7.0
- added support for fixed table or table container - position:fixed
- added "position" variable in handler_onmousedown() - needed for exclusion "scroll offset" if table or table container box has position fixed
- box_offset() and calculate_cells() modification - added local variable "position"
- local variable "position" added to enable_drag() function
- added table_top() function to pick up "tables" array member to the top (in a moment when DIV element is clicked)
- added example 10 (Sticky tables)

2.6.3
- if user has used a mouse event to increase the dimensions of the table - call calculate_cells() in handler_onmousedown, thanks to Mark Jacobs

2.6.2
- custom element properties renamed from "enabled" and "container" to "redips_enabled" and "redips_container"
- added example9 (Single and switching mode)

2.6.1
- added public property REDIPS.drag.border (style for enabled element) - default is 'solid'
- fixed "enabled" property for DIV elements

2.6.0
- enabled existence more than 1 DIV container
- added example0 (Minimal steps)
- added example8 (Tables in separated DIV containers)
- main DIV container could have any id (it should'n be id="drag")
- new private method init_tables()
- code cleaning
- fixing example3 - School timetable (set reference to the DIV container in cloned elements)

2.5.0
- added myhandler_changed() - called after target cell changes
- added public object current_cell - can be used in myhandler_changed()
- added public object previous_cell - can be used in myhandler_changed()
- added public method move_object()
- obj_new_div exposed as private variable
- obj_new_offset new private variable
- private method relocate_object() not needed - deleted
- private method in_scrollable() not needed - deleted
- private parameters mouseX & mouseY not needed - deleted
- save_content() method now returns content from all tables if input parameter is undefined
- style definition "position: relative" for drag element is not needed

2.3.2
- added example with scrollable and fixed DIV containers

2.3.1
- fixed issue with nested DIVS in case of "switch" drop option, thanks to Doony

2.3.0
- added "overwrite" drop option

2.2.2
- examples are modified with "body{margin:0px;}" due to wrong offset calculation in IE6 / IE7

2.2.1
- fixed zIndex for cloned objects

2.2.0
- added property "only" to enable defined DIV elements for marked table cell with class name 'only'
- properties "mark_cname", "marked_cell" and "marked_exception" replaced with object "mark"

2.1.1
- enabled textarea to be editable inside a dragable div
- fixed marked_cell property

2.1.0
- scrollable_container() renamed to in_scrollable()
- added sca[] - scrollable container areas
- box_offset() now accepts and "type" parameter to exclude scrollLeft / scrollTop from calculation
- fixed autoscroll bug (autoscroll didn't stop after releasing mouse button during the scrolling)
- created "edge" private object
- removed autoscrollX_flag and autoscrollY_flag global variables (edge.flag.x and edge.flag.y used instead)
- added autoscrolling for div containers

2.0.0
- document.selection.clear() added in init() to prevent text selection for IE8 in case when leftmouse button was clicked and CTRL key was pressed
- box_offset() now considers scrollTop value of elements "above" table
  * element should have something other than default static in "position" style - see example5
  * if not, offsetParent will be NULL and box_offset() will not calculate scroll value
 - added get_style() function
 - added setCapture / releaseCapture to allow dragging outside the window for the IE family
 - added scrollable_container() function
 - fixed bug for the first column in set_trc()
  * before:
  if (currentCell[3] <= evt.clientX && evt.clientX < currentCell[1])
  * after:
  if (currentCell[3] <= evt.clientX && evt.clientX <= currentCell[1])
 
1.9.8
- enable/disable single DIV dragging (enable_drag property)

1.9.7
- new feature "clone_ctrlKey" - if true elements could be cloned with CTRL key

1.9.6
- fixing save_content()
- fixing event handler calling
Something went wrong with that request. Please try again.