r60130 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60129‎ | r60130 | r60131 >
Date:19:49, 16 December 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Add jQuery UI droppable to UsabilityInitiative JS, needed due to dodgy interaction between LQT and UsabilityInitiative jQuery instances
Modified paths:
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.min.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/js2/jquery-ui-1.7.2.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.js
@@ -5659,7 +5659,291 @@
56605660 });
56615661
56625662 })(jQuery);
 5663+
56635664 /*
 5665+ * jQuery UI Droppable 1.7.2
 5666+ *
 5667+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 5668+ * Dual licensed under the MIT (MIT-LICENSE.txt)
 5669+ * and GPL (GPL-LICENSE.txt) licenses.
 5670+ *
 5671+ * http://docs.jquery.com/UI/Droppables
 5672+ *
 5673+ * Depends:
 5674+ * ui.core.js
 5675+ * ui.draggable.js
 5676+ */
 5677+(function($) {
 5678+
 5679+$.widget("ui.droppable", {
 5680+
 5681+ _init: function() {
 5682+
 5683+ var o = this.options, accept = o.accept;
 5684+ this.isover = 0; this.isout = 1;
 5685+
 5686+ this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
 5687+ return d.is(accept);
 5688+ };
 5689+
 5690+ //Store the droppable's proportions
 5691+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
 5692+
 5693+ // Add the reference and positions to the manager
 5694+ $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
 5695+ $.ui.ddmanager.droppables[this.options.scope].push(this);
 5696+
 5697+ (this.options.addClasses && this.element.addClass("ui-droppable"));
 5698+
 5699+ },
 5700+
 5701+ destroy: function() {
 5702+ var drop = $.ui.ddmanager.droppables[this.options.scope];
 5703+ for ( var i = 0; i < drop.length; i++ )
 5704+ if ( drop[i] == this )
 5705+ drop.splice(i, 1);
 5706+
 5707+ this.element
 5708+ .removeClass("ui-droppable ui-droppable-disabled")
 5709+ .removeData("droppable")
 5710+ .unbind(".droppable");
 5711+ },
 5712+
 5713+ _setData: function(key, value) {
 5714+
 5715+ if(key == 'accept') {
 5716+ this.options.accept = value && $.isFunction(value) ? value : function(d) {
 5717+ return d.is(value);
 5718+ };
 5719+ } else {
 5720+ $.widget.prototype._setData.apply(this, arguments);
 5721+ }
 5722+
 5723+ },
 5724+
 5725+ _activate: function(event) {
 5726+ var draggable = $.ui.ddmanager.current;
 5727+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
 5728+ (draggable && this._trigger('activate', event, this.ui(draggable)));
 5729+ },
 5730+
 5731+ _deactivate: function(event) {
 5732+ var draggable = $.ui.ddmanager.current;
 5733+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
 5734+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
 5735+ },
 5736+
 5737+ _over: function(event) {
 5738+
 5739+ var draggable = $.ui.ddmanager.current;
 5740+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
 5741+
 5742+ if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 5743+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
 5744+ this._trigger('over', event, this.ui(draggable));
 5745+ }
 5746+
 5747+ },
 5748+
 5749+ _out: function(event) {
 5750+
 5751+ var draggable = $.ui.ddmanager.current;
 5752+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
 5753+
 5754+ if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 5755+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
 5756+ this._trigger('out', event, this.ui(draggable));
 5757+ }
 5758+
 5759+ },
 5760+
 5761+ _drop: function(event,custom) {
 5762+
 5763+ var draggable = custom || $.ui.ddmanager.current;
 5764+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
 5765+
 5766+ var childrenIntersection = false;
 5767+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
 5768+ var inst = $.data(this, 'droppable');
 5769+ if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
 5770+ childrenIntersection = true; return false;
 5771+ }
 5772+ });
 5773+ if(childrenIntersection) return false;
 5774+
 5775+ if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 5776+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
 5777+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
 5778+ this._trigger('drop', event, this.ui(draggable));
 5779+ return this.element;
 5780+ }
 5781+
 5782+ return false;
 5783+
 5784+ },
 5785+
 5786+ ui: function(c) {
 5787+ return {
 5788+ draggable: (c.currentItem || c.element),
 5789+ helper: c.helper,
 5790+ position: c.position,
 5791+ absolutePosition: c.positionAbs, //deprecated
 5792+ offset: c.positionAbs
 5793+ };
 5794+ }
 5795+
 5796+});
 5797+
 5798+$.extend($.ui.droppable, {
 5799+ version: "1.7.2",
 5800+ eventPrefix: 'drop',
 5801+ defaults: {
 5802+ accept: '*',
 5803+ activeClass: false,
 5804+ addClasses: true,
 5805+ greedy: false,
 5806+ hoverClass: false,
 5807+ scope: 'default',
 5808+ tolerance: 'intersect'
 5809+ }
 5810+});
 5811+
 5812+$.ui.intersect = function(draggable, droppable, toleranceMode) {
 5813+
 5814+ if (!droppable.offset) return false;
 5815+
 5816+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
 5817+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
 5818+ var l = droppable.offset.left, r = l + droppable.proportions.width,
 5819+ t = droppable.offset.top, b = t + droppable.proportions.height;
 5820+
 5821+ switch (toleranceMode) {
 5822+ case 'fit':
 5823+ return (l < x1 && x2 < r
 5824+ && t < y1 && y2 < b);
 5825+ break;
 5826+ case 'intersect':
 5827+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
 5828+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
 5829+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
 5830+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
 5831+ break;
 5832+ case 'pointer':
 5833+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
 5834+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
 5835+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
 5836+ return isOver;
 5837+ break;
 5838+ case 'touch':
 5839+ return (
 5840+ (y1 >= t && y1 <= b) || // Top edge touching
 5841+ (y2 >= t && y2 <= b) || // Bottom edge touching
 5842+ (y1 < t && y2 > b) // Surrounded vertically
 5843+ ) && (
 5844+ (x1 >= l && x1 <= r) || // Left edge touching
 5845+ (x2 >= l && x2 <= r) || // Right edge touching
 5846+ (x1 < l && x2 > r) // Surrounded horizontally
 5847+ );
 5848+ break;
 5849+ default:
 5850+ return false;
 5851+ break;
 5852+ }
 5853+
 5854+};
 5855+
 5856+/*
 5857+ This manager tracks offsets of draggables and droppables
 5858+*/
 5859+$.ui.ddmanager = {
 5860+ current: null,
 5861+ droppables: { 'default': [] },
 5862+ prepareOffsets: function(t, event) {
 5863+
 5864+ var m = $.ui.ddmanager.droppables[t.options.scope];
 5865+ var type = event ? event.type : null; // workaround for #2317
 5866+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
 5867+
 5868+ droppablesLoop: for (var i = 0; i < m.length; i++) {
 5869+
 5870+ if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
 5871+ 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
 5872+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
 5873+
 5874+ m[i].offset = m[i].element.offset();
 5875+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
 5876+
 5877+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
 5878+
 5879+ }
 5880+
 5881+ },
 5882+ drop: function(draggable, event) {
 5883+
 5884+ var dropped = false;
 5885+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
 5886+
 5887+ if(!this.options) return;
 5888+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
 5889+ dropped = this._drop.call(this, event);
 5890+
 5891+ if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 5892+ this.isout = 1; this.isover = 0;
 5893+ this._deactivate.call(this, event);
 5894+ }
 5895+
 5896+ });
 5897+ return dropped;
 5898+
 5899+ },
 5900+ drag: function(draggable, event) {
 5901+
 5902+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
 5903+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
 5904+
 5905+ //Run through all droppables and check their positions based on specific tolerance options
 5906+
 5907+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
 5908+
 5909+ if(this.options.disabled || this.greedyChild || !this.visible) return;
 5910+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
 5911+
 5912+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
 5913+ if(!c) return;
 5914+
 5915+ var parentInstance;
 5916+ if (this.options.greedy) {
 5917+ var parent = this.element.parents(':data(droppable):eq(0)');
 5918+ if (parent.length) {
 5919+ parentInstance = $.data(parent[0], 'droppable');
 5920+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
 5921+ }
 5922+ }
 5923+
 5924+ // we just moved into a greedy child
 5925+ if (parentInstance && c == 'isover') {
 5926+ parentInstance['isover'] = 0;
 5927+ parentInstance['isout'] = 1;
 5928+ parentInstance._out.call(parentInstance, event);
 5929+ }
 5930+
 5931+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
 5932+ this[c == "isover" ? "_over" : "_out"].call(this, event);
 5933+
 5934+ // we just moved out of a greedy child
 5935+ if (parentInstance && c == 'isout') {
 5936+ parentInstance['isout'] = 0;
 5937+ parentInstance['isover'] = 1;
 5938+ parentInstance._over.call(parentInstance, event);
 5939+ }
 5940+ });
 5941+
 5942+ }
 5943+};
 5944+
 5945+})(jQuery);
 5946+
 5947+/*
56645948 * jQuery UI Resizable 1.7.2
56655949 *
56665950 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2.combined.min.js
@@ -505,7 +505,13 @@
506506 if(o.snapMode!='inner'){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;}
507507 var first=(ts||bs||ls||rs);if(o.snapMode!='outer'){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;}
508508 if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first))
509 -(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||o.stack.min)-(parseInt($(b).css("zIndex"),10)||o.stack.min);});$(group).each(function(i){this.style.zIndex=o.stack.min+i;});this[0].style.zIndex=o.stack.min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{_init:function(){var self=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||'ui-resizable-helper':null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css('position'))&&$.browser.opera)
 509+(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack.group)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||o.stack.min)-(parseInt($(b).css("zIndex"),10)||o.stack.min);});$(group).each(function(i){this.style.zIndex=o.stack.min+i;});this[0].style.zIndex=o.stack.min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($){$.widget("ui.droppable",{_init:function(){var o=this.options,accept=o.accept;this.isover=0;this.isout=1;this.options.accept=this.options.accept&&$.isFunction(this.options.accept)?this.options.accept:function(d){return d.is(accept);};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};$.ui.ddmanager.droppables[this.options.scope]=$.ui.ddmanager.droppables[this.options.scope]||[];$.ui.ddmanager.droppables[this.options.scope].push(this);(this.options.addClasses&&this.element.addClass("ui-droppable"));},destroy:function(){var drop=$.ui.ddmanager.droppables[this.options.scope];for(var i=0;i<drop.length;i++)
 510+if(drop[i]==this)
 511+drop.splice(i,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");},_setData:function(key,value){if(key=='accept'){this.options.accept=value&&$.isFunction(value)?value:function(d){return d.is(value);};}else{$.widget.prototype._setData.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;if(this.options.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;if(this.options.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;var childrenIntersection=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var inst=$.data(this,'droppable');if(inst.options.greedy&&$.ui.intersect(draggable,$.extend(inst,{offset:inst.element.offset()}),inst.options.tolerance)){childrenIntersection=true;return false;}});if(childrenIntersection)return false;if(this.options.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;}
 512+return false;},ui:function(c){return{draggable:(c.currentItem||c.element),helper:c.helper,position:c.position,absolutePosition:c.positionAbs,offset:c.positionAbs};}});$.extend($.ui.droppable,{version:"1.7.2",eventPrefix:'drop',defaults:{accept:'*',activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:'default',tolerance:'intersect'}});$.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)&&x2-(draggable.helperProportions.width/2)<r&&t<y1+(draggable.helperProportions.height/2)&&y2-(draggable.helperProportions.height/2)<b);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)||(y2>=t&&y2<=b)||(y1<t&&y2>b))&&((x1>=l&&x1<=r)||(x2>=l&&x2<=r)||(x1<l&&x2>r));break;default:return false;break;}};$.ui.ddmanager={current:null,droppables:{'default':[]},prepareOffsets:function(t,event){var m=$.ui.ddmanager.droppables[t.options.scope];var type=event?event.type:null;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].options.accept.call(m[i].element[0],(t.currentItem||t.element))))continue;for(var j=0;j<list.length;j++){if(list[j]==m[i].element[0]){m[i].proportions.height=0;continue droppablesLoop;}};m[i].visible=m[i].element.css("display")!="none";if(!m[i].visible)continue;m[i].offset=m[i].element.offset();m[i].proportions={width:m[i].element[0].offsetWidth,height:m[i].element[0].offsetHeight};if(type=="mousedown")m[i]._activate.call(m[i],event);}},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))
 513+dropped=this._drop.call(this,event);if(!this.options.disabled&&this.visible&&this.options.accept.call(this.element[0],(draggable.currentItem||draggable.element))){this.isout=1;this.isover=0;this._deactivate.call(this,event);}});return dropped;},drag:function(draggable,event){if(draggable.options.refreshPositions)$.ui.ddmanager.prepareOffsets(draggable,event);$.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){var parent=this.element.parents(':data(droppable):eq(0)');if(parent.length){parentInstance=$.data(parent[0],'droppable');parentInstance.greedyChild=(c=='isover'?1:0);}}
 514+if(parentInstance&&c=='isover'){parentInstance['isover']=0;parentInstance['isout']=1;parentInstance._out.call(parentInstance,event);}
 515+this[c]=1;this[c=='isout'?'isover':'isout']=0;this[c=="isover"?"_over":"_out"].call(this,event);if(parentInstance&&c=='isout'){parentInstance['isout']=0;parentInstance['isover']=1;parentInstance._over.call(parentInstance,event);}});}};})(jQuery);(function($){$.widget("ui.resizable",$.extend({},$.ui.mouse,{_init:function(){var self=this,o=this.options;this.element.addClass("ui-resizable");$.extend(this,{_aspectRatio:!!(o.aspectRatio),aspectRatio:o.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:o.helper||o.ghost||o.animate?o.helper||'ui-resizable-helper':null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css('position'))&&$.browser.opera)
510516 this.element.css({position:'relative',top:'auto',left:'auto'});this.element.wrap($('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css('position'),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css('top'),left:this.element.css('left')}));this.element=this.element.parent().data("resizable",this.element.data('resizable'));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css('resize');this.originalElement.css('resize','none');this._proportionallyResizeElements.push(this.originalElement.css({position:'static',zoom:1,display:'block'}));this.originalElement.css({margin:this.originalElement.css('margin')});this._proportionallyResize();}
511517 this.handles=o.handles||(!$('.ui-resizable-handle',this.element).length?"e,s,se":{n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'});if(this.handles.constructor==String){if(this.handles=='all')this.handles='n,e,s,w,se,sw,ne,nw';var n=this.handles.split(",");this.handles={};for(var i=0;i<n.length;i++){var handle=$.trim(n[i]),hname='ui-resizable-'+handle;var axis=$('<div class="ui-resizable-handle '+hname+'"></div>');if(/sw|se|ne|nw/.test(handle))axis.css({zIndex:++o.zIndex});if('se'==handle){axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');};this.handles[handle]='.ui-resizable-'+handle;this.element.append(axis);}}
512518 this._renderAxis=function(target){target=target||this.element;for(var i in this.handles){if(this.handles[i].constructor==String)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/js2/jquery-ui-1.7.2.js
@@ -1283,7 +1283,291 @@
12841284 });
12851285
12861286 })(jQuery);
 1287+
12871288 /*
 1289+ * jQuery UI Droppable 1.7.2
 1290+ *
 1291+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 1292+ * Dual licensed under the MIT (MIT-LICENSE.txt)
 1293+ * and GPL (GPL-LICENSE.txt) licenses.
 1294+ *
 1295+ * http://docs.jquery.com/UI/Droppables
 1296+ *
 1297+ * Depends:
 1298+ * ui.core.js
 1299+ * ui.draggable.js
 1300+ */
 1301+(function($) {
 1302+
 1303+$.widget("ui.droppable", {
 1304+
 1305+ _init: function() {
 1306+
 1307+ var o = this.options, accept = o.accept;
 1308+ this.isover = 0; this.isout = 1;
 1309+
 1310+ this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
 1311+ return d.is(accept);
 1312+ };
 1313+
 1314+ //Store the droppable's proportions
 1315+ this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
 1316+
 1317+ // Add the reference and positions to the manager
 1318+ $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
 1319+ $.ui.ddmanager.droppables[this.options.scope].push(this);
 1320+
 1321+ (this.options.addClasses && this.element.addClass("ui-droppable"));
 1322+
 1323+ },
 1324+
 1325+ destroy: function() {
 1326+ var drop = $.ui.ddmanager.droppables[this.options.scope];
 1327+ for ( var i = 0; i < drop.length; i++ )
 1328+ if ( drop[i] == this )
 1329+ drop.splice(i, 1);
 1330+
 1331+ this.element
 1332+ .removeClass("ui-droppable ui-droppable-disabled")
 1333+ .removeData("droppable")
 1334+ .unbind(".droppable");
 1335+ },
 1336+
 1337+ _setData: function(key, value) {
 1338+
 1339+ if(key == 'accept') {
 1340+ this.options.accept = value && $.isFunction(value) ? value : function(d) {
 1341+ return d.is(value);
 1342+ };
 1343+ } else {
 1344+ $.widget.prototype._setData.apply(this, arguments);
 1345+ }
 1346+
 1347+ },
 1348+
 1349+ _activate: function(event) {
 1350+ var draggable = $.ui.ddmanager.current;
 1351+ if(this.options.activeClass) this.element.addClass(this.options.activeClass);
 1352+ (draggable && this._trigger('activate', event, this.ui(draggable)));
 1353+ },
 1354+
 1355+ _deactivate: function(event) {
 1356+ var draggable = $.ui.ddmanager.current;
 1357+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
 1358+ (draggable && this._trigger('deactivate', event, this.ui(draggable)));
 1359+ },
 1360+
 1361+ _over: function(event) {
 1362+
 1363+ var draggable = $.ui.ddmanager.current;
 1364+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
 1365+
 1366+ if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 1367+ if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
 1368+ this._trigger('over', event, this.ui(draggable));
 1369+ }
 1370+
 1371+ },
 1372+
 1373+ _out: function(event) {
 1374+
 1375+ var draggable = $.ui.ddmanager.current;
 1376+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
 1377+
 1378+ if (this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 1379+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
 1380+ this._trigger('out', event, this.ui(draggable));
 1381+ }
 1382+
 1383+ },
 1384+
 1385+ _drop: function(event,custom) {
 1386+
 1387+ var draggable = custom || $.ui.ddmanager.current;
 1388+ if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
 1389+
 1390+ var childrenIntersection = false;
 1391+ this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
 1392+ var inst = $.data(this, 'droppable');
 1393+ if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
 1394+ childrenIntersection = true; return false;
 1395+ }
 1396+ });
 1397+ if(childrenIntersection) return false;
 1398+
 1399+ if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 1400+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
 1401+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
 1402+ this._trigger('drop', event, this.ui(draggable));
 1403+ return this.element;
 1404+ }
 1405+
 1406+ return false;
 1407+
 1408+ },
 1409+
 1410+ ui: function(c) {
 1411+ return {
 1412+ draggable: (c.currentItem || c.element),
 1413+ helper: c.helper,
 1414+ position: c.position,
 1415+ absolutePosition: c.positionAbs, //deprecated
 1416+ offset: c.positionAbs
 1417+ };
 1418+ }
 1419+
 1420+});
 1421+
 1422+$.extend($.ui.droppable, {
 1423+ version: "1.7.2",
 1424+ eventPrefix: 'drop',
 1425+ defaults: {
 1426+ accept: '*',
 1427+ activeClass: false,
 1428+ addClasses: true,
 1429+ greedy: false,
 1430+ hoverClass: false,
 1431+ scope: 'default',
 1432+ tolerance: 'intersect'
 1433+ }
 1434+});
 1435+
 1436+$.ui.intersect = function(draggable, droppable, toleranceMode) {
 1437+
 1438+ if (!droppable.offset) return false;
 1439+
 1440+ var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
 1441+ y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
 1442+ var l = droppable.offset.left, r = l + droppable.proportions.width,
 1443+ t = droppable.offset.top, b = t + droppable.proportions.height;
 1444+
 1445+ switch (toleranceMode) {
 1446+ case 'fit':
 1447+ return (l < x1 && x2 < r
 1448+ && t < y1 && y2 < b);
 1449+ break;
 1450+ case 'intersect':
 1451+ return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
 1452+ && x2 - (draggable.helperProportions.width / 2) < r // Left Half
 1453+ && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
 1454+ && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
 1455+ break;
 1456+ case 'pointer':
 1457+ var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
 1458+ draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
 1459+ isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
 1460+ return isOver;
 1461+ break;
 1462+ case 'touch':
 1463+ return (
 1464+ (y1 >= t && y1 <= b) || // Top edge touching
 1465+ (y2 >= t && y2 <= b) || // Bottom edge touching
 1466+ (y1 < t && y2 > b) // Surrounded vertically
 1467+ ) && (
 1468+ (x1 >= l && x1 <= r) || // Left edge touching
 1469+ (x2 >= l && x2 <= r) || // Right edge touching
 1470+ (x1 < l && x2 > r) // Surrounded horizontally
 1471+ );
 1472+ break;
 1473+ default:
 1474+ return false;
 1475+ break;
 1476+ }
 1477+
 1478+};
 1479+
 1480+/*
 1481+ This manager tracks offsets of draggables and droppables
 1482+*/
 1483+$.ui.ddmanager = {
 1484+ current: null,
 1485+ droppables: { 'default': [] },
 1486+ prepareOffsets: function(t, event) {
 1487+
 1488+ var m = $.ui.ddmanager.droppables[t.options.scope];
 1489+ var type = event ? event.type : null; // workaround for #2317
 1490+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
 1491+
 1492+ droppablesLoop: for (var i = 0; i < m.length; i++) {
 1493+
 1494+ if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
 1495+ 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
 1496+ m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
 1497+
 1498+ m[i].offset = m[i].element.offset();
 1499+ m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
 1500+
 1501+ if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
 1502+
 1503+ }
 1504+
 1505+ },
 1506+ drop: function(draggable, event) {
 1507+
 1508+ var dropped = false;
 1509+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
 1510+
 1511+ if(!this.options) return;
 1512+ if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
 1513+ dropped = this._drop.call(this, event);
 1514+
 1515+ if (!this.options.disabled && this.visible && this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
 1516+ this.isout = 1; this.isover = 0;
 1517+ this._deactivate.call(this, event);
 1518+ }
 1519+
 1520+ });
 1521+ return dropped;
 1522+
 1523+ },
 1524+ drag: function(draggable, event) {
 1525+
 1526+ //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
 1527+ if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
 1528+
 1529+ //Run through all droppables and check their positions based on specific tolerance options
 1530+
 1531+ $.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
 1532+
 1533+ if(this.options.disabled || this.greedyChild || !this.visible) return;
 1534+ var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
 1535+
 1536+ var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
 1537+ if(!c) return;
 1538+
 1539+ var parentInstance;
 1540+ if (this.options.greedy) {
 1541+ var parent = this.element.parents(':data(droppable):eq(0)');
 1542+ if (parent.length) {
 1543+ parentInstance = $.data(parent[0], 'droppable');
 1544+ parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
 1545+ }
 1546+ }
 1547+
 1548+ // we just moved into a greedy child
 1549+ if (parentInstance && c == 'isover') {
 1550+ parentInstance['isover'] = 0;
 1551+ parentInstance['isout'] = 1;
 1552+ parentInstance._out.call(parentInstance, event);
 1553+ }
 1554+
 1555+ this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
 1556+ this[c == "isover" ? "_over" : "_out"].call(this, event);
 1557+
 1558+ // we just moved out of a greedy child
 1559+ if (parentInstance && c == 'isout') {
 1560+ parentInstance['isout'] = 0;
 1561+ parentInstance['isover'] = 1;
 1562+ parentInstance._over.call(parentInstance, event);
 1563+ }
 1564+ });
 1565+
 1566+ }
 1567+};
 1568+
 1569+})(jQuery);
 1570+
 1571+/*
12881572 * jQuery UI Resizable 1.7.2
12891573 *
12901574 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)

Comments

#Comment by Tim Starling (talk | contribs)   03:47, 24 March 2010

This looks like it needs a merge to trunk and 1.16 to avoid losing it in the next wmf-deployment rebuild.

#Comment by Werdna (talk | contribs)   08:48, 24 March 2010

It shouldn't need to be, since we now use $wgOut->includeJQuery(), and add the plugins separately.

Status & tagging log