Currently, MediaWiki has a mess of resources, some but not all of which are upstream libraries.
This means that occasionally people will attempt to make local modifications of the libraries
by accident, or deliberately but do not flag it, making dependency management a challenge (and
fixing upstream-related bugs a headache).
Instead, we now split the /resources directory into a /resources/lib directory for those items
which are used purely as intact upstream libraries, and a /resources/src directroy for those
which are either local libraries written for MediaWiki and mastered here, or downstream forks
of upstream libraries which require particular care and attention when being upgraded. Also,
some incidental files which are not to be loaded as part of a module have been moved to better
locations.
Upstream libaries
* jquery
resources/jquery/jquery.js
* jquery.appear
resources/jquery/jquery.appear.js
* jquery.async
resources/jquery/jquery.async.js
* jquery.chosen
resources/jquery.chosen/*
* jquery.cookie
resources/jquery/jquery.cookie.js
* jquery.form
resources/jquery/jquery.form.js
* jquery.fullscreen.js
resources/jquery/jquery.fullscreen.js
* jquery.hoverIntent
resources/jquery/jquery.hoverIntent.js
* jquery.json
resources/jquery/jquery.json.js
* jquery.mockjax
resources/jquery/jquery.mockjax.js
* jquery.qunit
resources/jquery/jquery.qunit.css
resources/jquery/jquery.qunit.js
* jquery.jStorage
resources/jquery/jquery.jStorage.js
* jquery.throttle-debounce
resources/jquery/jquery.ba-throttle-debounce.js
* jquery.validate
resources/jquery/jquery.validate.js
* jquery.xmldom
resources/jquery/jquery.xmldom.js
* moment
resources/moment/*
* OOjs
resource/oojs/*
* OOjs UI
resources/oojs-ui/*
* jquery.ui.*
resources/jquery.ui/*
resources/jquery.ui/themes/default moved to resources/lib/jquery.ui/themes/
resources/jquery.ui/themes/vector moved to resources/src/jquery.ui-themes/
* jquery.effects.*
resources/jquery.effects/*
* sinon
resources/sinonjs/*
Upstream libraries forked for MediaWiki
* jquery.color
resources/jquery/jquery.color.js
* jquery.tipsy
resources/jquery.tipsy/*
Local libraries
* jquery.arrowSteps
resources/jquery/jquery.arrowSteps.css
resources/jquery/jquery.arrowSteps.js
resources/jquery/images/jquery.arrowSteps.divider-ltr.png
resources/jquery/images/jquery.arrowSteps.divider-rtl.png
resources/jquery/images/jquery.arrowSteps.head-ltr.png
resources/jquery/images/jquery.arrowSteps.head-rtl.png
resources/jquery/images/jquery.arrowSteps.tail-ltr.png
resources/jquery/images/jquery.arrowSteps.tail-rtl.png
* jquery.autoEllipsis
resources/jquery/jquery.autoEllipsis.js
* jquery.badge
resources/jquery/jquery.badge.css
resources/jquery/jquery.badge.js
* jquery.byteLength
resources/jquery/jquery.byteLength.js
* jquery.byteLimit
resources/jquery/jquery.byteLimit.js
* jquery.checkboxShiftClick
resources/jquery/jquery.checkboxShiftClick.js
* jquery.client
resources/jquery/jquery.client.js
* jquery.colorUtil
resources/jquery/jquery.colorUtil.js
* jquery.delayedBind
resources/jquery/jquery.delayedBind.js
* jquery.expandableField
resources/jquery/jquery.expandableField.js
* jquery.farbtastic
resources/jquery/jquery.farbtastic.css
resources/jquery/jquery.farbtastic.js
resources/jquery/images/marker.png
resources/jquery/images/mask.png
resources/jquery/images/wheel.png
* jquery.footHovzer
resources/jquery/jquery.footHovzer.css
resources/jquery/jquery.footHovzer.js
* jquery.getAttrs
resources/jquery/jquery.getAttrs.js
* jquery.hidpi
resources/jquery/jquery.hidpi.js
* jquery.highlightText
resources/jquery/jquery.highlightText.js
* jquery.localize
resources/jquery/jquery.localize.js
* jquery.makeCollapsible
resources/jquery/jquery.makeCollapsible.css
resources/jquery/jquery.makeCollapsible.js
* jquery.mw-jump
resources/jquery/jquery.mw-jump.js
* jquery.mwExtension
resources/jquery/jquery.mwExtension.js
* jquery.placeholder
resources/jquery/jquery.placeholder.js
* jquery.spinner
resources/jquery/jquery.spinner.css
resources/jquery/jquery.spinner.js
resources/jquery/images/spinner-large.gif
resources/jquery/images/spinner.gif
* jquery.suggestions
resources/jquery/jquery.suggestions.css
resources/jquery/jquery.suggestions.js
* jquery.tabIndex
resources/jquery/jquery.tabIndex.js
* jquery.tablesorter
resources/jquery/jquery.tablesorter.css
resources/jquery/jquery.tablesorter.js
resources/jquery/images/sort_both.gif
resources/jquery/images/sort_down.gif
resources/jquery/images/sort_none.gif
resources/jquery/images/sort_up.gif
* jquery.textSelection
resources/jquery/jquery.textSelection.js
* jquery.qunit.completenessTest
resources/jquery/jquery.qunit.completenessTest.js
* mediawiki
resources/mediawiki/mediawiki.js
resources/mediawiki/mediawiki.log.js
* mediawiki.api
resources/mediawiki.api/mediawiki.api.js
* mediawiki.api.category
resources/mediawiki.api/mediawiki.api.category.js
* mediawiki.api.edit
resources/mediawiki.api/mediawiki.api.edit.js
* mediawiki.api.login
resources/mediawiki.api/mediawiki.api.login.js
* mediawiki.api.parse
resources/mediawiki.api/mediawiki.api.parse.js
* mediawiki.api.watch
resources/mediawiki.api/mediawiki.api.watch.js
* mediawiki.debug
resources/mediawiki/mediawiki.debug.js
resources/mediawiki/mediawiki.debug.less
resources/mediawiki/mediawiki.debug.profile.css
resources/mediawiki/mediawiki.debug.profile.js
* mediawiki.debug.init
resources/mediawiki/mediawiki.debug.init.js
* mediawiki.feedback
resources/mediawiki/mediawiki.feedback.css
resources/mediawiki/mediawiki.feedback.js
resources/mediawiki/mediawiki.feedback.spinner.gif
* mediawiki.hidpi
resources/mediawiki/mediawiki.hidpi.js
* mediawiki.hlist
resources/mediawiki/mediawiki.hlist.css
resources/mediawiki/mediawiki.hlist.js
* mediawiki.htmlform
resources/mediawiki/mediawiki.htmlform.js
* mediawiki.icon
resources/mediawiki/mediawiki.icon.less
resources/mediawiki/images/arrow-collapsed-ltr.png
resources/mediawiki/images/arrow-collapsed-ltr.svg
resources/mediawiki/images/arrow-collapsed-rtl.png
resources/mediawiki/images/arrow-collapsed-rtl.svg
resources/mediawiki/images/arrow-expanded.png
resources/mediawiki/images/arrow-expanded.svg
* mediawiki.inspect
resources/mediawiki/mediawiki.inspect.js
* mediawiki.notification
resources/mediawiki/mediawiki.notification.css
resources/mediawiki/mediawiki.notification.hideForPrint.css
resources/mediawiki/mediawiki.notification.js
* mediawiki.notify
resources/mediawiki/mediawiki.notify.js
* mediawiki.searchSuggest
resources/mediawiki/mediawiki.searchSuggest.css
resources/mediawiki/mediawiki.searchSuggest.js
* mediawiki.Title
resources/mediawiki/mediawiki.Title.js
* mediawiki.toc
resources/mediawiki/mediawiki.toc.js
* mediawiki.Uri
resources/mediawiki/mediawiki.Uri.js
* mediawiki.user
resources/mediawiki/mediawiki.user.js
* mediawiki.util
resources/mediawiki/mediawiki.util.js
* mediawiki.action.edit
resources/mediawiki.action/mediawiki.action.edit.js
* mediawiki.action.edit.styles
resources/mediawiki.action/mediawiki.action.edit.styles.css
* mediawiki.action.edit.collapsibleFooter
resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css
resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js
* mediawiki.action.edit.preview
resources/mediawiki.action/mediawiki.action.edit.preview.js
* mediawiki.action.history
resources/mediawiki.action/mediawiki.action.history.js
* mediawiki.action.history.diff
resources/mediawiki.action/mediawiki.action.history.diff.css
* mediawiki.action.view.dblClickEdit
resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js
* mediawiki.action.view.metadata
resources/mediawiki.action/mediawiki.action.view.metadata.js
* mediawiki.action.view.postEdit
resources/mediawiki.action/mediawiki.action.view.postEdit.css
resources/mediawiki.action/mediawiki.action.view.postEdit.js
resources/mediawiki.action/images/green-checkmark.png
* mediawiki.action.view.redirectToFragment
resources/mediawiki.action/mediawiki.action.view.redirectToFragment.js
* mediawiki.action.view.rightClickEdit
resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js
* mediawiki.action.edit.editWarning
resources/mediawiki.action/mediawiki.action.edit.editWarning.js
* mediawiki.action.watch.ajax
No files associated with this resource.
* mediawiki.language
resources/mediawiki.language/mediawiki.language.js
resources/mediawiki.language/mediawiki.language.numbers.js
resources/mediawiki.language/languages/bs.js
resources/mediawiki.language/languages/dsb.js
resources/mediawiki.language/languages/fi.js
resources/mediawiki.language/languages/ga.js
resources/mediawiki.language/languages/he.js
resources/mediawiki.language/languages/hsb.js
resources/mediawiki.language/languages/hu.js
resources/mediawiki.language/languages/hy.js
resources/mediawiki.language/languages/la.js
resources/mediawiki.language/languages/os.js
resources/mediawiki.language/languages/ru.js
resources/mediawiki.language/languages/sl.js
resources/mediawiki.language/languages/uk.js
* mediawiki.cldr
resources/mediawiki.language/mediawiki.cldr.js
* mediawiki.libs.pluralruleparser
Possibly should be moved to /lib
resources/mediawiki.libs/CLDRPluralRuleParser.js
* mediawiki.language.init
resources/mediawiki.language/mediawiki.language.init.js
* mediawiki.jqueryMsg
resources/mediawiki/mediawiki.jqueryMsg.js
resources/mediawiki/mediawiki.jqueryMsg.peg
* mediawiki.language.months
resources/mediawiki.language/mediawiki.language.months.js
* mediawiki.libs.jpegmeta
resources/mediawiki.libs/mediawiki.libs.jpegmeta.js
* mediawiki.page.gallery
resources/mediawiki.page/mediawiki.page.gallery.js
* mediawiki.page.ready
resources/mediawiki.page/mediawiki.page.ready.js
* mediawiki.page.startup
resources/mediawiki.page/mediawiki.page.startup.js
* mediawiki.page.patrol.ajax
resources/mediawiki.page/mediawiki.page.patrol.ajax.js
* mediawiki.page.watch.ajax
resources/mediawiki.page/mediawiki.page.watch.ajax.js
* mediawiki.page.image.pagination
resources/mediawiki.page/mediawiki.page.image.pagination.js
* mediawiki.special
resources/mediawiki.special/mediawiki.special.css
resources/mediawiki.special/mediawiki.special.js
* mediawiki.special.block
resources/mediawiki.special/mediawiki.special.block.css
resources/mediawiki.special/mediawiki.special.block.js
* mediawiki.special.changeemail
resources/mediawiki.special/mediawiki.special.changeemail.css
resources/mediawiki.special/mediawiki.special.changeemail.js
* mediawiki.special.changeslist
resources/mediawiki.special/mediawiki.special.changeslist.css
* mediawiki.special.changeslist.legend
resources/mediawiki.special/mediawiki.special.changeslist.legend.css
* mediawiki.special.changeslist.legend.js
resources/mediawiki.special/mediawiki.special.changeslist.legend.js
* mediawiki.special.changeslist.enhanced
resources/mediawiki.special/mediawiki.special.changeslist.enhanced.css
* mediawiki.special.movePage
resources/mediawiki.special/mediawiki.special.movePage.js
* mediawiki.special.pagesWithProp
resources/mediawiki.special/mediawiki.special.pagesWithProp.css
* mediawiki.special.preferences
resources/mediawiki.special/mediawiki.special.preferences.css
resources/mediawiki.special/mediawiki.special.preferences.js
* mediawiki.special.recentchanges
resources/mediawiki.special/mediawiki.special.recentchanges.js
* mediawiki.special.search
resources/mediawiki.special/mediawiki.special.search.css
resources/mediawiki.special/mediawiki.special.search.js
* mediawiki.special.undelete
resources/mediawiki.special/mediawiki.special.undelete.js
* mediawiki.special.upload
resources/mediawiki.special/mediawiki.special.upload.js
* mediawiki.special.userlogin.common.styles
resources/mediawiki.special/mediawiki.special.userlogin.common.css
resources/mediawiki.special/images/icon-lock.png
* mediawiki.special.userlogin.signup.styles
resources/mediawiki.special/mediawiki.special.userlogin.signup.css
resources/mediawiki.special/images/icon-edits.png
resources/mediawiki.special/images/icon-pages.png
resources/mediawiki.special/images/icon-contributors.png
* mediawiki.special.userlogin.login.styles
resources/mediawiki.special/mediawiki.special.userlogin.login.css
resources/mediawiki.special/images/glyph-people-large.png
* mediawiki.special.userlogin.common.js
resources/mediawiki.special/mediawiki.special.userlogin.common.js
* mediawiki.special.userlogin.signup.js
resources/mediawiki.special/mediawiki.special.userlogin.signup.js
* mediawiki.special.javaScriptTest
resources/mediawiki.special/mediawiki.special.javaScriptTest.js
* mediawiki.special.version
resources/mediawiki.special/mediawiki.special.version.css
* mediawiki.ui
resources/mediawiki.ui/default.less
resources/mediawiki.ui/vector.less
resources/mediawiki.ui/components/utilities.less
resources/mediawiki.ui/components/default/forms.less
resources/mediawiki.ui/components/vector/containers.less
resources/mediawiki.ui/components/vector/forms.less
resources/mediawiki.ui/mixins/effects.less
resources/mediawiki.ui/mixins/forms.less
resources/mediawiki.ui/mixins/type.less
resources/mediawiki.ui/mixins/utilities.less
resources/mediawiki.ui/settings/colors.less
resources/mediawiki.ui/settings/typography.less
resources/mediawiki.ui/styleguide.md
* mediawiki.ui.button
resources/mediawiki.ui/components/default/buttons.less
resources/mediawiki.ui/components/vector/buttons.less
Legacy modules, untouched:
* mediawiki.legacy.ajax
* mediawiki.legacy.commonPrint
* mediawiki.legacy.config
* mediawiki.legacy.protect
* mediawiki.legacy.shared
* mediawiki.legacy.oldshared
* mediawiki.legacy.upload
* mediawiki.legacy.wikibits
Miscellaneous files moved elsewhere
* A currently-failing (unused?) script attempting to build some kss style documentation.
Previously in the root of the resources directory, now moved to a new folder, /docs/kss.
Makefile
README.txt
package.json
scripts/nodecheck.sh
styleguide-template/index.html
styleguide-template/public/kss.less
styleguide-template/public/less.js
* ResourceLoader startup JS code was also moved to /src
resources/startup.js
* mediawiki.mixins, hard-coded to be loaded by ResourceLoader, also moved to /src
resources/mediawiki.less/mediawiki.mixins.animation.less
resources/mediawiki.less/mediawiki.mixins.less
resources/mediawiki.less/mediawiki.mixins.rotation.less
* jquery.cycle.all.js appears not to be refered to (?!):
(added in 2f1f0abc6b)
resources/jquery/jquery.cycle.all.js
Change-Id: Id5ead1453412e763bdb3763084e43694517088fd
301 lines
10 KiB
JavaScript
301 lines
10 KiB
JavaScript
/*!
|
|
* jQuery UI Droppable 1.8.24
|
|
*
|
|
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
|
* Dual licensed under the MIT or GPL Version 2 licenses.
|
|
* http://jquery.org/license
|
|
*
|
|
* http://docs.jquery.com/UI/Droppables
|
|
*
|
|
* Depends:
|
|
* jquery.ui.core.js
|
|
* jquery.ui.widget.js
|
|
* jquery.ui.mouse.js
|
|
* jquery.ui.draggable.js
|
|
*/
|
|
(function( $, undefined ) {
|
|
|
|
$.widget("ui.droppable", {
|
|
widgetEventPrefix: "drop",
|
|
options: {
|
|
accept: '*',
|
|
activeClass: false,
|
|
addClasses: true,
|
|
greedy: false,
|
|
hoverClass: false,
|
|
scope: 'default',
|
|
tolerance: 'intersect'
|
|
},
|
|
_create: function() {
|
|
|
|
var o = this.options, accept = o.accept;
|
|
this.isover = 0; this.isout = 1;
|
|
|
|
this.accept = $.isFunction(accept) ? accept : function(d) {
|
|
return d.is(accept);
|
|
};
|
|
|
|
//Store the droppable's proportions
|
|
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
|
|
|
// Add the reference and positions to the manager
|
|
$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
|
|
$.ui.ddmanager.droppables[o.scope].push(this);
|
|
|
|
(o.addClasses && this.element.addClass("ui-droppable"));
|
|
|
|
},
|
|
|
|
destroy: function() {
|
|
var drop = $.ui.ddmanager.droppables[this.options.scope];
|
|
for ( var i = 0; i < drop.length; i++ )
|
|
if ( drop[i] == this )
|
|
drop.splice(i, 1);
|
|
|
|
this.element
|
|
.removeClass("ui-droppable ui-droppable-disabled")
|
|
.removeData("droppable")
|
|
.unbind(".droppable");
|
|
|
|
return this;
|
|
},
|
|
|
|
_setOption: function(key, value) {
|
|
|
|
if(key == 'accept') {
|
|
this.accept = $.isFunction(value) ? value : function(d) {
|
|
return d.is(value);
|
|
};
|
|
}
|
|
$.Widget.prototype._setOption.apply(this, arguments);
|
|
},
|
|
|
|
_activate: function(event) {
|
|
var draggable = $.ui.ddmanager.current;
|
|
if(this.options.activeClass) this.element.addClass(this.options.activeClass);
|
|
(draggable && this._trigger('activate', event, this.ui(draggable)));
|
|
},
|
|
|
|
_deactivate: function(event) {
|
|
var draggable = $.ui.ddmanager.current;
|
|
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
|
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
|
|
},
|
|
|
|
_over: function(event) {
|
|
|
|
var draggable = $.ui.ddmanager.current;
|
|
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
|
|
|
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
|
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
|
|
this._trigger('over', event, this.ui(draggable));
|
|
}
|
|
|
|
},
|
|
|
|
_out: function(event) {
|
|
|
|
var draggable = $.ui.ddmanager.current;
|
|
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
|
|
|
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
|
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
|
this._trigger('out', event, this.ui(draggable));
|
|
}
|
|
|
|
},
|
|
|
|
_drop: function(event,custom) {
|
|
|
|
var draggable = custom || $.ui.ddmanager.current;
|
|
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
|
|
|
|
var childrenIntersection = false;
|
|
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
|
var inst = $.data(this, 'droppable');
|
|
if(
|
|
inst.options.greedy
|
|
&& !inst.options.disabled
|
|
&& inst.options.scope == draggable.options.scope
|
|
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
|
|
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
|
|
) { childrenIntersection = true; return false; }
|
|
});
|
|
if(childrenIntersection) return false;
|
|
|
|
if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
|
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
|
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
|
this._trigger('drop', event, this.ui(draggable));
|
|
return this.element;
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
ui: function(c) {
|
|
return {
|
|
draggable: (c.currentItem || c.element),
|
|
helper: c.helper,
|
|
position: c.position,
|
|
offset: c.positionAbs
|
|
};
|
|
}
|
|
|
|
});
|
|
|
|
$.extend($.ui.droppable, {
|
|
version: "1.8.24"
|
|
});
|
|
|
|
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
|
|
|
if (!droppable.offset) return false;
|
|
|
|
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
|
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
|
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
|
t = droppable.offset.top, b = t + droppable.proportions.height;
|
|
|
|
switch (toleranceMode) {
|
|
case 'fit':
|
|
return (l <= x1 && x2 <= r
|
|
&& t <= y1 && y2 <= b);
|
|
break;
|
|
case 'intersect':
|
|
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
|
|
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
|
|
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
|
|
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
|
|
break;
|
|
case 'pointer':
|
|
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
|
|
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
|
|
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
|
|
return isOver;
|
|
break;
|
|
case 'touch':
|
|
return (
|
|
(y1 >= t && y1 <= b) || // Top edge touching
|
|
(y2 >= t && y2 <= b) || // Bottom edge touching
|
|
(y1 < t && y2 > b) // Surrounded vertically
|
|
) && (
|
|
(x1 >= l && x1 <= r) || // Left edge touching
|
|
(x2 >= l && x2 <= r) || // Right edge touching
|
|
(x1 < l && x2 > r) // Surrounded horizontally
|
|
);
|
|
break;
|
|
default:
|
|
return false;
|
|
break;
|
|
}
|
|
|
|
};
|
|
|
|
/*
|
|
This manager tracks offsets of draggables and droppables
|
|
*/
|
|
$.ui.ddmanager = {
|
|
current: null,
|
|
droppables: { 'default': [] },
|
|
prepareOffsets: function(t, event) {
|
|
|
|
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
|
|
var type = event ? event.type : null; // workaround for #2317
|
|
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
|
|
|
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
|
|
|
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
|
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
|
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
|
|
|
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
|
|
|
|
m[i].offset = m[i].element.offset();
|
|
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
|
|
|
}
|
|
|
|
},
|
|
drop: function(draggable, event) {
|
|
|
|
var dropped = false;
|
|
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
|
|
|
if(!this.options) return;
|
|
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
|
dropped = this._drop.call(this, event) || dropped;
|
|
|
|
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
|
this.isout = 1; this.isover = 0;
|
|
this._deactivate.call(this, event);
|
|
}
|
|
|
|
});
|
|
return dropped;
|
|
|
|
},
|
|
dragStart: function( draggable, event ) {
|
|
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
|
|
draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
|
|
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
|
});
|
|
},
|
|
drag: function(draggable, event) {
|
|
|
|
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
|
|
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
|
|
|
|
//Run through all droppables and check their positions based on specific tolerance options
|
|
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
|
|
|
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
|
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
|
|
|
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
|
if(!c) return;
|
|
|
|
var parentInstance;
|
|
if (this.options.greedy) {
|
|
// find droppable parents with same scope
|
|
var scope = this.options.scope;
|
|
var parent = this.element.parents(':data(droppable)').filter(function () {
|
|
return $.data(this, 'droppable').options.scope === scope;
|
|
});
|
|
|
|
if (parent.length) {
|
|
parentInstance = $.data(parent[0], 'droppable');
|
|
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
// we just moved into a greedy child
|
|
if (parentInstance && c == 'isover') {
|
|
parentInstance['isover'] = 0;
|
|
parentInstance['isout'] = 1;
|
|
parentInstance._out.call(parentInstance, event);
|
|
}
|
|
|
|
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
|
this[c == "isover" ? "_over" : "_out"].call(this, event);
|
|
|
|
// we just moved out of a greedy child
|
|
if (parentInstance && c == 'isout') {
|
|
parentInstance['isout'] = 0;
|
|
parentInstance['isover'] = 1;
|
|
parentInstance._over.call(parentInstance, event);
|
|
}
|
|
});
|
|
|
|
},
|
|
dragStop: function( draggable, event ) {
|
|
draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
|
|
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
|
|
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
|
}
|
|
};
|
|
|
|
})(jQuery);
|