root/galaxy-central/static/scripts/packed/jquery.event.drop.js @ 2

リビジョン 2, 2.7 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1/* jquery.event.drop.js * v1.2
2Copyright (c) 2008-2009, Three Dub Media (http://threedubmedia.com) 
3Liscensed under the MIT License (http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt)
4*/
5(function(f){f.fn.drop=function(i,h,g){if(h){this.bind("dropstart",i)}if(g){this.bind("dropend",g)}return !i?this.trigger("drop"):this.bind("drop",h?h:i)};f.dropManage=function(g){g=g||{};c.data=[];c.filter=g.filter||"*";c.delay=g.delay||c.delay;c.tolerance=g.tolerance||null;c.mode=g.mode||c.mode||"intersect";return c.$targets.filter(c.filter).each(function(){c.data[c.data.length]=c.locate(this)})};var d=f.event,b=d.special,c=b.drop={delay:100,mode:"intersect",$targets:f([]),data:[],setup:function(){c.$targets=c.$targets.add(this);c.data[c.data.length]=c.locate(this)},teardown:function(){var g=this;c.$targets=c.$targets.not(this);c.data=f.grep(c.data,function(h){return(h.elem!==g)})},handler:function(h){var g=null,i;h.dropTarget=c.dropping||undefined;if(c.data.length&&h.dragTarget){switch(h.type){case"drag":c.event=h;if(!c.timer){c.timer=setTimeout(e,20)}break;case"mouseup":c.timer=clearTimeout(c.timer);if(!c.dropping){break}if(c.allowed){i=a(h,"drop",c.dropping)}g=false;case c.dropping&&"dropstart":g=g===null&&c.allowed?true:false;case c.dropping&&"dropend":a(h,"dropend",c.dropping);c.dropping=null;if(i===false){h.dropTarget=undefined}if(!g){break}case c.allowed&&"dropstart":h.dropTarget=this;c.dropping=a(h,"dropstart",this)!==false?this:null;break}}},locate:function(k){var i=f(k),l=i.offset(),j=i.outerHeight(),g=i.outerWidth();return{elem:k,L:l.left,R:l.left+g,T:l.top,B:l.top+j,W:g,H:j}},contains:function(g,h){return((h[0]||h.L)>=g.L&&(h[0]||h.R)<=g.R&&(h[1]||h.T)>=g.T&&(h[1]||h.B)<=g.B)},modes:{intersect:function(h,g,i){return this.contains(i,[h.pageX,h.pageY])?i:this.modes.overlap.apply(this,arguments)},overlap:function(h,g,i){i.overlap=Math.max(0,Math.min(i.B,g.B)-Math.max(i.T,g.T))*Math.max(0,Math.min(i.R,g.R)-Math.max(i.L,g.L));if(i.overlap>((this.best||{}).overlap||0)){this.best=i}return null},fit:function(h,g,i){return this.contains(i,g)?i:null},middle:function(h,g,i){return this.contains(i,[g.L+g.W/2,g.T+g.H/2])?i:null}}};function a(k,i,j){k.type=i;try{var g=d.handle.call(j,k)}catch(h){}return g===false?false:g||k.result}function e(){var h=0,g,j,k=[c.event.pageX,c.event.pageY],l=c.locate(c.event.dragProxy);c.tolerance=c.tolerance||c.modes[c.mode];do{if(g=c.data[h]){j=c.tolerance?c.tolerance.call(c,c.event,l,g):c.contains(g,k)?g:null}}while(++h<c.data.length&&!j);c.event.type=(j=j||c.best)?"dropstart":"dropend";if(c.event.type=="dropend"||j.elem!=c.dropping){c.handler.call(j?j.elem:c.dropping,c.event)}if(c.last&&k[0]==c.last.pageX&&k[1]==c.last.pageY){delete c.timer}else{c.timer=setTimeout(e,c.delay)}c.last=c.event;c.best=null}})(jQuery);
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。